Bug 1406763 - Fix broken Assert.throws() calls for error class. draft
authorHenrik Skupin <mail@hskupin.info>
Thu, 12 Oct 2017 17:56:31 +0200
changeset 679485 eec8257cff22e58f5959a1d2610adc423375cecb
parent 679484 be470af9e6ccd804781ddb585ce8e3100b5639f6
child 735614 4849d8e9d8061f053cc18fe9590ef13cc15b0cce
push id84238
push userbmo:hskupin@gmail.com
push dateThu, 12 Oct 2017 19:01:10 +0000
bugs1406763
milestone58.0a1
Bug 1406763 - Fix broken Assert.throws() calls for error class. MozReview-Commit-ID: H1fw7VitAyO
testing/marionette/test_session.js
--- a/testing/marionette/test_session.js
+++ b/testing/marionette/test_session.js
@@ -243,23 +243,23 @@ add_test(function test_Proxy_toJSON() {
 });
 
 add_test(function test_Proxy_fromJSON() {
   let p = new session.Proxy();
   deepEqual(p, session.Proxy.fromJSON(undefined));
   deepEqual(p, session.Proxy.fromJSON(null));
 
   for (let typ of [true, 42, "foo", []]) {
-    Assert.throws(() => session.Proxy.fromJSON(typ), InvalidArgumentError);
+    Assert.throws(() => session.Proxy.fromJSON(typ), /InvalidArgumentError/);
   }
 
   // must contain a valid proxyType
-  Assert.throws(() => session.Proxy.fromJSON({}), InvalidArgumentError);
+  Assert.throws(() => session.Proxy.fromJSON({}), /InvalidArgumentError/);
   Assert.throws(() => session.Proxy.fromJSON({proxyType: "foo"}),
-      InvalidArgumentError);
+      /InvalidArgumentError/);
 
   // autoconfig url
   for (let url of [true, 42, [], {}]) {
     Assert.throws(() => session.Proxy.fromJSON(
         {proxyType: "pac", proxyAutoconfigUrl: url}), /InvalidArgumentError/);
   }
 
   p = new session.Proxy();
@@ -277,17 +277,17 @@ add_test(function test_Proxy_fromJSON() 
     let manual = {proxyType: "manual"};
 
     // invalid hosts
     for (let host of [true, 42, [], {}, null, "http://foo",
         "foo:-1", "foo:65536", "foo/test", "foo#42", "foo?foo=bar",
         "2001:db8::1"]) {
       manual[proxy] = host;
       Assert.throws(() => session.Proxy.fromJSON(manual),
-          InvalidArgumentError);
+          /InvalidArgumentError/);
     }
 
     p = new session.Proxy();
     p.proxyType = "manual";
     if (proxy == "socksProxy") {
       manual.socksVersion = 5;
       p.socksVersion = 5;
     }
@@ -329,24 +329,24 @@ add_test(function test_Proxy_fromJSON() 
 
       deepEqual(p, session.Proxy.fromJSON(manual));
     }
   }
 
   // missing required socks version
   Assert.throws(() => session.Proxy.fromJSON(
       {proxyType: "manual", socksProxy: "foo:1234"}),
-      InvalidArgumentError);
+      /InvalidArgumentError/);
 
   // noProxy: invalid settings
   for (let noProxy of [true, 42, {}, null, "foo",
       [true], [42], [{}], [null]]) {
     Assert.throws(() => session.Proxy.fromJSON(
         {proxyType: "manual", noProxy: noProxy}),
-        InvalidArgumentError);
+        /InvalidArgumentError/);
   }
 
   // noProxy: valid settings
   p = new session.Proxy();
   p.proxyType = "manual";
   for (let noProxy of [[], ["foo"], ["foo", "bar"], ["127.0.0.1"]]) {
     let manual = {proxyType: "manual", "noProxy": noProxy}
     p.noProxy = noProxy;
@@ -416,17 +416,17 @@ add_test(function test_Capabilities_toJS
 add_test(function test_Capabilities_fromJSON() {
   const {fromJSON} = session.Capabilities;
 
   // plain
   for (let typ of [{}, null, undefined]) {
     ok(fromJSON(typ).has("browserName"));
   }
   for (let typ of [true, 42, "foo", []]) {
-    Assert.throws(() => fromJSON(typ), InvalidArgumentError);
+    Assert.throws(() => fromJSON(typ), /InvalidArgumentError/);
   }
 
   // matching
   let caps = new session.Capabilities();
 
   caps = fromJSON({acceptInsecureCerts: true});
   equal(true, caps.get("acceptInsecureCerts"));
   caps = fromJSON({acceptInsecureCerts: false});