Bug 911258: Part 6 - Fixup tests. r=me
authorKyle Huey <khuey@kylehuey.com>
Sun, 08 Sep 2013 20:30:10 -0700
changeset 146114 9846f07d5867f66d282c790d9f5adc8bce622424
parent 146113 4127ebc547fdf569b326ab0fdb0e7fca94086fc2
child 146121 5b97d9cfe8900634acfcd4448237ecf9b7b87e61
child 146164 830a850a6af6476b15c2d69eaf2f614acbaed9f6
push id25240
push useremorley@mozilla.com
push dateMon, 09 Sep 2013 12:09:06 +0000
treeherdermozilla-central@9846f07d5867 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs911258
milestone26.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 911258: Part 6 - Fixup tests. r=me
dom/tests/mochitest/bugs/test_bug291377.html
embedding/test/test_nsFind.html
layout/inspector/tests/test_bug462787.html
layout/inspector/tests/test_bug462789.html
--- a/dom/tests/mochitest/bugs/test_bug291377.html
+++ b/dom/tests/mochitest/bugs/test_bug291377.html
@@ -15,26 +15,26 @@ https://bugzilla.mozilla.org/show_bug.cg
   
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 /** Test for Bug 291377 **/
 /* Do something that causes an XPConnect exception */
 var threw = true;
 try {
-  SpecialPowers.Cc["@mozilla.org/network/io-service;1"].getService(SpecialPowers.Ci.nsIIOService).newURI();  /* Not enough arguments */
+  window.location.port = -2;
   threw = false;
 } catch (e) {
   /* Check that we can touch various properties */
   isnot(e.lineNumber, undefined, "Unexpected line number"); //This line number is dependent on the implementation of the SpecialPowers API
-  is(e.name, "NS_ERROR_XPC_NOT_ENOUGH_ARGS", "Unexpected exception name");
+  is(e.name, "NS_ERROR_MALFORMED_URI", "Unexpected exception name");
   isnot(e.message, "", "Should have a message");
   isnot(e.result, 0, "Should have a result");
   
-  is(e.result, SpecialPowers.Cr.NS_ERROR_XPC_NOT_ENOUGH_ARGS);
+  is(e.result, SpecialPowers.Cr.NS_ERROR_MALFORMED_URI);
 }
 
 is(threw, true, "Not enough arguments to a call should throw");
 </script>
 </pre>
 </body>
 </html>
 
--- a/embedding/test/test_nsFind.html
+++ b/embedding/test/test_nsFind.html
@@ -31,49 +31,65 @@ https://bugzilla.mozilla.org/show_bug.cg
   var startPt = searchRange;
   var endPt = searchRange;
 
   // Check |null| detection on |aPatText| parameter.
   try {
     rf.Find(null, searchRange, startPt, endPt);
 
     ok(false, "Missing NS_ERROR_NULL_POINTER exception");
-  } catch (e if (e instanceof SpecialPowers.Ci.nsIException &&
-                 e.result == SpecialPowers.Cr.NS_ERROR_NULL_POINTER)) {
-    ok(true, null);
+  } catch (e) {
+    e = SpecialPowers.wrap(e);
+    if (e.result == SpecialPowers.Cr.NS_ERROR_NULL_POINTER) {
+      ok(true, null);
+    } else {
+      throw e;
+    }
   }
 
   // Check |null| detection on |aSearchRange| parameter.
   try {
     rf.Find("", null, startPt, endPt);
 
     ok(false, "Missing NS_ERROR_ILLEGAL_VALUE exception");
-  } catch (e if (e instanceof SpecialPowers.Ci.nsIException &&
-                 e.result == SpecialPowers.Cr.NS_ERROR_ILLEGAL_VALUE)) {
-    ok(true, null);
+  } catch (e) {
+    e = SpecialPowers.wrap(e);
+    if (e.result == SpecialPowers.Cr.NS_ERROR_ILLEGAL_VALUE) {
+      ok(true, null);
+    } else {
+      throw e;
+    }
   }
 
   // Check |null| detection on |aStartPoint| parameter.
   try {
     rf.Find("", searchRange, null, endPt);
 
     ok(false, "Missing NS_ERROR_ILLEGAL_VALUE exception");
-  } catch (e if (e instanceof SpecialPowers.Ci.nsIException &&
-                 e.result == SpecialPowers.Cr.NS_ERROR_ILLEGAL_VALUE)) {
-    ok(true, null);
+  } catch (e) {
+    e = SpecialPowers.wrap(e);
+    if (e.result == SpecialPowers.Cr.NS_ERROR_ILLEGAL_VALUE) {
+      ok(true, null);
+    } else {
+      throw e;
+    }
   }
 
   // Check |null| detection on |aEndPoint| parameter.
   try {
     rf.Find("", searchRange, startPt, null);
 
     ok(false, "Missing NS_ERROR_ILLEGAL_VALUE exception");
-  } catch (e if (e instanceof SpecialPowers.Ci.nsIException &&
-                 e.result == SpecialPowers.Cr.NS_ERROR_ILLEGAL_VALUE)) {
-    ok(true, null);
+  } catch (e) {
+    e = SpecialPowers.wrap(e);
+    if (e.result == SpecialPowers.Cr.NS_ERROR_ILLEGAL_VALUE) {
+      ok(true, null);
+    } else {
+      throw e;
+    }
   }
 
   var searchValue, retRange;
 
   rf.findBackwards = false;
 
   rf.caseSensitive = false;
 
