Backed out changeset 1ba1259d55e5 (bug 1146603) for browser_dbg_event-listeners-04.js failures.

This commit is contained in:
Ryan VanderMeulen 2015-08-28 20:58:40 -04:00
Родитель 527747d5e6
Коммит 2a29040698
4 изменённых файлов: 23 добавлений и 44 удалений

Просмотреть файл

@ -5,7 +5,6 @@
const system = require('sdk/system/events'); const system = require('sdk/system/events');
const { frames } = require('sdk/remote/child'); const { frames } = require('sdk/remote/child');
const { WorkerChild } = require('sdk/content/worker-child');
// map observer topics to tab event names // map observer topics to tab event names
const EVENTS = { const EVENTS = {
@ -35,8 +34,3 @@ function eventListener({target, type, persisted}) {
frame.port.emit('sdk/tab/event', type, persisted); frame.port.emit('sdk/tab/event', type, persisted);
} }
frames.addEventListener('pageshow', eventListener, true); 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 assetsURI = data.url();
let isArray = Array.isArray; let isArray = Array.isArray;
let method = require('../../method/core'); let method = require('../../method/core');
let { uuid } = require('../util/uuid');
const isAddonContent = ({ contentURL }) => const isAddonContent = ({ contentURL }) =>
contentURL && data.url(contentURL).startsWith(assetsURI); contentURL && data.url(contentURL).startsWith(assetsURI);
@ -85,21 +84,3 @@ function WorkerHost (workerFor) {
} }
} }
exports.WorkerHost = WorkerHost; 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 { EventTarget } = require('../event/target');
const { isPrivate } = require('../private-browsing/utils'); const { isPrivate } = require('../private-browsing/utils');
const { getTabForBrowser, getTabForContentWindow, getBrowserForTab } = require('../tabs/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 { ensure } = require('../system/unload');
const { on: observe } = require('../system/events'); const { on: observe } = require('../system/events');
const { uuid } = require('../util/uuid');
const { Ci } = require('chrome'); const { Ci } = require('chrome');
const { modelFor: tabFor } = require('sdk/model/core'); const { modelFor: tabFor } = require('sdk/model/core');
const { remoteRequire, processes, frames } = require('../remote/parent'); const { remoteRequire, processes, frames } = require('../remote/parent');
@ -127,12 +128,26 @@ attach.define(Worker, function(worker, window) {
if (tab) if (tab)
frame = frames.getFrameForBrowser(getBrowserForTab(tab)); frame = frames.getFrameForBrowser(getBrowserForTab(tab));
let childOptions = makeChildOptions(model.options); function makeStringArray(arrayOrValue) {
childOptions.windowId = getInnerId(window); 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); 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 }) { connect.define(Worker, function(worker, frame, { id, url }) {

Просмотреть файл

@ -191,21 +191,10 @@ const Tab = Class({
if (isDestroyed(this)) if (isDestroyed(this))
return; return;
let { Worker } = require('../content/worker'); // BUG 792946 https://bugzilla.mozilla.org/show_bug.cgi?id=792946
let { connect, makeChildOptions } = require('../content/utils'); // TODO: fix this circular dependency
let { Worker } = require('./worker');
let frame = frames.getFrameForBrowser(browser(this)); return Worker(options, browser(this).contentWindow);
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;
}, },
destroy: function() { destroy: function() {