Skip to content

mozbrowsersecuritychange event - #9244

Merged
bors-servo merged 1 commit into
servo:masterfrom
paulrouget:securitychange
Feb 9, 2016
Merged

bors-servo merged 1 commit into
servo:masterfrom
paulrouget:securitychange

Conversation

@paulrouget

Copy link
Copy Markdown
Contributor

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)

Review on Reviewable

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jan 11, 2016
@frewsxcv

Copy link
Copy Markdown
Contributor

components/script/dom/document.rs, line 126 [r1] (raw file):
This enum already exists in net_traits/response.rs.

Relevant PRs: #9153, #9153


Comments from the review on Reviewable.io

@frewsxcv

Copy link
Copy Markdown
Contributor

components/script/dom/document.rs, line 126 [r1] (raw file):
Second PR link was supposed to be #9165


Comments from the review on Reviewable.io

@paulrouget

Copy link
Copy Markdown
Contributor Author

Using the existing HttpsState enum.

3 questions:

  • how do I test this feature? Anyway to mock a https connection?
  • as explained in the first comment, is it possible to send a HttpsState object instead of a string when calling trigger_mozbrowser_event? I haven't found a way to add HttpsState to constellation_msg.rs.
  • how to catch broken/deprecated https connections? Maybe this could be done in a followup PR.

@jdm

jdm commented Jan 11, 2016

Copy link
Copy Markdown
Member

@bors-servo

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #9271) made this pull request unmergeable. Please resolve the merge conflicts.

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Jan 13, 2016
@paulrouget

Copy link
Copy Markdown
Contributor Author

Added a test. It fails, as expected (#6919). If I use my own http/https servers, it passes.

Now I can use HttpState to send a message. That looks a lot cleaner.

@jdm jdm removed the S-needs-rebase There are merge conflict errors. label Jan 22, 2016
@paulrouget

Copy link
Copy Markdown
Contributor Author

@frewsxcv / @jdm: review ping

@jdm jdm self-assigned this Jan 28, 2016

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make a separate async_test for each iframe so we get better granularity for test failures.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, I misread the test. You're right.

@jdm

jdm commented Feb 3, 2016

Copy link
Copy Markdown
Member

The code changes looks fine, but we can improve the test a bit more.

@jdm jdm added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Feb 3, 2016
@@ -0,0 +1,49 @@
<head>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's give this a <title> and update the ini to use that instead of Untitled.

@jdm

jdm commented Feb 4, 2016

Copy link
Copy Markdown
Member

I will therefore reinstate two of my previous comments that I deleted after making the request to split the test.

@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Feb 5, 2016
@paulrouget

Copy link
Copy Markdown
Contributor Author

I will therefore reinstate two of my previous comments

Addressed.

@@ -0,0 +1,46 @@
<head>
<title>mozbrowsersecuritychange</title>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about "mozbrowsersecuritychange event is dispatched when content security state changes"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@jdm jdm added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Feb 8, 2016
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Feb 9, 2016
@paulrouget

Copy link
Copy Markdown
Contributor Author

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.

@jdm

jdm commented Feb 9, 2016

Copy link
Copy Markdown
Member

@bors-servo: r+
Thanks!

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 63519c3 has been approved by jdm

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 63519c3 with merge 3d63f09...

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Feb 9, 2016
bors-servo pushed a commit that referenced this pull request Feb 9, 2016
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 -->
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, gonk, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt

@bors-servo
bors-servo merged commit 63519c3 into servo:master Feb 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants