author | Cameron McCormack <cam@mcc.id.au> |
Fri, 02 Dec 2011 12:23:18 +1100 | |
changeset 81149 | c101c5f8c9280076d5f8c2c43751518347938d8a |
parent 81148 | de720961a78db6af0b412da18346eb9151a57863 |
child 81150 | 1c13e42d24fa38bf6743d28b7c57528c4fd7df4c |
child 81193 | 43ea69ba5d7f83ad00ce2d5d490a302d19f1c2fc |
push id | 3753 |
push user | mak77@bonardo.net |
push date | Fri, 02 Dec 2011 11:15:00 +0000 |
treeherder | mozilla-inbound@93c850b9f00f [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 670857, 703176 |
milestone | 11.0a1 |
first release with | nightly linux32
c101c5f8c928
/
11.0a1
/
20111202031055
/
files
nightly linux64
c101c5f8c928
/
11.0a1
/
20111202031055
/
files
nightly mac
c101c5f8c928
/
11.0a1
/
20111202031055
/
files
nightly win32
c101c5f8c928
/
11.0a1
/
20111202031055
/
files
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
releases | nightly linux32
11.0a1
/
20111202031055
/
pushlog to previous
nightly linux64
11.0a1
/
20111202031055
/
pushlog to previous
nightly mac
11.0a1
/
20111202031055
/
pushlog to previous
nightly win32
11.0a1
/
20111202031055
/
pushlog to previous
|
--- a/browser/base/content/test/browser_customize.js +++ b/browser/base/content/test/browser_customize.js @@ -1,12 +1,11 @@ function test() { waitForExplicitFinish(); - ignoreAllUncaughtExceptions(); var frame = document.getElementById("customizeToolbarSheetIFrame"); frame.addEventListener("load", testCustomizeFrameLoadedPre, true); document.getElementById("cmd_CustomizeToolbars").doCommand(); } function testCustomizeFrameLoadedPre(){ // This load listener can be called before
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_pageinfo.js +++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_pageinfo.js @@ -94,10 +94,9 @@ function test() { gBrowser.removeCurrentTab(); gBrowser.removeCurrentTab(); finish(); }); }); waitForExplicitFinish(); - ignoreAllUncaughtExceptions(); }
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placestitle.js +++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placestitle.js @@ -40,17 +40,16 @@ function test() { // initialization let pb = Cc["@mozilla.org/privatebrowsing;1"]. getService(Ci.nsIPrivateBrowsingService); let cm = Cc["@mozilla.org/cookiemanager;1"]. getService(Ci.nsICookieManager); waitForExplicitFinish(); - ignoreAllUncaughtExceptions(); const TEST_URL = "http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/title.sjs"; function waitForCleanup(aCallback) { // delete all cookies cm.removeAll(); // delete all history items waitForClearHistory(aCallback);
--- a/browser/components/sessionstore/test/browser/browser_467409-backslashplosion.js +++ b/browser/components/sessionstore/test/browser/browser_467409-backslashplosion.js @@ -13,17 +13,16 @@ // // 3. [backwards compat] Use a stringified state as formdata when opening about:sessionrestore // 3a. Make sure there are nodes in the tree on about:sessionrestore (skipped, checking formdata is sufficient) // 3b. Check that there are no backslashes in the formdata // 3c. Check that formdata (via getBrowserState) doesn't require JSON.parse function test() { waitForExplicitFinish(); - ignoreAllUncaughtExceptions(); let blankState = { windows: [{ tabs: [{ entries: [{ url: "about:blank" }] }]}]}; let crashState = { windows: [{ tabs: [{ entries: [{ url: "about:mozilla" }] }]}]}; let pagedata = { url: "about:sessionrestore", formdata: { "#sessionData": crashState } }; let state = { windows: [{ tabs: [{ entries: [pagedata] }] }] };
--- a/browser/components/sessionstore/test/browser/browser_586147.js +++ b/browser/components/sessionstore/test/browser/browser_586147.js @@ -39,17 +39,16 @@ function observeOneRestore(callback) { Services.obs.addObserver(function() { Services.obs.removeObserver(arguments.callee, topic, false); callback(); }, topic, false); }; function test() { waitForExplicitFinish(); - ignoreAllUncaughtExceptions(); // There should be one tab when we start the test let [origTab] = gBrowser.visibleTabs; let hiddenTab = gBrowser.addTab(); is(gBrowser.visibleTabs.length, 2, "should have 2 tabs before hiding"); gBrowser.showOnlyTheseTabs([origTab]); is(gBrowser.visibleTabs.length, 1, "only 1 after hiding");
--- a/browser/components/sessionstore/test/browser/browser_607016.js +++ b/browser/components/sessionstore/test/browser/browser_607016.js @@ -47,17 +47,16 @@ function cleanup() { } catch (e) {} ss.setBrowserState(stateBackup); executeSoon(finish); } function test() { /** Bug 607016 - If a tab is never restored, attributes (eg. hidden) aren't updated correctly **/ waitForExplicitFinish(); - ignoreAllUncaughtExceptions(); // Set the pref to true so we know exactly how many tabs should be restoring at // any given time. This guarantees that a finishing load won't start another. Services.prefs.setBoolPref("browser.sessionstore.restore_on_demand", true); // We have our own progress listener for this test, which we'll attach before our state is set let progressListener = { onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
--- a/browser/devtools/highlighter/test/browser_inspector_bug_665880.js +++ b/browser/devtools/highlighter/test/browser_inspector_bug_665880.js @@ -1,16 +1,15 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ function test() { waitForExplicitFinish(); - ignoreAllUncaughtExceptions(); let doc; let objectNode; gBrowser.selectedTab = gBrowser.addTab(); gBrowser.selectedBrowser.addEventListener("load", function() { gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); doc = content.document;
--- a/browser/devtools/highlighter/test/browser_inspector_bug_690361.js +++ b/browser/devtools/highlighter/test/browser_inspector_bug_690361.js @@ -122,17 +122,16 @@ function finishInspectorTests() gBrowser.removeCurrentTab(); finish(); }); } function test() { waitForExplicitFinish(); - ignoreAllUncaughtExceptions(); gBrowser.selectedTab = gBrowser.addTab(); gBrowser.selectedBrowser.addEventListener("load", function() { gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); doc = content.document; waitForFocus(createDocument, content); }, true); content.location = "data:text/html,basic tests for inspector";
--- a/browser/devtools/highlighter/test/browser_inspector_duplicate_ruleview.js +++ b/browser/devtools/highlighter/test/browser_inspector_duplicate_ruleview.js @@ -106,17 +106,16 @@ function inspectorRuleTrap() Services.obs.removeObserver(inspectorRuleTrap, InspectorUI.INSPECTOR_NOTIFICATIONS.RULEVIEWREADY, false); is(InspectorUI.ruleView.doc.documentElement.children.length, 1, "RuleView elements.length == 1"); } function test() { waitForExplicitFinish(); - ignoreAllUncaughtExceptions(); tab1 = gBrowser.addTab(); gBrowser.selectedTab = tab1; gBrowser.selectedBrowser.addEventListener("load", function(evt) { gBrowser.selectedBrowser.removeEventListener(evt.type, arguments.callee, true); waitForFocus(inspectorTabOpen1, content); }, true);
--- a/browser/devtools/highlighter/test/browser_inspector_infobar.js +++ b/browser/devtools/highlighter/test/browser_inspector_infobar.js @@ -1,15 +1,14 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ function test() { waitForExplicitFinish(); - ignoreAllUncaughtExceptions(); let doc; let nodes; let cursor; gBrowser.selectedTab = gBrowser.addTab(); gBrowser.selectedBrowser.addEventListener("load", function onload() { gBrowser.selectedBrowser.removeEventListener("load", onload, true);
--- a/browser/devtools/highlighter/test/browser_inspector_initialization.js +++ b/browser/devtools/highlighter/test/browser_inspector_initialization.js @@ -213,17 +213,16 @@ function finishInspectorTests() gBrowser.removeCurrentTab(); finish(); } function test() { waitForExplicitFinish(); - ignoreAllUncaughtExceptions(); gBrowser.selectedTab = gBrowser.addTab(); gBrowser.selectedBrowser.addEventListener("load", function() { gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); doc = content.document; waitForFocus(createDocument, content); }, true); content.location = "data:text/html,basic tests for inspector";
--- a/browser/devtools/highlighter/test/browser_inspector_registertools.js +++ b/browser/devtools/highlighter/test/browser_inspector_registertools.js @@ -208,17 +208,16 @@ function finishUp() { gBrowser.removeCurrentTab(); InspectorUI.initTools = initToolsMethod; finish(); } function test() { waitForExplicitFinish(); - ignoreAllUncaughtExceptions(); gBrowser.selectedTab = gBrowser.addTab(); gBrowser.selectedBrowser.addEventListener("load", function() { gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); doc = content.document; waitForFocus(createDocument, content); }, true); content.location = "data:text/html,registertool tests for inspector";
--- a/browser/devtools/highlighter/test/browser_inspector_ruleviewstore.js +++ b/browser/devtools/highlighter/test/browser_inspector_ruleviewstore.js @@ -132,17 +132,16 @@ function ruleViewOpened2() gBrowser.removeCurrentTab(); InspectorUI.closeInspectorUI(); finish(); } function test() { waitForExplicitFinish(); - ignoreAllUncaughtExceptions(); tab1 = gBrowser.addTab(); gBrowser.selectedTab = tab1; gBrowser.selectedBrowser.addEventListener("load", function(evt) { gBrowser.selectedBrowser.removeEventListener(evt.type, arguments.callee, true); waitForFocus(inspectorTabOpen1, content); }, true);
--- a/browser/devtools/highlighter/test/browser_inspector_tab_switch.js +++ b/browser/devtools/highlighter/test/browser_inspector_tab_switch.js @@ -258,17 +258,16 @@ function inspectorTabUnload1(evt) InspectorUI.closeInspectorUI(); gBrowser.removeCurrentTab(); finish(); } function test() { waitForExplicitFinish(); - ignoreAllUncaughtExceptions(); tab1 = gBrowser.addTab(); gBrowser.selectedTab = tab1; gBrowser.selectedBrowser.addEventListener("load", function(evt) { gBrowser.selectedBrowser.removeEventListener(evt.type, arguments.callee, true); waitForFocus(inspectorTabOpen1, content); }, true);
--- a/browser/devtools/highlighter/test/browser_inspector_treeSelection.js +++ b/browser/devtools/highlighter/test/browser_inspector_treeSelection.js @@ -100,17 +100,16 @@ function finishUp() { doc = h1 = null; gBrowser.removeCurrentTab(); finish(); } function test() { waitForExplicitFinish(); - ignoreAllUncaughtExceptions(); gBrowser.selectedTab = gBrowser.addTab(); gBrowser.selectedBrowser.addEventListener("load", function() { gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); doc = content.document; waitForFocus(createDocument, content); }, true); content.location = "data:text/html,basic tests for inspector";
--- a/browser/devtools/styleinspector/test/browser/browser_bug683672.js +++ b/browser/devtools/styleinspector/test/browser/browser_bug683672.js @@ -9,17 +9,16 @@ let stylePanel; const TEST_URI = "http://example.com/browser/browser/devtools/styleinspector/test/browser/browser_bug683672.html"; Cu.import("resource:///modules/devtools/CssHtmlTree.jsm"); function test() { waitForExplicitFinish(); - ignoreAllUncaughtExceptions(); addTab(TEST_URI); browser.addEventListener("load", tabLoaded, true); } function tabLoaded() { browser.removeEventListener("load", tabLoaded, true); doc = content.document;
--- a/browser/devtools/styleinspector/test/browser/browser_styleinspector.js +++ b/browser/devtools/styleinspector/test/browser/browser_styleinspector.js @@ -74,17 +74,16 @@ function finishUp() doc = stylePanel = null; gBrowser.removeCurrentTab(); finish(); } function test() { waitForExplicitFinish(); - ignoreAllUncaughtExceptions(); gBrowser.selectedTab = gBrowser.addTab(); gBrowser.selectedBrowser.addEventListener("load", function(evt) { gBrowser.selectedBrowser.removeEventListener(evt.type, arguments.callee, true); doc = content.document; waitForFocus(createDocument, content); }, true); content.location = "data:text/html,basic style inspector tests";
--- a/browser/devtools/webconsole/test/browser/browser_webconsole_bug_580030_errors_after_page_reload.js +++ b/browser/devtools/webconsole/test/browser/browser_webconsole_bug_580030_errors_after_page_reload.js @@ -38,17 +38,16 @@ * * ***** END LICENSE BLOCK ***** */ // Tests that errors still show up in the Web Console after a page reload. const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//browser/test-error.html"; function test() { - expectUncaughtException(); addTab(TEST_URI); browser.addEventListener("load", onLoad, true); } // see bug 580030: the error handler fails silently after page reload. // https://bugzilla.mozilla.org/show_bug.cgi?id=580030 function onLoad(aEvent) { browser.removeEventListener(aEvent.type, arguments.callee, true);
--- a/browser/devtools/webconsole/test/browser/browser_webconsole_bug_582201_duplicate_errors.js +++ b/browser/devtools/webconsole/test/browser/browser_webconsole_bug_582201_duplicate_errors.js @@ -39,31 +39,29 @@ * ***** END LICENSE BLOCK ***** */ // Tests that exceptions thrown by content don't show up twice in the Web // Console. const TEST_DUPLICATE_ERROR_URI = "http://example.com/browser/browser/devtools/webconsole/test//browser/test-duplicate-error.html"; function test() { - expectUncaughtException(); addTab(TEST_DUPLICATE_ERROR_URI); browser.addEventListener("DOMContentLoaded", testDuplicateErrors, false); } function testDuplicateErrors() { browser.removeEventListener("DOMContentLoaded", testDuplicateErrors, false); openConsole(); HUDService.getHudByWindow(content).jsterm.clearOutput(); Services.console.registerListener(consoleObserver); - expectUncaughtException(); content.location.reload(); } var consoleObserver = { QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]), observe: function (aMessage) {
--- a/browser/devtools/webconsole/test/browser/browser_webconsole_bug_597136_external_script_errors.js +++ b/browser/devtools/webconsole/test/browser/browser_webconsole_bug_597136_external_script_errors.js @@ -24,17 +24,16 @@ function tabLoaded(aEvent) { browser.addEventListener("load", contentLoaded, true); content.location.reload(); } function contentLoaded(aEvent) { browser.removeEventListener("load", contentLoaded, true); let button = content.document.querySelector("button"); - expectUncaughtException(); EventUtils.sendMouseEvent({ type: "click" }, button, content); executeSoon(buttonClicked); } function buttonClicked() { let outputNode = HUDService.getHudByWindow(content).outputNode; let msg = "the error from the external script was logged";
--- a/browser/devtools/webconsole/test/browser/browser_webconsole_bug_597756_reopen_closed_tab.js +++ b/browser/devtools/webconsole/test/browser/browser_webconsole_bug_597756_reopen_closed_tab.js @@ -13,17 +13,16 @@ const TEST_URI = "http://example.com/bro let newTabIsOpen = false; function tabLoaded(aEvent) { gBrowser.selectedBrowser.removeEventListener(aEvent.type, arguments.callee, true); HUDService.activateHUDForContext(gBrowser.selectedTab); gBrowser.selectedBrowser.addEventListener("load", tabReloaded, true); - expectUncaughtException(); content.location.reload(); } function tabReloaded(aEvent) { gBrowser.selectedBrowser.removeEventListener(aEvent.type, arguments.callee, true); let hudId = HUDService.getHudIdByWindow(content); let HUD = HUDService.hudReferences[hudId]; @@ -39,24 +38,22 @@ function tabReloaded(aEvent) { } let newTab = gBrowser.addTab(); gBrowser.removeCurrentTab(); gBrowser.selectedTab = newTab; newTabIsOpen = true; gBrowser.selectedBrowser.addEventListener("load", tabLoaded, true); - expectUncaughtException(); content.location = TEST_URI; }); } function testEnd() { gBrowser.removeCurrentTab(); executeSoon(finishTest); } function test() { - expectUncaughtException(); addTab(TEST_URI); browser.addEventListener("load", tabLoaded, true); }
--- a/browser/devtools/webconsole/test/browser/browser_webconsole_bug_601177_log_levels.js +++ b/browser/devtools/webconsole/test/browser/browser_webconsole_bug_601177_log_levels.js @@ -59,13 +59,12 @@ function test() browser.removeEventListener(aEvent.type, arguments.callee, true); openConsole(); browser.addEventListener("load", function(aEvent) { browser.removeEventListener(aEvent.type, arguments.callee, true); executeSoon(onContentLoaded); }, true); - expectUncaughtException(); content.location = TEST_URI; }, true); }
--- a/browser/devtools/webconsole/test/browser/browser_webconsole_bug_618078_network_exceptions.js +++ b/browser/devtools/webconsole/test/browser/browser_webconsole_bug_618078_network_exceptions.js @@ -85,14 +85,13 @@ function test() let hudId = HUDService.getHudIdByWindow(content); hud = HUDService.hudReferences[hudId]; Services.console.registerListener(TestObserver); registerCleanupFunction(testEnd); executeSoon(function() { - expectUncaughtException(); content.location = TEST_URI; }); }, true); }
--- a/browser/devtools/webconsole/test/browser/browser_webconsole_bug_644419_log_limits.js +++ b/browser/devtools/webconsole/test/browser/browser_webconsole_bug_644419_log_limits.js @@ -20,17 +20,16 @@ function test() { function onLoad(aEvent) { browser.removeEventListener(aEvent.type, arguments.callee, true); openConsole(); gHudId = HUDService.getHudIdByWindow(content); browser.addEventListener("load", testWebDevLimits, true); - expectUncaughtException(); content.location = TEST_URI; } function testWebDevLimits(aEvent) { browser.removeEventListener(aEvent.type, arguments.callee, true); gOldPref = Services.prefs.getIntPref("devtools.hud.loglimit.console"); Services.prefs.setIntPref("devtools.hud.loglimit.console", 10); @@ -66,17 +65,16 @@ function testJsLimits(aEvent) { // Find the sentinel entry. findLogEntry("testing JS limits"); // Fill the log with JS errors. let head = content.document.getElementsByTagName("head")[0]; for (let i = 0; i < 11; i++) { var script = content.document.createElement("script"); script.text = "fubar" + i + ".bogus(6);"; - expectUncaughtException(); head.insertBefore(script, head.firstChild); } executeSoon(function() { testLogEntry(outputNode, "fubar0 is not defined", "first message is pruned", false, true); findLogEntry("fubar1 is not defined"); // Check if the sentinel entry is still there. findLogEntry("testing JS limits");
--- a/browser/devtools/webconsole/test/browser/browser_webconsole_network_panel.js +++ b/browser/devtools/webconsole/test/browser/browser_webconsole_network_panel.js @@ -412,20 +412,17 @@ function testGen() { // Test a response with a content type that can't be displayed in the // NetworkPanel. httpActivity.response.header["Content-Type"] = "application/x-shockwave-flash"; networkPanel = HUDService.openNetworkPanel(filterBox, httpActivity); networkPanel.isDoneCallback = function NP_doneCallback() { networkPanel.isDoneCallback = null; - try { - testDriver.next(); - } catch (e if e instanceof StopIteration) { - } + testDriver.next(); } yield; checkIsVisible(networkPanel, { requestBody: false, requestFormData: true, requestCookie: true, @@ -476,10 +473,10 @@ function testGen() { if (networkPanel.document.getElementById("responseBodyUnknownTypeContent").textContent !== "") checkNodeContent(networkPanel, "responseBodyUnknownTypeContent", responseString); else ok(true, "Flash not installed"); networkPanel.panel.hidePopup(); */ // All done! - finish(); + finishTest(); }
--- a/browser/devtools/webconsole/test/browser/browser_webconsole_view_source.js +++ b/browser/devtools/webconsole/test/browser/browser_webconsole_view_source.js @@ -2,17 +2,16 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ // Tests that source URLs in the Web Console can be clicked to display the // standard View Source window. const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//browser/test-error.html"; function test() { - expectUncaughtException(); addTab(TEST_URI); browser.addEventListener("DOMContentLoaded", testViewSource, false); } function testViewSource() { browser.removeEventListener("DOMContentLoaded", testViewSource, false); openConsole();
--- a/image/test/browser/browser_image.js +++ b/image/test/browser/browser_image.js @@ -182,12 +182,11 @@ function nextTest() { if (tests.length == 0) { finish(); return; } tests.shift()(); } function test() { - ignoreAllUncaughtExceptions(); nextTest(); }
--- a/testing/mochitest/browser-test.js +++ b/testing/mochitest/browser-test.js @@ -205,20 +205,16 @@ Tester.prototype = { try { func.apply(testScope); } catch (ex) { this.currentTest.addResult(new testResult(false, "Cleanup function threw an exception", ex, false)); } }; - if (this.SimpleTest.isExpectingUncaughtException()) { - this.currentTest.addResult(new testResult(false, "expectUncaughtException was called but no uncaught exception was detected!", "", false)); - } - // Clear document.popupNode. The test could have set it to a custom value // for its own purposes, nulling it out it will go back to the default // behavior of returning the last opened popup. document.popupNode = null; // Note the test run time let time = Date.now() - this.lastStartTime; this.dumper.dump("INFO TEST-END | " + this.currentTest.path + " | finished in " + time + "ms\n"); @@ -249,28 +245,26 @@ Tester.prototype = { this.currentTestIndex++; this.execTest(); }).bind(this)); }, execTest: function Tester_execTest() { this.dumper.dump("TEST-START | " + this.currentTest.path + "\n"); - this.SimpleTest.reset(); - // Load the tests into a testscope this.currentTest.scope = new testScope(this, this.currentTest); // Import utils in the test scope. this.currentTest.scope.EventUtils = this.EventUtils; this.currentTest.scope.SimpleTest = this.SimpleTest; this.currentTest.scope.gTestPath = this.currentTest.path; // Override SimpleTest methods with ours. - ["ok", "is", "isnot", "todo", "todo_is", "todo_isnot", "info"].forEach(function(m) { + ["ok", "is", "isnot", "todo", "todo_is", "todo_isnot"].forEach(function(m) { this.SimpleTest[m] = this[m]; }, this.currentTest.scope); //load the tools to work with chrome .jar and remote try { this._scriptLoader.loadSubScript("chrome://mochikit/content/chrome-harness.js", this.currentTest.scope); } catch (ex) { /* no chrome-harness tools */ } @@ -297,23 +291,17 @@ Tester.prototype = { this.currentTest.scope.waitForExplicitFinish(); var result = this.currentTest.scope.generatorTest(); this.currentTest.scope.__generator = result; result.next(); } else { this.currentTest.scope.test(); } } catch (ex) { - var isExpected = !!this.SimpleTest.isExpectingUncaughtException(); - if (!this.SimpleTest.isIgnoringAllUncaughtExceptions()) { - this.currentTest.addResult(new testResult(isExpected, "Exception thrown", ex, false)); - this.SimpleTest.expectUncaughtException(false); - } else { - this.currentTest.addResult(new testMessage("Exception thrown: " + ex)); - } + this.currentTest.addResult(new testResult(false, "Exception thrown", ex, false)); this.currentTest.scope.finish(); } // If the test ran synchronously, move to the next test, otherwise the test // will trigger the next test when it is done. if (this.currentTest.scope.__done) { this.nextTest(); } @@ -386,44 +374,45 @@ function testMessage(aName) { this.info = true; this.result = "TEST-INFO"; } // Need to be careful adding properties to this object, since its properties // cannot conflict with global variables used in tests. function testScope(aTester, aTest) { this.__tester = aTester; + this.__browserTest = aTest; var self = this; this.ok = function test_ok(condition, name, diag, stack) { - aTest.addResult(new testResult(condition, name, diag, false, - stack ? stack : Components.stack.caller)); + self.__browserTest.addResult(new testResult(condition, name, diag, false, + stack ? stack : Components.stack.caller)); }; this.is = function test_is(a, b, name) { self.ok(a == b, name, "Got " + a + ", expected " + b, false, Components.stack.caller); }; this.isnot = function test_isnot(a, b, name) { self.ok(a != b, name, "Didn't expect " + a + ", but got it", false, Components.stack.caller); }; this.todo = function test_todo(condition, name, diag, stack) { - aTest.addResult(new testResult(!condition, name, diag, true, - stack ? stack : Components.stack.caller)); + self.__browserTest.addResult(new testResult(!condition, name, diag, true, + stack ? stack : Components.stack.caller)); }; this.todo_is = function test_todo_is(a, b, name) { self.todo(a == b, name, "Got " + a + ", expected " + b, Components.stack.caller); }; this.todo_isnot = function test_todo_isnot(a, b, name) { self.todo(a != b, name, "Didn't expect " + a + ", but got it", Components.stack.caller); }; this.info = function test_info(name) { - aTest.addResult(new testMessage(name)); + self.__browserTest.addResult(new testMessage(name)); }; this.executeSoon = function test_executeSoon(func) { let tm = Cc["@mozilla.org/thread-manager;1"].getService(Ci.nsIThreadManager); tm.mainThread.dispatch({ run: function() { func(); @@ -444,23 +433,17 @@ function testScope(aTester, aTest) { } try { self.__generator.send(arg); } catch (ex if ex instanceof StopIteration) { // StopIteration means test is finished. self.finish(); } catch (ex) { - var isExpected = !!self.SimpleTest.isExpectingUncaughtException(); - if (!self.SimpleTest.isIgnoringAllUncaughtExceptions()) { - aTest.addResult(new testResult(isExpected, "Exception thrown", ex, false)); - self.SimpleTest.expectUncaughtException(false); - } else { - aTest.addResult(new testMessage("Exception thrown: " + ex)); - } + aTest.addResult(new testResult(false, "Exception thrown", ex, false)); self.finish(); } }; this.waitForExplicitFinish = function test_waitForExplicitFinish() { self.__done = false; }; @@ -479,26 +462,29 @@ function testScope(aTester, aTest) { this.requestLongerTimeout = function test_requestLongerTimeout(aFactor) { self.__timeoutFactor = aFactor; }; this.copyToProfile = function test_copyToProfile(filename) { self.SimpleTest.copyToProfile(filename); }; - this.expectUncaughtException = function test_expectUncaughtException(aExpecting) { - self.SimpleTest.expectUncaughtException(aExpecting); + this.expectUncaughtException = function test_expectUncaughtException() { + self.SimpleTest.expectUncaughtException(); }; - this.ignoreAllUncaughtExceptions = function test_ignoreAllUncaughtExceptions(aIgnoring) { - self.SimpleTest.ignoreAllUncaughtExceptions(aIgnoring); + this.ignoreAllUncaughtExceptions = function test_ignoreAllUncaughtExceptions() { + self.SimpleTest.ignoreAllUncaughtExceptions(); }; this.finish = function test_finish() { self.__done = true; + if (self.SimpleTest._expectingUncaughtException) { + self.ok(false, "expectUncaughtException was called but no uncaught exception was detected!"); + } if (self.__waitTimer) { self.executeSoon(function() { if (self.__done && self.__waitTimer) { clearTimeout(self.__waitTimer); self.__waitTimer = null; self.__tester.nextTest(); } });
--- a/testing/mochitest/tests/SimpleTest/SimpleTest.js +++ b/testing/mochitest/tests/SimpleTest/SimpleTest.js @@ -688,53 +688,27 @@ SimpleTest.expectChildProcessCrash = fun parentRunner.expectChildProcessCrash(); } }; /** * Indicates to the test framework that the next uncaught exception during * the test is expected, and should not cause a test failure. */ -SimpleTest.expectUncaughtException = function (aExpecting) { - SimpleTest._expectingUncaughtException = aExpecting === void 0 || !!aExpecting; -}; - -/** - * Returns whether the test has indicated that it expects an uncaught exception - * to occur. - */ -SimpleTest.isExpectingUncaughtException = function () { - return SimpleTest._expectingUncaughtException; +SimpleTest.expectUncaughtException = function () { + SimpleTest._expectingUncaughtException = true; }; /** * Indicates to the test framework that all of the uncaught exceptions * during the test are known problems that should be fixed in the future, * but which should not cause the test to fail currently. */ -SimpleTest.ignoreAllUncaughtExceptions = function (aIgnoring) { - SimpleTest._ignoringAllUncaughtExceptions = aIgnoring === void 0 || !!aIgnoring; -}; - -/** - * Returns whether the test has indicated that all uncaught exceptions should be - * ignored. - */ -SimpleTest.isIgnoringAllUncaughtExceptions = function () { - return SimpleTest._ignoringAllUncaughtExceptions; -}; - -/** - * Resets any state this SimpleTest object has. This is important for - * browser chrome mochitests, which reuse the same SimpleTest object - * across a run. - */ -SimpleTest.reset = function () { - SimpleTest._ignoringAllUncaughtExceptions = false; - SimpleTest._expectingUncaughtException = false; +SimpleTest.ignoreAllUncaughtExceptions = function () { + SimpleTest._ignoringAllUncaughtExceptions = true; }; if (isPrimaryTestWindow) { addLoadEvent(function() { if (SimpleTest._stopOnLoad) { SimpleTest.finish(); } }); @@ -945,31 +919,32 @@ var isnot = SimpleTest.isnot; var todo = SimpleTest.todo; var todo_is = SimpleTest.todo_is; var todo_isnot = SimpleTest.todo_isnot; var isDeeply = SimpleTest.isDeeply; var info = SimpleTest.info; var gOldOnError = window.onerror; window.onerror = function simpletestOnerror(errorMsg, url, lineNumber) { + var funcIdentifier = "[SimpleTest/SimpleTest.js, window.onerror]"; + // Log the message. // XXX Chrome mochitests sometimes trigger this window.onerror handler, // but there are a number of uncaught JS exceptions from those tests. // For now, for tests that self identify as having unintentional uncaught // exceptions, just dump it so that the error is visible but doesn't cause // a test failure. See bug 652494. + var message = "An error occurred: " + errorMsg + " at " + url + ":" + lineNumber; var href = SpecialPowers.getPrivilegedProps(window, 'location.href'); var isExpected = !!SimpleTest._expectingUncaughtException; - var message = "an " + (isExpected ? "" : "un") + "expected uncaught JS exception reported through window.onerror"; - var error = errorMsg + " at " + url + ":" + lineNumber; if (!SimpleTest._ignoringAllUncaughtExceptions) { - SimpleTest.ok(isExpected, message, error); + SimpleTest.ok(isExpected, funcIdentifier, message); SimpleTest._expectingUncaughtException = false; } else { - SimpleTest.todo(false, message + ": " + error); + SimpleTest.todo(false, funcIdentifier, message); } // There is no Components.stack.caller to log. (See bug 511888.) // Call previous handler. if (gOldOnError) { try { // Ignore return value: always run default handler. gOldOnError(errorMsg, url, lineNumber);
--- a/toolkit/components/startup/tests/browser/browser_bug511456.js +++ b/toolkit/components/startup/tests/browser/browser_bug511456.js @@ -83,17 +83,16 @@ var Watcher = { return this; throw Components.results.NS_ERROR_NO_INTERFACE; } } function test() { waitForExplicitFinish(); - ignoreAllUncaughtExceptions(); Services.wm.addListener(Watcher); var win2 = window.openDialog(location, "", "chrome,all,dialog=no", "about:blank"); win2.addEventListener("load", function() { win2.removeEventListener("load", arguments.callee, false); gBrowser.selectedTab = gBrowser.addTab(TEST_URL);
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_badargs.js +++ b/toolkit/mozapps/extensions/test/xpinstall/browser_badargs.js @@ -1,14 +1,13 @@ // ---------------------------------------------------------------------------- // Test whether passing a simple string to InstallTrigger.install throws an // exception function test() { waitForExplicitFinish(); - ignoreAllUncaughtExceptions(); var triggers = encodeURIComponent(JSON.stringify(TESTROOT + "unsigned.xpi")); gBrowser.selectedTab = gBrowser.addTab(); gBrowser.selectedBrowser.addEventListener("load", function() { gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); // Allow the in-page load handler to run first executeSoon(page_loaded); }, true);
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_badargs2.js +++ b/toolkit/mozapps/extensions/test/xpinstall/browser_badargs2.js @@ -1,14 +1,13 @@ // ---------------------------------------------------------------------------- // Test whether passing an undefined url InstallTrigger.install throws an // exception function test() { waitForExplicitFinish(); - ignoreAllUncaughtExceptions(); var triggers = encodeURIComponent(JSON.stringify({ "Unsigned XPI": { URL: undefined } })); gBrowser.selectedTab = gBrowser.addTab(); gBrowser.selectedBrowser.addEventListener("load", function() {
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_cancel.js +++ b/toolkit/mozapps/extensions/test/xpinstall/browser_cancel.js @@ -1,16 +1,15 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ // ---------------------------------------------------------------------------- // Tests that cancelling multiple installs doesn't fail function test() { - ignoreAllUncaughtExceptions(); Harness.installConfirmCallback = confirm_install; Harness.installEndedCallback = install_ended; Harness.installsCompletedCallback = finish_test; Harness.setup(); var pm = Services.perms; pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_enabled3.js +++ b/toolkit/mozapps/extensions/test/xpinstall/browser_enabled3.js @@ -1,12 +1,11 @@ // ---------------------------------------------------------------------------- // Test whether an InstallTrigger.install call fails when xpinstall is disabled function test() { - ignoreAllUncaughtExceptions(); Harness.installDisabledCallback = install_disabled; Harness.installBlockedCallback = allow_blocked; Harness.installConfirmCallback = confirm_install; Harness.setup(); Services.prefs.setBoolPref("xpinstall.enabled", false); var triggers = encodeURIComponent(JSON.stringify({
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_localfile2.js +++ b/toolkit/mozapps/extensions/test/xpinstall/browser_localfile2.js @@ -1,14 +1,13 @@ // ---------------------------------------------------------------------------- // Test whether an install fails if the url is a local file when requested from // web content function test() { waitForExplicitFinish(); - ignoreAllUncaughtExceptions(); var cr = Components.classes["@mozilla.org/chrome/chrome-registry;1"] .getService(Components.interfaces.nsIChromeRegistry); var chromeroot = getChromeRoot(gTestPath); try { var xpipath = cr.convertChromeURL(makeURI(chromeroot + "unsigned.xpi")).spec; } catch (ex) {
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_whitelist3.js +++ b/toolkit/mozapps/extensions/test/xpinstall/browser_whitelist3.js @@ -1,13 +1,12 @@ // ---------------------------------------------------------------------------- // Tests installing an unsigned add-on through a navigation. Should not be // blocked since the referer is whitelisted. function test() { - ignoreAllUncaughtExceptions(); Harness.installConfirmCallback = confirm_install; Harness.installsCompletedCallback = finish_test; Harness.setup(); var pm = Services.perms; pm.add(makeURI("http://example.org/"), "install", pm.ALLOW_ACTION); var triggers = encodeURIComponent(JSON.stringify({