Backed out changeset 4f1e44bd6204 (bug 1059308)

This commit is contained in:
Carsten "Tomcat" Book 2015-03-03 16:28:14 +01:00
parent e0edb34391
commit 30a838c80b
10 changed files with 33 additions and 46 deletions

View File

@ -206,9 +206,7 @@ let DebuggerController = {
if (target.isAddon) {
yield this._startAddonDebugging(actor);
} else if (!target.isTabActor) {
// Some actors like AddonActor or RootActor for chrome debugging
// do not support attach/detach and can be used directly
} else if (target.chrome) {
yield this._startChromeDebugging(chromeDebugger);
} else {
yield this._startDebuggingTab();

View File

@ -581,8 +581,7 @@ AddonDebugger.prototype = {
let targetOptions = {
form: addonActor,
client: this.client,
chrome: true,
isTabActor: false
chrome: true
};
let toolboxOptions = {

View File

@ -162,7 +162,7 @@ let onConnectionReady = Task.async(function*(aType, aTraits) {
function buildAddonLink(addon, parent) {
let a = document.createElement("a");
a.onclick = function() {
openToolbox(addon, true, "jsdebugger", false);
openToolbox(addon, true, "jsdebugger");
}
a.textContent = addon.name;
@ -221,12 +221,11 @@ function handleConnectionTimeout() {
* The user clicked on one of the buttons.
* Opens the toolbox.
*/
function openToolbox(form, chrome=false, tool="webconsole", isTabActor) {
function openToolbox(form, chrome=false, tool="webconsole") {
let options = {
form: form,
client: gClient,
chrome: chrome,
isTabActor: isTabActor
chrome: chrome
};
devtools.TargetFactory.forRemoteTab(options).then((target) => {
let hostType = devtools.Toolbox.HostType.WINDOW;
@ -234,7 +233,7 @@ function openToolbox(form, chrome=false, tool="webconsole", isTabActor) {
toolbox.once("destroyed", function() {
gClient.close();
});
}, console.error.bind(console));
});
window.close();
}, console.error.bind(console));
});
}

View File

@ -718,8 +718,7 @@ let gDevToolsBrowser = {
let options = {
form: response.form,
client: client,
chrome: true,
isTabActor: false
chrome: true
};
return devtools.TargetFactory.forRemoteTab(options);
})

View File

@ -175,8 +175,6 @@ function TabTarget(tab) {
this._client = tab.client;
this._chrome = tab.chrome;
}
// Default isTabActor to true if not explicitely specified
this._isTabActor = typeof(tab.isTabActor) == "boolean" ? tab.isTabActor : true;
}
TabTarget.prototype = {
@ -317,21 +315,10 @@ TabTarget.prototype = {
return this._client;
},
// Tells us if we are debugging content document
// or if we are debugging chrome stuff.
// Allows to controls which features are available against
// a chrome or a content document.
get chrome() {
return this._chrome;
},
// Tells us if the related actor implements TabActor interface
// and requires to call `attach` request before being used
// and `detach` during cleanup
get isTabActor() {
return this._isTabActor;
},
get window() {
// XXX - this is a footgun for e10s - there .contentWindow will be null,
// and even though .contentWindowAsCPOW *might* work, it will not work
@ -449,13 +436,12 @@ TabTarget.prototype = {
attachTab();
});
});
} else if (this.isTabActor) {
} else if (!this.chrome) {
// In the remote debugging case, the protocol connection will have been
// already initialized in the connection screen code.
attachTab();
} else {
// AddonActor and chrome debugging on RootActor doesn't inherits from TabActor and
// doesn't need to be attached.
// Remote chrome debugging doesn't need anything at this point.
this._remote.resolve(null);
}

View File

@ -38,7 +38,7 @@ let connect = Task.async(function*() {
if (addonID) {
gClient.listAddons(({addons}) => {
let addonActor = addons.filter(addon => addon.id === addonID).pop();
openToolbox({ form: addonActor, chrome: true, isTabActor: false });
openToolbox(addonActor);
});
} else {
gClient.listTabs(openToolbox);
@ -65,12 +65,11 @@ function onCloseCommand(event) {
window.close();
}
function openToolbox({ form, chrome, isTabActor }) {
function openToolbox(form) {
let options = {
form: form,
client: gClient,
chrome: chrome,
isTabActor: isTabActor
chrome: true
};
devtools.TargetFactory.forRemoteTab(options).then(target => {
let frame = document.getElementById("toolbox-iframe");

View File

@ -211,9 +211,7 @@ let NetMonitorController = {
let target = this._target;
let { client, form } = target;
// Some actors like AddonActor or RootActor for chrome debugging
// do not support attach/detach and can be used directly
if (!target.isTabActor) {
if (target.chrome) {
this._startChromeMonitoring(client, form.consoleActor, deferred.resolve);
} else {
this._startMonitoringTab(client, form, deferred.resolve);

View File

@ -121,9 +121,14 @@ PerformanceActorsConnection.prototype = {
* Initializes a connection to the profiler actor.
*/
_connectProfilerActor: Task.async(function*() {
// Chrome and content process targets already have obtained a reference
// to the profiler tab actor. Use it immediately.
if (this._target.form && this._target.form.profilerActor) {
// Chrome debugging targets have already obtained a reference
// to the profiler actor.
if (this._target.chrome) {
this._profiler = this._target.form.profilerActor;
}
// When we are debugging content processes, we already have the tab
// specific one. Use it immediately.
else if (this._target.form && this._target.form.profilerActor) {
this._profiler = this._target.form.profilerActor;
}
// Check if we already have a grip to the `listTabs` response object

View File

@ -83,9 +83,14 @@ ProfilerConnection.prototype = {
// Local debugging needs to make the target remote.
yield this._target.makeRemote();
// Chrome and content process targets already have obtained a reference
// to the profiler tab actor. Use it immediately.
if (this._target.form && this._target.form.profilerActor) {
// Chrome debugging targets have already obtained a reference
// to the profiler actor.
if (this._target.chrome) {
this._profiler = this._target.form.profilerActor;
}
// Or when we are debugging content processes, we already have the tab
// specific one. Use it immediately.
else if (this._target.form && this._target.form.profilerActor) {
this._profiler = this._target.form.profilerActor;
yield this._registerEventNotifications();
}
@ -95,9 +100,8 @@ ProfilerConnection.prototype = {
this._profiler = this._target.root.profilerActor;
yield this._registerEventNotifications();
}
// Otherwise, call `listTabs`, but ensure not trying to fetch tab actors
// for AddonTarget that are chrome, but do not expose profile at all.
else if (!this._target.chrome) {
// Otherwise, call `listTabs`.
else {
this._profiler = (yield listTabs(this._client)).profilerActor;
yield this._registerEventNotifications();
}

View File

@ -5095,7 +5095,7 @@ WebConsoleConnectionProxy.prototype = {
this.target.on("navigate", this._onTabNavigated);
this._consoleActor = this.target.form.consoleActor;
if (this.target.isTabActor) {
if (!this.target.chrome) {
let tab = this.target.form;
this.owner.onLocationChange(tab.url, tab.title);
}