Backed out changeset a5e245f216b7 on CLOSED TREE (bug 1067325)

This commit is contained in:
J. Ryan Stinnett 2015-05-22 07:01:59 -05:00
parent 52a1330fe8
commit 7d17cca476
6 changed files with 74 additions and 81 deletions

View File

@ -7,7 +7,7 @@
///////////////////
//
// Whitelisting this test.
// As part of bug 1077403, the leaking uncaught rejection should be fixed.
// As part of bug 1077403, the leaking uncaught rejection should be fixed.
//
thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Error: Unknown sheet source");
@ -70,16 +70,16 @@ function* testInlineStyle(view, inspector) {
yield expandComputedViewPropertyByIndex(view, 0);
let onTab = waitForTab();
let onWindow = waitForWindow();
info("Clicking on the first rule-link in the computed-view");
clickLinkByIndex(view, 0);
let tab = yield onTab;
let win = yield onWindow;
let tabURI = tab.linkedBrowser.documentURI.spec;
ok(tabURI.startsWith("view-source:"), "View source tab is open");
info("Closing tab");
gBrowser.removeTab(tab);
let windowType = win.document.documentElement.getAttribute("windowtype");
is(windowType, "navigator:view-source", "View source window is open");
info("Closing window");
win.close();
}
function* testFirstInlineStyleSheet(view, toolbox) {

View File

@ -7,7 +7,7 @@
///////////////////
//
// Whitelisting this test.
// As part of bug 1077403, the leaking uncaught rejection should be fixed.
// As part of bug 1077403, the leaking uncaught rejection should be fixed.
//
thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Error: Unknown sheet source");
@ -70,16 +70,16 @@ add_task(function*() {
function* testInlineStyle(view, inspector) {
info("Testing inline style");
let onTab = waitForTab();
let onWindow = waitForWindow();
info("Clicking on the first link in the rule-view");
clickLinkByIndex(view, 0);
let tab = yield onTab;
let win = yield onWindow;
let tabURI = tab.linkedBrowser.documentURI.spec;
ok(tabURI.startsWith("view-source:"), "View source tab is open");
info("Closing tab");
gBrowser.removeTab(tab);
let windowType = win.document.documentElement.getAttribute("windowtype");
is(windowType, "navigator:view-source", "View source window is open");
info("Closing window");
win.close();
}
function* testFirstInlineStyleSheet(view, toolbox) {

View File

@ -491,21 +491,6 @@ function waitForWindow() {
return def.promise;
}
/**
* Listen for a new tab to open and return a promise that resolves when one
* does and completes the load event.
* @return a promise that resolves to the tab object
*/
let waitForTab = Task.async(function*() {
info("Waiting for a tab to open");
yield once(gBrowser.tabContainer, "TabOpen");
let tab = gBrowser.selectedTab;
let browser = tab.linkedBrowser;
yield once(browser, "load", true);
info("The tab load completed");
return tab;
});
/**
* @see SimpleTest.waitForClipboard
* @param {Function} setup Function to execute before checking for the

View File

@ -10,9 +10,13 @@ let getItemForAttachment;
let Sources;
let getItemInvoked = false;
add_task(function*() {
yield loadTab(TEST_URI);
let hud = yield openConsole(null);
function test() {
loadTab(TEST_URI).then(() => {
openConsole(null).then(testViewSource);
});
}
function testViewSource(hud) {
info("console opened");
let button = content.document.querySelector("button");
@ -21,42 +25,58 @@ add_task(function*() {
expectUncaughtException();
EventUtils.sendMouseEvent({ type: "click" }, button, content);
let { panelWin: { DebuggerView } } = yield openDebugger();
info("debugger opened");
Sources = DebuggerView.Sources;
hud = yield openConsole();
info("console opened again");
openDebugger().then(({panelWin: { DebuggerView }}) => {
info("debugger opened");
Sources = DebuggerView.Sources;
openConsole().then((hud) => {
info("console opened again");
let [result] = yield waitForMessages({
webconsole: hud,
messages: [{
text: "fooBazBaz is not defined",
category: CATEGORY_JS,
severity: SEVERITY_ERROR,
}],
waitForMessages({
webconsole: hud,
messages: [{
text: "fooBazBaz is not defined",
category: CATEGORY_JS,
severity: SEVERITY_ERROR,
}],
}).then(onMessage);
});
});
let msg = [...result.matched][0];
ok(msg, "error message");
let locationNode = msg.querySelector(".message-location");
ok(locationNode, "location node");
function onMessage([result]) {
let msg = [...result.matched][0];
ok(msg, "error message");
let locationNode = msg.querySelector(".message-location");
ok(locationNode, "location node");
let onTabOpen = waitForTab();
Services.ww.registerNotification(observer);
getItemForAttachment = Sources.getItemForAttachment;
Sources.getItemForAttachment = () => {
getItemInvoked = true;
return false;
};
getItemForAttachment = Sources.getItemForAttachment;
Sources.getItemForAttachment = () => {
getItemInvoked = true;
return false;
};
EventUtils.sendMouseEvent({ type: "click" }, locationNode);
EventUtils.sendMouseEvent({ type: "click" }, locationNode);
}
}
let tab = yield onTabOpen;
ok(true, "the view source tab was opened in response to clicking " +
"the location node");
gBrowser.removeTab(tab);
let observer = {
observe: function(aSubject, aTopic, aData) {
if (aTopic != "domwindowopened") {
return;
}
ok(getItemInvoked, "custom getItemForAttachment() was invoked");
Sources.getItemForAttachment = getItemForAttachment;
Sources = getItemForAttachment = null;
ok(true, "the view source window was opened in response to clicking " +
"the location node");
aSubject.close();
ok(getItemInvoked, "custom getItemForAttachment() was invoked");
Sources.getItemForAttachment = getItemForAttachment;
Sources = getItemForAttachment = null;
finishTest();
}
};
registerCleanupFunction(function() {
Services.ww.unregisterNotification(observer);
});

View File

@ -255,21 +255,6 @@ function waitForContextMenu(aPopup, aButton, aOnShown, aOnHidden)
return deferred.promise;
}
/**
* Listen for a new tab to open and return a promise that resolves when one
* does and completes the load event.
* @return a promise that resolves to the tab object
*/
let waitForTab = Task.async(function*() {
info("Waiting for a tab to open");
yield once(gBrowser.tabContainer, "TabOpen");
let tab = gBrowser.selectedTab;
let browser = tab.linkedBrowser;
yield once(browser, "load", true);
info("The tab load completed");
return tab;
});
/**
* Dump the output of all open Web Consoles - used only for debugging purposes.
*/

View File

@ -978,6 +978,7 @@ TabActor.prototype = {
});
this._extraActors = null;
this._styleSheetActors.clear();
this._exited = true;
},
@ -1324,10 +1325,6 @@ TabActor.prototype = {
this._popContext();
// Shut down actors that belong to this tab's pool.
for (let sheetActor of this._styleSheetActors.values()) {
this._tabPool.removeActor(sheetActor);
}
this._styleSheetActors.clear();
this.conn.removeActorPool(this._tabPool);
this._tabPool = null;
if (this._tabActorPool) {
@ -1645,6 +1642,12 @@ TabActor.prototype = {
threadActor.global = window;
}
for (let sheetActor of this._styleSheetActors.values()) {
this._tabPool.removeActor(sheetActor);
}
this._styleSheetActors.clear();
// Refresh the debuggee list when a new window object appears (top window or
// iframe).
if (threadActor.attached) {