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 upBrowsing context names #20036
Browsing context names #20036
Conversation
highfive
commented
Feb 13, 2018
|
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @metajack (or someone else) soon. |
highfive
commented
Feb 13, 2018
|
Heads up! This PR modifies the following files:
|
highfive
commented
Feb 13, 2018
|
r? @jdm |
53649e8
to
577b78d
|
|
276d7cd
to
b2fc4e0
|
Thanks for working on this! |
| @@ -10,9 +10,8 @@ interface HTMLIFrameElement : HTMLElement { | |||
| // [CEReactions] | |||
| // attribute DOMString srcdoc; | |||
|
|
|||
| // https://github.com/servo/servo/issues/14453 | |||
| // [CEReactions] | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| @@ -1019,6 +1019,20 @@ impl WindowMethods for Window { | |||
| fn TestRunner(&self) -> DomRoot<TestRunner> { | |||
| self.test_runner.or_init(|| TestRunner::new(self.upcast())) | |||
| } | |||
|
|
|||
| // https://fetch.spec.whatwg.org/multipage/browsers.html#browsing-context-names | |||
This comment has been minimized.
This comment has been minimized.
| } | ||
|
|
||
| // https://fetch.spec.whatwg.org/multipage/browsers.html#browsing-context-names | ||
| fn Name(&self) -> DOMString { |
This comment has been minimized.
This comment has been minimized.
| @@ -457,6 +459,18 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement { | |||
| make_getter!(FrameBorder, "frameborder"); | |||
| // https://html.spec.whatwg.org/multipage/#other-elements,-attributes-and-apis:attr-iframe-frameborder | |||
| make_setter!(SetFrameBorder, "frameborder"); | |||
|
|
|||
| fn SetName(&self, name: DOMString) { | |||
This comment has been minimized.
This comment has been minimized.
cbrewster
Feb 13, 2018
Member
Add spec comment: https://html.spec.whatwg.org/multipage/#dom-iframe-name
| } | ||
| } | ||
|
|
||
| fn Name(&self) -> DOMString { |
This comment has been minimized.
This comment has been minimized.
cbrewster
Feb 13, 2018
Member
Add spec comment: https://html.spec.whatwg.org/multipage/#dom-iframe-name
| @@ -457,6 +459,18 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement { | |||
| make_getter!(FrameBorder, "frameborder"); | |||
| // https://html.spec.whatwg.org/multipage/#other-elements,-attributes-and-apis:attr-iframe-frameborder | |||
| make_setter!(SetFrameBorder, "frameborder"); | |||
|
|
|||
| fn SetName(&self, name: DOMString) { | |||
| window_from_node(self).window_proxy().set_name(name.clone()); | |||
This comment has been minimized.
This comment has been minimized.
cbrewster
Feb 13, 2018
Member
We probably don't want to do this as it would set the name of the browsing context of the window that contains the iframe. We just want to set the name of the content window's browsing context. (The browsing context inside the iframe).
Note: If the child window is on a different script thread, we must send a message to the constellation which will then send a message back to the script thread with child window and update the name there.
This comment has been minimized.
This comment has been minimized.
paavininanda
Feb 14, 2018
Author
Contributor
So do we need to send a message to constellation using script_traits::ScriptMsg ? If yes then which method of all the available methods is to be used ?
| // https://fetch.spec.whatwg.org/multipage/browsers.html#browsing-context-names | ||
| fn SetName(&self, name: DOMString) { | ||
| self.window_proxy().set_name(name.clone()); | ||
| if let Some(parent) = self.window_proxy().parent() { |
This comment has been minimized.
This comment has been minimized.
cbrewster
Feb 13, 2018
Member
I don't believe we should be setting the parent browsing context's name, just the browsing context of this window.
| @@ -55,6 +57,8 @@ pub struct WindowProxy { | |||
| /// In the case that this is a top-level window, this is our id. | |||
| top_level_browsing_context_id: TopLevelBrowsingContextId, | |||
|
|
|||
| /// The name of the browsing context | |||
| name: DomRefCell<DOMString>, | |||
This comment has been minimized.
This comment has been minimized.
cbrewster
Feb 13, 2018
Member
I'm not sure if this is something that should be stored on the WindowProxy or if it will need to be stored in the constellation on the BrowsingContext. cc @asajeffrey @jdm
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
cbrewster
Feb 13, 2018
•
Member
It's quite possible it should be stored here, just wanted to double check
This comment has been minimized.
This comment has been minimized.
jdm
Feb 14, 2018
Member
I suspect we can get away with only storing the name in script/, rather than duplicating it in the constellation.
This comment has been minimized.
This comment has been minimized.
asajeffrey
Feb 14, 2018
Member
@jdm: not sure about that, what about when an existing bc has a document opened in a new (to it) script thread?
|
Hi there, this is all looking good for the case of immutable access to the browsing context name. The problem as mentioned by @cbrewster is the mutable case, since this would involve sending a message to the constellation to notify it of the name change. Moreover, the name change is expected to be synchronous, which is probably going to make the logic quite torturous. Perhaps the thing to do is just implement the immutable case, mark the attribute read-only in the webidl, with a comment referencing an issue to implement setting the BC name? Seem like a good idea? @paavininanda @jdm? |
|
https://mozilla.logbot.info/servo/20180214#c14302329-c14302486 is a discussion I had with asajeffrey. I think they're right that we should put off the message-sending part of this; it will require a bit more thought to make sure we're not missing anything. We don't need to make the name read-only, though; for the case we care about the most, the implementation that modifies the name stored in the window proxy should work for our same-origin iframe case. |
|
One other change that we'll need (to support changing the name attribute on an iframe):
let value = mutation.new_value(attr).map_or("", |v| &v);
self.SetName(DOMString::from(value.to_owned())); |
| @@ -67,6 +67,7 @@ enum ProcessingMode { | |||
| pub struct HTMLIFrameElement { | |||
| htmlelement: HTMLElement, | |||
| top_level_browsing_context_id: Cell<Option<TopLevelBrowsingContextId>>, | |||
| name: DomRefCell<DOMString>, | |||
This comment has been minimized.
This comment has been minimized.
| } | ||
|
|
||
| fn Name(&self) -> DOMString { | ||
| window_from_node(self).window_proxy().get_name() |
This comment has been minimized.
This comment has been minimized.
| @@ -84,6 +88,7 @@ impl WindowProxy { | |||
| reflector: Reflector::new(), | |||
| browsing_context_id: browsing_context_id, | |||
| top_level_browsing_context_id: top_level_browsing_context_id, | |||
| name: DomRefCell::new(DOMString::new()), | |||
This comment has been minimized.
This comment has been minimized.
jdm
Feb 14, 2018
Member
To support the case of <iframe src="whatever.html" name="hello">, we need to do this:
let name = frame_element.map_or(DOMString::new(), |e| e.get_string_attribute(&local_name!("name")));
...
name: DomRefCell::new(name),
This is giving an error - |
|
Try let new_value = mutation.new_value(attr);
let value = new_value.as_ref().map_or("", |v| &v); |
b2fc4e0
to
73467e9
|
Almost there! Once the [CEReactions] attribute is added, we can run this through the tryserver and hopefully get a long list of new test results! |
| // https://github.com/servo/servo/issues/14453 | ||
| // [CEReactions] | ||
| // attribute DOMString name; | ||
| attribute DOMString name; |
This comment has been minimized.
This comment has been minimized.
| // https://html.spec.whatwg.org/multipage/#dom-iframe-name | ||
| fn SetName(&self, name: DOMString) { | ||
| if let Some(window) = self.GetContentWindow() { | ||
| let mut child_window = &*window; |
This comment has been minimized.
This comment has been minimized.
jdm
Feb 22, 2018
Member
Is this line actually necessary? If it is, we should at least be able to remove the mut.
| // https://html.spec.whatwg.org/multipage/#dom-iframe-name | ||
| fn Name(&self) -> DOMString { | ||
| if let Some(window) = self.GetContentWindow() { | ||
| let mut child_window = &*window; |
This comment has been minimized.
This comment has been minimized.
73467e9
to
bf75e6b
|
Didn't work, still getting the same error. |
|
Oh! I ran it locally and realized that the test is written poorly (since it uses JS strict mode but does not declare |
|
Oh, and you can undo the change to gl-uniformmatrix4fv.html before committing. |
e45d284
to
e6e94e3
| [ | ||
| {} | ||
| ] | ||
| ], |
This comment has been minimized.
This comment has been minimized.
paavininanda
Feb 23, 2018
•
Author
Contributor
I think I'll have to manually remove all the ./.DS_Store part
This comment has been minimized.
This comment has been minimized.
jdm
Feb 23, 2018
Member
You should just be able to revert all of the MANIFEST.json changes entirely.
e6e94e3
to
d531683
3608bd7
to
88c5fdd
|
The changes to gl-uniformmatrix4fv.html.ini are missing; otherwise this looks good. |
|
You should be able to run |
68d750f
to
b9f7aa4
|
@bors-servo r+ |
|
|
Browsing context names <!-- 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 #14453 <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/20036) <!-- Reviewable:end -->
|
|
|
@bors-servo retry |
|
|
|
|
paavininanda commentedFeb 13, 2018
•
edited by SimonSapin
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is