Repository navigation
Browsing context names - #20036
Browsing context names#20036
Conversation
|
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. |
|
Heads up! This PR modifies the following files:
|
|
r? @jdm |
53649e8 to
577b78d
Compare
|
☔ The latest upstream changes (presumably #19975) made this pull request unmergeable. Please resolve the merge conflicts. |
276d7cd to
b2fc4e0
Compare
| // attribute DOMString srcdoc; | ||
|
|
||
| // https://github.com/servo/servo/issues/14453 | ||
| // [CEReactions] |
There was a problem hiding this comment.
Uncomment the [CEReactions] annotation here.
There was a problem hiding this comment.
I read it wrong :/ long back.
| self.test_runner.or_init(|| TestRunner::new(self.upcast())) | ||
| } | ||
|
|
||
| // https://fetch.spec.whatwg.org/multipage/browsers.html#browsing-context-names |
There was a problem hiding this comment.
This should be https://html.spec.whatwg.org/multipage/#dom-name
| } | ||
|
|
||
| // https://fetch.spec.whatwg.org/multipage/browsers.html#browsing-context-names | ||
| fn Name(&self) -> DOMString { |
There was a problem hiding this comment.
This should be https://html.spec.whatwg.org/multipage/#dom-name
| // https://html.spec.whatwg.org/multipage/#other-elements,-attributes-and-apis:attr-iframe-frameborder | ||
| make_setter!(SetFrameBorder, "frameborder"); | ||
|
|
||
| fn SetName(&self, name: DOMString) { |
There was a problem hiding this comment.
Add spec comment: https://html.spec.whatwg.org/multipage/#dom-iframe-name
| } | ||
| } | ||
|
|
||
| fn Name(&self) -> DOMString { |
There was a problem hiding this comment.
Add spec comment: https://html.spec.whatwg.org/multipage/#dom-iframe-name
| make_setter!(SetFrameBorder, "frameborder"); | ||
|
|
||
| fn SetName(&self, name: DOMString) { | ||
| window_from_node(self).window_proxy().set_name(name.clone()); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
I don't believe we should be setting the parent browsing context's name, just the browsing context of this window.
| top_level_browsing_context_id: TopLevelBrowsingContextId, | ||
|
|
||
| /// The name of the browsing context | ||
| name: DomRefCell<DOMString>, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
The comment in the issue said so 😅 #14453
There was a problem hiding this comment.
It's quite possible it should be stored here, just wanted to double check 😄
There was a problem hiding this comment.
I suspect we can get away with only storing the name in script/, rather than duplicating it in the constellation.
There was a problem hiding this comment.
@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. |
jdm
left a comment
There was a problem hiding this comment.
One other change that we'll need (to support changing the name attribute on an iframe):
- in attribute_mutated in htmliframeelement.rs, add a branch for the "name" attribute and do:
let value = mutation.new_value(attr).map_or("", |v| &v);
self.SetName(DOMString::from(value.to_owned()));| pub struct HTMLIFrameElement { | ||
| htmlelement: HTMLElement, | ||
| top_level_browsing_context_id: Cell<Option<TopLevelBrowsingContextId>>, | ||
| name: DomRefCell<DOMString>, |
There was a problem hiding this comment.
We should not need to store a name in this data structure.
| } | ||
|
|
||
| fn Name(&self) -> DOMString { | ||
| window_from_node(self).window_proxy().get_name() |
There was a problem hiding this comment.
Use self.GetContentWindow(), and if it exists we can call get_name() on it.
| reflector: Reflector::new(), | ||
| browsing_context_id: browsing_context_id, | ||
| top_level_browsing_context_id: top_level_browsing_context_id, | ||
| name: DomRefCell::new(DOMString::new()), |
There was a problem hiding this comment.
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
Compare
jdm
left a comment
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
We need to keep the [CEReactions] attribute.
| // 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; |
There was a problem hiding this comment.
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; |
73467e9 to
bf75e6b
Compare
|
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
Compare
| [ | ||
| {} | ||
| ] | ||
| ], |
There was a problem hiding this comment.
I think I'll have to manually remove all the ./.DS_Store part
There was a problem hiding this comment.
You should just be able to revert all of the MANIFEST.json changes entirely.
e6e94e3 to
d531683
Compare
3608bd7 to
88c5fdd
Compare
|
The changes to gl-uniformmatrix4fv.html.ini are missing; otherwise this looks good. |
|
You should be able to run |
68d750f to
b9f7aa4
Compare
|
@bors-servo r+ |
|
📌 Commit b9f7aa4 has been approved by |
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 -->
|
💔 Test failed - mac-rel-wpt1 |
|
⚡ Previous build results for android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev are reusable. Rebuilding only mac-rel-wpt1... |
|
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev |
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is