exports["test send cpow"] = function*(assert) { if (!isE10S) { assert.pass("Skipping test in non-e10s mode"); return; } let window = getMostRecentBrowserWindow(); let tabs = getTabs(window); assert.equal(tabs.length, 1, "Should have just the one tab to start with"); let tab = tabs[0]; let browser = getBrowserForTab(tab); assert.ok(Cu.isCrossProcessWrapper(browser.contentWindow), "Should have a CPOW for the browser content window"); let loader = new Loader(module); let { processes } = yield waitForProcesses(loader); processes.port.emitCPOW('sdk/test/cpow', ['foobar'], { window: browser.contentWindow }); let [process, arg, id] = yield promiseEvent(processes.port, 'sdk/test/cpow'); assert.ok(process.isRemote, "Response should come from the remote process"); assert.equal(arg, "foobar", "Argument should have passed through"); assert.equal(id, browser.outerWindowID, "Should have got the ID from the child"); };
exports.isCPOW = function (debuggerObject) { try { return Cu.isCrossProcessWrapper(debuggerObject.unsafeDereference()); } catch (e) { } return false; };
if (!keys.every(name => !Cu.isCrossProcessWrapper(objects[name])))
emit(this, "open", chromeWindow); this.observe(chromeWindow); }, onUntrack: chromeWindow => { emit(this, "close", chromeWindow); this.ignore(chromeWindow); } }); }, implements: [EventTarget, DOMEventAssembler], /** * Events that are supported and emitted by the module. */ supportedEventsTypes: [ "activate", "deactivate" ], /** * Function handles all the supported events on all the windows that are * observed. Method is used to proxy events to the listeners registered on * this event emitter. * @param {Event} event * Keyboard event being emitted. */ handleEvent(event) { // Ignore events from windows in the child process as they can't be top-level if (Cu.isCrossProcessWrapper(event.target)) return; emit(this, event.type, event.target, event); } }); exports.observer = new Observer();