servo: Merge #15120 - Allow windows to share browsing contexts (from asajeffrey:script-windows-share-browsing-contexts); r=jdm

<!-- 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. -->

Source-Repo: https://github.com/servo/servo
Source-Revision: 67c182638253211553161495cd2e4570002fd5bc
This commit is contained in:
Alan Jeffrey
2017-01-28 20:35:39 -08:00
parent 709833ce53
commit 5a393b1395
17 changed files with 177 additions and 116 deletions

View File

@@ -16,7 +16,6 @@ use dom::globalscope::GlobalScope;
use js::jsapi::{HandleValue, Heap, JSContext};
use js::jsval::JSVal;
use servo_atoms::Atom;
use std::default::Default;
#[dom_struct]
pub struct MessageEvent {
@@ -38,13 +37,12 @@ impl MessageEvent {
data: HandleValue,
origin: DOMString,
lastEventId: DOMString) -> Root<MessageEvent> {
let mut ev = box MessageEvent {
let ev = box MessageEvent {
event: Event::new_inherited(),
data: Heap::default(),
data: Heap::new(data.get()),
origin: origin,
lastEventId: lastEventId,
};
ev.data.set(data.get());
reflect_dom_object(ev, global, MessageEventBinding::Wrap)
}