Allow windows to share browsing contexts.#15120
Conversation
|
Heads up! This PR modifies the following files:
|
|
r? @jdm |
98a3843 to
ba006bc
Compare
|
I think my changes in #15118 may make some of the mutable Reflector changes unnecessary (particularly if we modify rust-mozjs to make Heap::set not require &mut self). |
|
You're right, we could use |
ba006bc to
7129af4
Compare
|
@jdm: I used |
|
@cbrewster does this PR fix the problems you were having with webstorage tests? http://logs.glob.uno/?c=mozilla%23servo&s=11+Jan+2017&e=11+Jan+2017#c591494 |
|
For the record, here's the IRC conversation I had with @bzbarsky about brain transplanting window proxy objects: http://logs.glob.uno/?c=mozilla%23jsapi&s=19+Jan+2017&e=19+Jan+2017#c819204 |
|
☔ The latest upstream changes (presumably #15136) made this pull request unmergeable. Please resolve the merge conflicts. |
7129af4 to
dee9594
Compare
|
☔ The latest upstream changes (presumably #15176) made this pull request unmergeable. Please resolve the merge conflicts. |
dee9594 to
e5254db
Compare
| // Set the window proxy. | ||
| SetWindowProxy(cx, window_jsobject, new_window_proxy.handle()); | ||
|
|
||
| // Create a new reflector. |
| // Transfer ownership of this browsing context from the old window proxy to the new one. | ||
| SetProxyExtra(new_window_proxy.get(), 0, &PrivateValue(self as *const _ as *const _)); | ||
|
|
||
| // Set the window proxy. |
There was a problem hiding this comment.
This comment is redundant given the function name. How about Notify the JS engine that the window proxy has changed.?
components/script/dom/document.rs
Outdated
| @@ -184,12 +184,12 @@ pub struct Document { | |||
| node: Node, | |||
| window: JS<Window>, | |||
| /// https://html.spec.whatwg.org/multipage/#concept-document-bc | |||
There was a problem hiding this comment.
This comment doesn't belong any more.
components/script/dom/document.rs
Outdated
|
|
||
| pub fn new(window: &Window, | ||
| browsing_context: Option<&BrowsingContext>, | ||
| has_browsing_context: bool, |
There was a problem hiding this comment.
I lean towards a self-documenting enum here, given that every caller passes a boolean literal.
components/script/script_thread.rs
Outdated
| /// The documents for pipelines managed by this thread | ||
| documents: DOMRefCell<Documents>, | ||
| /// The browsing contexts known by this thread | ||
| /// TODO: this map grows, but never shrinks. |
There was a problem hiding this comment.
We should file an issue about this and mention it here.
|
⌛ Testing commit 2e863a9 with merge 4f1d6ba... |
|
💔 Test failed - mac-dev-unit |
|
That would be caused by it picking up the old version of rust-mozjs. Wait for servo/rust-mozjs#329 to land... |
|
☔ The latest upstream changes (presumably #14971) made this pull request unmergeable. Please resolve the merge conflicts. |
2e863a9 to
403499a
Compare
|
servo/rust-mozjs#329 has landed. Rebased. @bors-servo: r=jdm |
|
📌 Commit 403499a has been approved by |
…xts, r=jdm Allow windows to share browsing contexts. <!-- Please describe your changes on the following line: --> This PR allows different `Window` objects in the same browsing context to share a `BrowsingContext` object. SpiderMonkey requires a `WindowProxy` object to be in the same compartment as its `Window`, so when a `WindowProxy` changes `Window`, we have to brain-transplant it. In turn this requires the reflector of a `BrowsingContext` to be mutable. --- <!-- 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 #13608 and #14843 - [X] These changes do not require tests because an existing test catches this (`/html/browsers/the-window-object/Window-document.html` is now `PASS`) <!-- 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/15120) <!-- Reviewable:end -->
|
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-gnu-dev, windows-msvc-dev |
This PR allows different
Windowobjects in the same browsing context to share aBrowsingContextobject.SpiderMonkey requires a
WindowProxyobject to be in the same compartment as itsWindow, so when aWindowProxychangesWindow, we have to brain-transplant it. In turn this requires the reflector of aBrowsingContextto be mutable../mach build -ddoes not report any errors./mach test-tidydoes not report any errors/html/browsers/the-window-object/Window-document.htmlis nowPASS)This change is