Bug 670857 - Make web console tests expect particular uncaught exceptions. r=msucan

This commit is contained in:
Cameron McCormack 2011-11-18 08:19:40 +11:00
parent 1f7224ae7b
commit d46162a5ac
9 changed files with 17 additions and 2 deletions

View File

@ -43,6 +43,7 @@
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//browser/test-error.html"; const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//browser/test-error.html";
function test() { function test() {
expectUncaughtException();
addTab(TEST_URI); addTab(TEST_URI);
browser.addEventListener("load", onLoad, true); browser.addEventListener("load", onLoad, true);
} }

View File

@ -44,6 +44,7 @@
const TEST_DUPLICATE_ERROR_URI = "http://example.com/browser/browser/devtools/webconsole/test//browser/test-duplicate-error.html"; const TEST_DUPLICATE_ERROR_URI = "http://example.com/browser/browser/devtools/webconsole/test//browser/test-duplicate-error.html";
function test() { function test() {
expectUncaughtException();
addTab(TEST_DUPLICATE_ERROR_URI); addTab(TEST_DUPLICATE_ERROR_URI);
browser.addEventListener("DOMContentLoaded", testDuplicateErrors, false); browser.addEventListener("DOMContentLoaded", testDuplicateErrors, false);
} }
@ -57,6 +58,7 @@ function testDuplicateErrors() {
Services.console.registerListener(consoleObserver); Services.console.registerListener(consoleObserver);
expectUncaughtException();
content.location.reload(); content.location.reload();
} }

View File

@ -29,6 +29,7 @@ function contentLoaded(aEvent) {
browser.removeEventListener("load", contentLoaded, true); browser.removeEventListener("load", contentLoaded, true);
let button = content.document.querySelector("button"); let button = content.document.querySelector("button");
expectUncaughtException();
EventUtils.sendMouseEvent({ type: "click" }, button, content); EventUtils.sendMouseEvent({ type: "click" }, button, content);
executeSoon(buttonClicked); executeSoon(buttonClicked);
} }

View File

@ -18,6 +18,7 @@ function tabLoaded(aEvent) {
HUDService.activateHUDForContext(gBrowser.selectedTab); HUDService.activateHUDForContext(gBrowser.selectedTab);
gBrowser.selectedBrowser.addEventListener("load", tabReloaded, true); gBrowser.selectedBrowser.addEventListener("load", tabReloaded, true);
expectUncaughtException();
content.location.reload(); content.location.reload();
} }
@ -43,6 +44,7 @@ function tabReloaded(aEvent) {
newTabIsOpen = true; newTabIsOpen = true;
gBrowser.selectedBrowser.addEventListener("load", tabLoaded, true); gBrowser.selectedBrowser.addEventListener("load", tabLoaded, true);
expectUncaughtException();
content.location = TEST_URI; content.location = TEST_URI;
}); });
} }
@ -53,6 +55,7 @@ function testEnd() {
} }
function test() { function test() {
expectUncaughtException();
addTab(TEST_URI); addTab(TEST_URI);
browser.addEventListener("load", tabLoaded, true); browser.addEventListener("load", tabLoaded, true);
} }

View File

@ -64,6 +64,7 @@ function test()
browser.removeEventListener(aEvent.type, arguments.callee, true); browser.removeEventListener(aEvent.type, arguments.callee, true);
executeSoon(onContentLoaded); executeSoon(onContentLoaded);
}, true); }, true);
expectUncaughtException();
content.location = TEST_URI; content.location = TEST_URI;
}, true); }, true);
} }

View File

@ -90,6 +90,7 @@ function test()
registerCleanupFunction(testEnd); registerCleanupFunction(testEnd);
executeSoon(function() { executeSoon(function() {
expectUncaughtException();
content.location = TEST_URI; content.location = TEST_URI;
}); });
}, true); }, true);

View File

@ -25,6 +25,7 @@ function onLoad(aEvent) {
gHudId = HUDService.getHudIdByWindow(content); gHudId = HUDService.getHudIdByWindow(content);
browser.addEventListener("load", testWebDevLimits, true); browser.addEventListener("load", testWebDevLimits, true);
expectUncaughtException();
content.location = TEST_URI; content.location = TEST_URI;
} }
@ -70,6 +71,7 @@ function testJsLimits(aEvent) {
for (let i = 0; i < 11; i++) { for (let i = 0; i < 11; i++) {
var script = content.document.createElement("script"); var script = content.document.createElement("script");
script.text = "fubar" + i + ".bogus(6);"; script.text = "fubar" + i + ".bogus(6);";
expectUncaughtException();
head.insertBefore(script, head.firstChild); head.insertBefore(script, head.firstChild);
} }

View File

@ -417,7 +417,10 @@ function testGen() {
networkPanel = HUDService.openNetworkPanel(filterBox, httpActivity); networkPanel = HUDService.openNetworkPanel(filterBox, httpActivity);
networkPanel.isDoneCallback = function NP_doneCallback() { networkPanel.isDoneCallback = function NP_doneCallback() {
networkPanel.isDoneCallback = null; networkPanel.isDoneCallback = null;
try {
testDriver.next(); testDriver.next();
} catch (e if e instanceof StopIteration) {
}
} }
yield; yield;
@ -478,5 +481,5 @@ function testGen() {
networkPanel.panel.hidePopup(); */ networkPanel.panel.hidePopup(); */
// All done! // All done!
finishTest(); finish();
} }

View File

@ -7,6 +7,7 @@
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//browser/test-error.html"; const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//browser/test-error.html";
function test() { function test() {
expectUncaughtException();
addTab(TEST_URI); addTab(TEST_URI);
browser.addEventListener("DOMContentLoaded", testViewSource, false); browser.addEventListener("DOMContentLoaded", testViewSource, false);
} }