зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 1ba1259d55e5 (bug 1146603) for browser_dbg_event-listeners-04.js failures.
This commit is contained in:
Родитель
527747d5e6
Коммит
2a29040698
|
@ -5,7 +5,6 @@
|
|||
|
||||
const system = require('sdk/system/events');
|
||||
const { frames } = require('sdk/remote/child');
|
||||
const { WorkerChild } = require('sdk/content/worker-child');
|
||||
|
||||
// map observer topics to tab event names
|
||||
const EVENTS = {
|
||||
|
@ -35,8 +34,3 @@ function eventListener({target, type, persisted}) {
|
|||
frame.port.emit('sdk/tab/event', type, persisted);
|
||||
}
|
||||
frames.addEventListener('pageshow', eventListener, true);
|
||||
|
||||
frames.port.on('sdk/tab/attach', (frame, options) => {
|
||||
options.window = frame.content;
|
||||
new WorkerChild(options);
|
||||
});
|
||||
|
|
|
@ -12,7 +12,6 @@ let { data } = require('../self');
|
|||
let assetsURI = data.url();
|
||||
let isArray = Array.isArray;
|
||||
let method = require('../../method/core');
|
||||
let { uuid } = require('../util/uuid');
|
||||
|
||||
const isAddonContent = ({ contentURL }) =>
|
||||
contentURL && data.url(contentURL).startsWith(assetsURI);
|
||||
|
@ -85,21 +84,3 @@ function WorkerHost (workerFor) {
|
|||
}
|
||||
}
|
||||
exports.WorkerHost = WorkerHost;
|
||||
|
||||
function makeChildOptions(options) {
|
||||
function makeStringArray(arrayOrValue) {
|
||||
if (!arrayOrValue)
|
||||
return [];
|
||||
return [String(v) for (v of [].concat(arrayOrValue))];
|
||||
}
|
||||
|
||||
return {
|
||||
id: String(uuid()),
|
||||
contentScript: makeStringArray(options.contentScript),
|
||||
contentScriptFile: makeStringArray(options.contentScriptFile),
|
||||
contentScriptOptions: options.contentScriptOptions ?
|
||||
JSON.stringify(options.contentScriptOptions) :
|
||||
null,
|
||||
}
|
||||
}
|
||||
exports.makeChildOptions = makeChildOptions;
|
||||
|
|
|
@ -15,9 +15,10 @@ const { getInnerId } = require('../window/utils');
|
|||
const { EventTarget } = require('../event/target');
|
||||
const { isPrivate } = require('../private-browsing/utils');
|
||||
const { getTabForBrowser, getTabForContentWindow, getBrowserForTab } = require('../tabs/utils');
|
||||
const { attach, connect, detach, destroy, makeChildOptions } = require('./utils');
|
||||
const { attach, connect, detach, destroy } = require('./utils');
|
||||
const { ensure } = require('../system/unload');
|
||||
const { on: observe } = require('../system/events');
|
||||
const { uuid } = require('../util/uuid');
|
||||
const { Ci } = require('chrome');
|
||||
const { modelFor: tabFor } = require('sdk/model/core');
|
||||
const { remoteRequire, processes, frames } = require('../remote/parent');
|
||||
|
@ -127,12 +128,26 @@ attach.define(Worker, function(worker, window) {
|
|||
if (tab)
|
||||
frame = frames.getFrameForBrowser(getBrowserForTab(tab));
|
||||
|
||||
let childOptions = makeChildOptions(model.options);
|
||||
childOptions.windowId = getInnerId(window);
|
||||
function makeStringArray(arrayOrValue) {
|
||||
if (!arrayOrValue)
|
||||
return [];
|
||||
return [String(v) for (v of [].concat(arrayOrValue))];
|
||||
}
|
||||
|
||||
let id = String(uuid());
|
||||
let childOptions = {
|
||||
id,
|
||||
windowId: getInnerId(window),
|
||||
contentScript: makeStringArray(model.options.contentScript),
|
||||
contentScriptFile: makeStringArray(model.options.contentScriptFile),
|
||||
contentScriptOptions: model.options.contentScriptOptions ?
|
||||
JSON.stringify(model.options.contentScriptOptions) :
|
||||
null,
|
||||
}
|
||||
|
||||
processes.port.emit('sdk/worker/create', childOptions);
|
||||
|
||||
connect(worker, frame, { id: childOptions.id, url: String(window.location) });
|
||||
connect(worker, frame, { id, url: String(window.location) });
|
||||
})
|
||||
|
||||
connect.define(Worker, function(worker, frame, { id, url }) {
|
||||
|
|
|
@ -191,21 +191,10 @@ const Tab = Class({
|
|||
if (isDestroyed(this))
|
||||
return;
|
||||
|
||||
let { Worker } = require('../content/worker');
|
||||
let { connect, makeChildOptions } = require('../content/utils');
|
||||
|
||||
let frame = frames.getFrameForBrowser(browser(this));
|
||||
let childOptions = makeChildOptions(options);
|
||||
|
||||
frame.port.emit('sdk/tab/attach', childOptions);
|
||||
|
||||
let worker = Worker(options);
|
||||
worker.once("detach", () => {
|
||||
worker.destroy();
|
||||
});
|
||||
connect(worker, frame, { id: childOptions.id, url: this.url });
|
||||
|
||||
return worker;
|
||||
// BUG 792946 https://bugzilla.mozilla.org/show_bug.cgi?id=792946
|
||||
// TODO: fix this circular dependency
|
||||
let { Worker } = require('./worker');
|
||||
return Worker(options, browser(this).contentWindow);
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче