зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 75d0e51772db (bug 1211665) because it wasn't supposed to land
MozReview-Commit-ID: AJlDqbYWN2b
This commit is contained in:
Родитель
3fd9c37a6a
Коммит
c728792374
|
@ -316,7 +316,7 @@ update(AddonConsoleActor.prototype, {
|
||||||
case "ConsoleAPI":
|
case "ConsoleAPI":
|
||||||
if (!this.consoleAPIListener) {
|
if (!this.consoleAPIListener) {
|
||||||
this.consoleAPIListener =
|
this.consoleAPIListener =
|
||||||
new ConsoleAPIListener(null, this, { addonId: this.addon.id });
|
new ConsoleAPIListener(null, this, "addon/" + this.addon.id);
|
||||||
this.consoleAPIListener.init();
|
this.consoleAPIListener.init();
|
||||||
}
|
}
|
||||||
startedListeners.push(listener);
|
startedListeners.push(listener);
|
||||||
|
|
|
@ -67,7 +67,7 @@ function run_test() {
|
||||||
|
|
||||||
listener.destroy();
|
listener.destroy();
|
||||||
|
|
||||||
listener = new ConsoleAPIListener(null, callback, {consoleID: "foo"});
|
listener = new ConsoleAPIListener(null, callback, "foo");
|
||||||
listener.init();
|
listener.init();
|
||||||
messages = listener.getCachedMessages();
|
messages = listener.getCachedMessages();
|
||||||
|
|
||||||
|
|
|
@ -794,14 +794,12 @@ ConsoleServiceListener.prototype =
|
||||||
* - onConsoleAPICall(). This method is invoked with one argument, the
|
* - onConsoleAPICall(). This method is invoked with one argument, the
|
||||||
* Console API message that comes from the observer service, whenever
|
* Console API message that comes from the observer service, whenever
|
||||||
* a relevant console API call is received.
|
* a relevant console API call is received.
|
||||||
* @param object filteringOptions
|
* @param string consoleID
|
||||||
* Options - The filteringOptions that this listener should listen to
|
* Options - The consoleID that this listener should listen to
|
||||||
(e.g. { addonId: "..." } or { consoleID: "..." }).
|
|
||||||
*/
|
*/
|
||||||
function ConsoleAPIListener(window, owner, {addonId, consoleID} = {}) {
|
function ConsoleAPIListener(window, owner, consoleID) {
|
||||||
this.window = window;
|
this.window = window;
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
this.addonId = addonId;
|
|
||||||
this.consoleID = consoleID;
|
this.consoleID = consoleID;
|
||||||
}
|
}
|
||||||
exports.ConsoleAPIListener = ConsoleAPIListener;
|
exports.ConsoleAPIListener = ConsoleAPIListener;
|
||||||
|
@ -827,10 +825,10 @@ ConsoleAPIListener.prototype =
|
||||||
owner: null,
|
owner: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The addonId that we listen for. If not null then only messages from this
|
* The consoleID that we listen for. If not null then only messages from this
|
||||||
* console will be returned.
|
* console will be returned.
|
||||||
*/
|
*/
|
||||||
addonId: null,
|
consoleID: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the window.console API observer.
|
* Initialize the window.console API observer.
|
||||||
|
@ -898,31 +896,8 @@ ConsoleAPIListener.prototype =
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.consoleID) {
|
if (this.consoleID && message.consoleID !== this.consoleID) {
|
||||||
// Filtering based on the old-style consoleID property used by
|
return false;
|
||||||
// the legacy Console JSM module.
|
|
||||||
if (message.consoleID !== this.consoleID) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.addonId) {
|
|
||||||
if (!message.consoleID && !message.originAttributes) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Filtering based on the old-style consoleID property used by
|
|
||||||
// the legacy Console JSM module.
|
|
||||||
if (message.consoleID && message.consoleID !== `addon/${this.addonId}`) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Filtering based on the originAttributes used by
|
|
||||||
// the Console API object.
|
|
||||||
if (message.originAttributes &&
|
|
||||||
message.originAttributes.addonId !== this.addonId) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче