3 dump("Content running top level script " + window
.location
.href
+ "\n");
5 var winID
= SpecialPowers
.wrap(this).windowGlobalChild
.innerWindowId
;
9 var currID
= SpecialPowers
.wrap(subject
).QueryInterface(SpecialPowers
.Ci
.nsISupportsPRUint64
).data
;
10 if (currID
!= winID
) {
13 // We should be able to wrap the inner window when the outer
14 // window has navigated out of process.
15 SpecialPowers
.Cu
.getGlobalForObject({});
17 SpecialPowers
.removeObserver(observer
, "inner-window-nuked");
20 SpecialPowers
.addObserver(observer
, "inner-window-nuked");
22 // Unfortunately, we don't currently fire the onload event on a remote iframe,
23 // so we can't listen for the load event directly on the iframe. Instead, we
24 // postMessage from the iframe when the load event would be fired.
25 window
.addEventListener("load", function onload() {
26 dump("Content got load of " + window
.location
.href
+ "\n");
28 window
.parent
.postMessage({
30 location
: window
.location
.href
,
34 let h1
= document
.createElement("h1");
35 h1
.textContent
= window
.location
.href
;
36 document
.body
.appendChild(h1
);
39 // In addition, we listen to the message event to trigger navigations of
40 // ourself when requested, as we don't fully support our embedder triggering
41 // us being navigated yet for Totally Not Buggy Reasons.
42 window
.addEventListener("message", function onmessage(event
) {
43 dump("Content got event " + window
.location
.href
+ " " + JSON
.stringify(event
.data
) + "\n");
44 if (event
.data
.action
=== "navigate") {
45 window
.location
= event
.data
.location
;