diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2018-10-29 15:29:31 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-29 15:29:31 -0400 |
commit | 2f8dc655191455c285d4b4b5952d493fd4dc0782 (patch) | |
tree | 8d066838def6f22897690e4c8d3763ce693ca093 /components/script | |
parent | a59a80b301d1a90585b47fb2dd8e157a44ab718a (diff) | |
parent | 10442ae894004ac18847793bc11bfa1c4653cb79 (diff) | |
download | servo-2f8dc655191455c285d4b4b5952d493fd4dc0782.tar.gz servo-2f8dc655191455c285d4b4b5952d493fd4dc0782.zip |
Auto merge of #21976 - notriddle:iframe-target-form-race, r=jdm
Assign a name to iframes when loading the initial about:blank
Before, it would assign the name too late, causing scripts (which will not wait for another tick) to accidentally spawn pop-up windows instead of loading into the iframe.
---
<!-- 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 #21886
- [x] There are tests for these changes
<!-- 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/21976)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/htmliframeelement.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index 3c37c97af4c..c44ed04b265 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -217,6 +217,16 @@ impl HTMLIFrameElement { let window = window_from_node(self); + // https://html.spec.whatwg.org/multipage/#attr-iframe-name + // Note: the spec says to set the name 'when the nested browsing context is created'. + // The current implementation sets the name on the window, + // when the iframe attributes are first processed. + if mode == ProcessingMode::FirstTime { + if let Some(window) = self.GetContentWindow() { + window.set_name(self.name.borrow().clone()) + } + } + // https://github.com/whatwg/html/issues/490 if mode == ProcessingMode::FirstTime && !self.upcast::<Element>().has_attribute(&local_name!("src")) @@ -233,16 +243,6 @@ impl HTMLIFrameElement { return; } - // https://html.spec.whatwg.org/multipage/#attr-iframe-name - // Note: the spec says to set the name 'when the nested browsing context is created'. - // The current implementation sets the name on the window, - // when the iframe attributes are first processed. - if mode == ProcessingMode::FirstTime { - if let Some(window) = self.GetContentWindow() { - window.set_name(self.name.borrow().clone()) - } - } - let url = self.get_url(); // TODO: check ancestor browsing contexts for same URL |