Bug 670857 - Make web console tests expect particular uncaught exceptions. r=msucan
authorCameron McCormack <cam@mcc.id.au>
Thu, 17 Nov 2011 21:33:28 +1100
changeset 82803 90cb5809e7f023a20252da293a9de7e4c39443f1
parent 82802 93c850b9f00f1c76cb973050442e87d91c23f558
child 82804 603c426b981a1ea7eb346e9146fa42443a5bb31e
push id519
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 00:38:35 +0000
treeherdermozilla-beta@788ea1ef610b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmsucan
bugs670857
milestone11.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 670857 - Make web console tests expect particular uncaught exceptions. r=msucan
browser/devtools/webconsole/test/browser/browser_webconsole_bug_580030_errors_after_page_reload.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_582201_duplicate_errors.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_597136_external_script_errors.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_597756_reopen_closed_tab.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_601177_log_levels.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_618078_network_exceptions.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_644419_log_limits.js
browser/devtools/webconsole/test/browser/browser_webconsole_network_panel.js
browser/devtools/webconsole/test/browser/browser_webconsole_view_source.js
--- 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,16 +38,17 @@
  *
  * ***** 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,29 +39,31 @@
  * ***** 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,16 +24,17 @@ 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,16 +13,17 @@ 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];
@@ -38,22 +39,24 @@ 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,12 +59,13 @@ 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,13 +85,14 @@ 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,16 +20,17 @@ 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);
 
@@ -65,16 +66,17 @@ 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,17 +412,20 @@ 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;
-    testDriver.next();
+    try {
+      testDriver.next();
+    } catch (e if e instanceof StopIteration) {
+    }
   }
 
   yield;
 
   checkIsVisible(networkPanel, {
     requestBody: false,
     requestFormData: true,
     requestCookie: true,
@@ -473,10 +476,10 @@ function testGen() {
   if (networkPanel.document.getElementById("responseBodyUnknownTypeContent").textContent !== "")
     checkNodeContent(networkPanel, "responseBodyUnknownTypeContent", responseString);
   else
     ok(true, "Flash not installed");
 
   networkPanel.panel.hidePopup(); */
 
   // All done!
-  finishTest();
+  finish();
 }
--- a/browser/devtools/webconsole/test/browser/browser_webconsole_view_source.js
+++ b/browser/devtools/webconsole/test/browser/browser_webconsole_view_source.js
@@ -2,16 +2,17 @@
  * 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();