mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1067325 - DevTools test fixes for view source in tab. r=pbrosset
This commit is contained in:
parent
f4f438183c
commit
00d4284aa2
@ -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 onWindow = waitForWindow();
|
||||
let onTab = waitForTab();
|
||||
info("Clicking on the first rule-link in the computed-view");
|
||||
clickLinkByIndex(view, 0);
|
||||
|
||||
let win = yield onWindow;
|
||||
let tab = yield onTab;
|
||||
|
||||
let windowType = win.document.documentElement.getAttribute("windowtype");
|
||||
is(windowType, "navigator:view-source", "View source window is open");
|
||||
info("Closing window");
|
||||
win.close();
|
||||
let tabURI = tab.linkedBrowser.documentURI.spec;
|
||||
ok(tabURI.startsWith("view-source:"), "View source tab is open");
|
||||
info("Closing tab");
|
||||
gBrowser.removeTab(tab);
|
||||
}
|
||||
|
||||
function* testFirstInlineStyleSheet(view, toolbox) {
|
||||
|
@ -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 onWindow = waitForWindow();
|
||||
let onTab = waitForTab();
|
||||
info("Clicking on the first link in the rule-view");
|
||||
clickLinkByIndex(view, 0);
|
||||
|
||||
let win = yield onWindow;
|
||||
let tab = yield onTab;
|
||||
|
||||
let windowType = win.document.documentElement.getAttribute("windowtype");
|
||||
is(windowType, "navigator:view-source", "View source window is open");
|
||||
info("Closing window");
|
||||
win.close();
|
||||
let tabURI = tab.linkedBrowser.documentURI.spec;
|
||||
ok(tabURI.startsWith("view-source:"), "View source tab is open");
|
||||
info("Closing tab");
|
||||
gBrowser.removeTab(tab);
|
||||
}
|
||||
|
||||
function* testFirstInlineStyleSheet(view, toolbox) {
|
||||
|
@ -491,6 +491,21 @@ 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
|
||||
|
@ -10,13 +10,9 @@ let getItemForAttachment;
|
||||
let Sources;
|
||||
let getItemInvoked = false;
|
||||
|
||||
function test() {
|
||||
loadTab(TEST_URI).then(() => {
|
||||
openConsole(null).then(testViewSource);
|
||||
});
|
||||
}
|
||||
|
||||
function testViewSource(hud) {
|
||||
add_task(function*() {
|
||||
yield loadTab(TEST_URI);
|
||||
let hud = yield openConsole(null);
|
||||
info("console opened");
|
||||
|
||||
let button = content.document.querySelector("button");
|
||||
@ -25,58 +21,42 @@ function testViewSource(hud) {
|
||||
expectUncaughtException();
|
||||
EventUtils.sendMouseEvent({ type: "click" }, button, content);
|
||||
|
||||
openDebugger().then(({panelWin: { DebuggerView }}) => {
|
||||
info("debugger opened");
|
||||
Sources = DebuggerView.Sources;
|
||||
openConsole().then((hud) => {
|
||||
info("console opened again");
|
||||
let { panelWin: { DebuggerView } } = yield openDebugger();
|
||||
info("debugger opened");
|
||||
Sources = DebuggerView.Sources;
|
||||
hud = yield openConsole();
|
||||
info("console opened again");
|
||||
|
||||
waitForMessages({
|
||||
webconsole: hud,
|
||||
messages: [{
|
||||
text: "fooBazBaz is not defined",
|
||||
category: CATEGORY_JS,
|
||||
severity: SEVERITY_ERROR,
|
||||
}],
|
||||
}).then(onMessage);
|
||||
});
|
||||
let [result] = yield waitForMessages({
|
||||
webconsole: hud,
|
||||
messages: [{
|
||||
text: "fooBazBaz is not defined",
|
||||
category: CATEGORY_JS,
|
||||
severity: SEVERITY_ERROR,
|
||||
}],
|
||||
});
|
||||
|
||||
function onMessage([result]) {
|
||||
let msg = [...result.matched][0];
|
||||
ok(msg, "error message");
|
||||
let locationNode = msg.querySelector(".message-location");
|
||||
ok(locationNode, "location node");
|
||||
let msg = [...result.matched][0];
|
||||
ok(msg, "error message");
|
||||
let locationNode = msg.querySelector(".message-location");
|
||||
ok(locationNode, "location node");
|
||||
|
||||
Services.ww.registerNotification(observer);
|
||||
let onTabOpen = waitForTab();
|
||||
|
||||
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 observer = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
if (aTopic != "domwindowopened") {
|
||||
return;
|
||||
}
|
||||
let tab = yield onTabOpen;
|
||||
ok(true, "the view source tab was opened in response to clicking " +
|
||||
"the location node");
|
||||
gBrowser.removeTab(tab);
|
||||
|
||||
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);
|
||||
ok(getItemInvoked, "custom getItemForAttachment() was invoked");
|
||||
Sources.getItemForAttachment = getItemForAttachment;
|
||||
Sources = getItemForAttachment = null;
|
||||
});
|
||||
|
@ -255,6 +255,21 @@ 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.
|
||||
*/
|
||||
|
@ -978,7 +978,6 @@ TabActor.prototype = {
|
||||
});
|
||||
|
||||
this._extraActors = null;
|
||||
this._styleSheetActors.clear();
|
||||
|
||||
this._exited = true;
|
||||
},
|
||||
@ -1325,6 +1324,10 @@ 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) {
|
||||
@ -1642,12 +1645,6 @@ 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) {
|
||||
|
Loading…
Reference in New Issue
Block a user