Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upmozbrowsersecuritychange event #9244
Conversation
|
components/script/dom/document.rs, line 126 [r1] (raw file): Comments from the review on Reviewable.io |
|
components/script/dom/document.rs, line 126 [r1] (raw file): Comments from the review on Reviewable.io |
|
Using the existing 3 questions:
|
|
|
|
Added a test. It fails, as expected (#6919). If I use my own http/https servers, it passes. Now I can use |
| iframe.mozbrowser = "true"; | ||
| iframe.src = urls[url_index++]; | ||
|
|
||
| iframe.addEventListener("mozbrowsersecuritychange", t.step_func(e => { |
This comment has been minimized.
This comment has been minimized.
jdm
Feb 3, 2016
Member
Let's make a separate async_test for each iframe so we get better granularity for test failures.
This comment has been minimized.
This comment has been minimized.
paulrouget
Feb 4, 2016
Author
Contributor
I'm not sure to understand how that would help. There's only one iframe, and what matters is having the events to chain properly.
This comment has been minimized.
This comment has been minimized.
|
The code changes looks fine, but we can improve the test a bit more. |
| @@ -0,0 +1,49 @@ | |||
| <head> | |||
This comment has been minimized.
This comment has been minimized.
jdm
Feb 4, 2016
Member
Let's give this a <title> and update the ini to use that instead of Untitled.
| receivedEvents.push({ state: e.detail.state }); | ||
|
|
||
| if (receivedEvents.length == expectedEvents.length) { | ||
| for (var i = 0; i < expectedEvents.length; i++) { |
This comment has been minimized.
This comment has been minimized.
|
I will therefore reinstate two of my previous comments that I deleted after making the request to split the test. |
Addressed. |
| @@ -0,0 +1,46 @@ | |||
| <head> | |||
| <title>mozbrowsersecuritychange</title> | |||
This comment has been minimized.
This comment has been minimized.
jdm
Feb 8, 2016
Member
How about "mozbrowsersecuritychange event is dispatched when content security state changes"
This comment has been minimized.
This comment has been minimized.
| var expectedEvents = [ | ||
| "insecure", | ||
| "secure", | ||
| "insecure", |
This comment has been minimized.
This comment has been minimized.
jdm
Feb 8, 2016
Member
Let's load each page twice in a row to ensure that we don't get events when the state doesn't change. On the other hand, if that's not something we care about, the text at https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowsersecuritychange should be updated to be more precise.
Gecko fires this event even if the state doesn't actually change. I'll update MDN. |
|
@bors-servo: r+ |
|
|
mozbrowsersecuritychange event Fixes #8544 No test yet. Is there a way to mock a https connection? Also, I wish I could use the `HTTPSState` enum instead of a `String` when calling `trigger_mozbrowser_event` (https://github.com/servo/servo/compare/master...paulrouget:securitychange?expand=1#diff-30a18e04d7e0b66aafdf192e416cad44R306) but that would require `constellation_msg.rs` to know about `HTTPSState`, which is defined in `document.rs`, which would add a dependency to `components/msg`. I could define `HTTPSState` somewhere else maybe? Or maybe it's fine to use a `String`. But then, should I use the HTTPSState strings (`"modern/deprecated/none"`) or the mozbrowser strings (`"secure/insecure/broken"`) (as it is now) <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9244) <!-- Reviewable:end -->
|
|
paulrouget commentedJan 11, 2016
Fixes #8544
No test yet. Is there a way to mock a https connection?
Also, I wish I could use the
HTTPSStateenum instead of aStringwhen callingtrigger_mozbrowser_event(https://github.com/servo/servo/compare/master...paulrouget:securitychange?expand=1#diff-30a18e04d7e0b66aafdf192e416cad44R306) but that would requireconstellation_msg.rsto know aboutHTTPSState, which is defined indocument.rs, which would add a dependency tocomponents/msg. I could defineHTTPSStatesomewhere else maybe? Or maybe it's fine to use aString. But then, should I use the HTTPSState strings ("modern/deprecated/none") or the mozbrowser strings ("secure/insecure/broken") (as it is now)