Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apply user scripts correctly #15874

Merged
merged 1 commit into from Mar 13, 2017
Merged

apply user scripts correctly #15874

merged 1 commit into from Mar 13, 2017

Conversation

@sendilkumarn
Copy link
Contributor

sendilkumarn commented Mar 8, 2017


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #15082

This change is Reviewable

@highfive
Copy link

highfive commented Mar 8, 2017

Heads up! This PR modifies the following files:

  • @fitzgen: components/script/dom/userscripts.rs
  • @KiChjang: components/script/dom/userscripts.rs
@highfive
Copy link

highfive commented Mar 8, 2017

warning Warning warning

  • These commits modify script code, but no tests are modified. Please consider adding a test!
Copy link
Member

SimonSapin left a comment

r? @nox

let mut f = File::open(&file).unwrap();
let mut contents = vec![];
f.read_to_end(&mut contents).unwrap();
let script_text = String::from_utf8(contents).unwrap();

This comment has been minimized.

@SimonSapin

SimonSapin Mar 13, 2017

Member

This should use String::from_utf8_lossy, to replace UTF-8 errors with U+FFFD instead of panicking. This show that Firefox does so for external scripts:

data:text/html,<script src='data:text/html;charset=utf-8,document.write("%2580".charCodeAt(0).toString(16))'></script>
fffd
let mut contents = vec![];
f.read_to_end(&mut contents).unwrap();
let script_text = String::from_utf8(contents).unwrap();
win.upcast::<GlobalScope>().evaluate_js_on_global_with_result(&script_text, rval.handle_mut());

This comment has been minimized.

@SimonSapin

SimonSapin Mar 13, 2017

Member

@nox, does this line look right? (It doesn’t look particularly wrong to me, I just don’t know.)

This comment has been minimized.

@nox

nox Mar 13, 2017

Member

Yes, this is ok.

@SimonSapin SimonSapin assigned nox and unassigned SimonSapin Mar 13, 2017
replace to utf8_lossy
@sendilkumarn sendilkumarn force-pushed the sendilkumarn:user-script branch from a32e20b to 5b25cb3 Mar 13, 2017
@nox
Copy link
Member

nox commented Mar 13, 2017

@bors-servo
Copy link
Contributor

bors-servo commented Mar 13, 2017

📌 Commit 5b25cb3 has been approved by nox

@bors-servo
Copy link
Contributor

bors-servo commented Mar 13, 2017

Testing commit 5b25cb3 with merge d70c1e5...

bors-servo added a commit that referenced this pull request Mar 13, 2017
apply user scripts correctly

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #15082

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15874)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Mar 13, 2017

@bors-servo bors-servo merged commit 5b25cb3 into servo:master Mar 13, 2017
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

5 participants
You can’t perform that action at this time.