--- a/layout/inspector/tests/test_bug462787.html
+++ b/layout/inspector/tests/test_bug462787.html
@@ -23,53 +23,74 @@ function do_test() {
   const INVALID_POINTER = 0x80004003;
 
   var utils = SpecialPowers.Cc["@mozilla.org/inspector/dom-utils;1"]
                              .getService(SpecialPowers.Ci.inIDOMUtils);
   try {
     utils.getCSSStyleRules(null); 
     ok(false, "expected an exception"); 
   }
-  catch(e) { is(e.result, INVALID_POINTER, "got the expected exception"); }
+  catch(e) {
+    e = SpecialPowers.wrap(e);
+    is(e.result, INVALID_POINTER, "got the expected exception");
+  }
 
   try {
     utils.getRuleLine(null); 
     ok(false, "expected an exception"); 
   }
-  catch(e) { is(e.result, INVALID_POINTER, "got the expected exception"); }
+  catch(e) {
+    e = SpecialPowers.wrap(e);
+    is(e.result, INVALID_POINTER, "got the expected exception");
+  }
 
   try {
     utils.isIgnorableWhitespace(null);
     ok(false, "expected an exception");
   }
-  catch(e) { is(e.result, INVALID_POINTER, "got the expected exception"); }
+  catch(e) {
+    e = SpecialPowers.wrap(e);
+    is(e.result, INVALID_POINTER, "got the expected exception");
+  }
 
   try {
     utils.getParentForNode(null, true); 
     ok(false, "expected an exception");
   }
-  catch(e) { is(e.result, INVALID_POINTER, "got the expected exception"); }
+  catch(e) {
+    e = SpecialPowers.wrap(e);
+    is(e.result, INVALID_POINTER, "got the expected exception");
+  }
 
   try {
     utils.getBindingURLs(null); 
     ok(false, "expected an exception"); 
   }
-  catch(e) { is(e.result, INVALID_POINTER, "got the expected exception"); }
+  catch(e) {
+    e = SpecialPowers.wrap(e);
+    is(e.result, INVALID_POINTER, "got the expected exception");
+  }
 
   try {
     utils.getContentState(null); 
     ok(false, "expected an exception"); 
   }
-  catch(e) { is(e.result, INVALID_POINTER, "got the expected exception"); }
+  catch(e) {
+    e = SpecialPowers.wrap(e);
+    is(e.result, INVALID_POINTER, "got the expected exception");
+  }
 
   try {
     utils.setContentState(null, false); 
     ok(false, "expected an exception"); 
   }
-  catch(e) { is(e.result, INVALID_POINTER, "got the expected exception"); }
+  catch(e) {
+    e = SpecialPowers.wrap(e);
+    is(e.result, INVALID_POINTER, "got the expected exception");
+  }
 
   SimpleTest.finish();
 }
 
 SimpleTest.waitForExplicitFinish();
 addLoadEvent(do_test);
 
 
--- a/layout/inspector/tests/test_bug462789.html
+++ b/layout/inspector/tests/test_bug462789.html
@@ -72,17 +72,20 @@ function do_test() {
     ok(true, "Should not throw"); 
   }
   catch(e) { ok(false, "Got an exception: " + e); }
 
   try {
     utils.setContentState(docElement, false);
     ok(false, "expected an exception"); 
   }
-  catch(e) { is(e.result, ERROR_FAILURE, "got the expected exception"); }
+  catch(e) {
+    e = SpecialPowers.wrap(e);
+    is(e.result, ERROR_FAILURE, "got the expected exception");
+  }
 
   SimpleTest.finish();
 }
 
 SimpleTest.waitForExplicitFinish();
 addLoadEvent(do_test);
 
 </script>