Bug 953005 - Part 2: Add test_mobile_connections_array_uninitialized. a=1.3+
authorHsin-Yi Tsai <htsai@mozilla.com>
Wed, 15 Jan 2014 12:17:03 +0800
changeset 175944 0c0e7c3fd0efc4684db0d62d996c2e40bdfd9027
parent 175943 d17316ce716eef5aeadaf4e6e3203cb62f2bd843
child 175945 bc7764b0d190238d2a7fdc3ed60d1e40a830949c
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewers1
bugs953005
milestone28.0a2
Bug 953005 - Part 2: Add test_mobile_connections_array_uninitialized. a=1.3+
dom/network/tests/marionette/manifest.ini
dom/network/tests/marionette/test_mobile_connections_array_uninitialized.js
--- a/dom/network/tests/marionette/manifest.ini
+++ b/dom/network/tests/marionette/manifest.ini
@@ -15,8 +15,9 @@ disabled = Bug 808783
 [test_mobile_data_state.js]
 [test_mobile_mmi.js]
 [test_mobile_roaming_preference.js]
 [test_call_barring_get_option.js]
 [test_call_barring_set_error.js]
 [test_call_barring_change_password.js]
 [test_mobile_set_radio.js]
 [test_mobile_last_known_network.js]
+[test_mobile_connections_array_uninitialized.js]
new file mode 100644
--- /dev/null
+++ b/dom/network/tests/marionette/test_mobile_connections_array_uninitialized.js
@@ -0,0 +1,32 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+MARIONETTE_TIMEOUT = 1000;
+
+SpecialPowers.addPermission("mobileconnection", true, document);
+
+// Permission changes can't change existing Navigator.prototype
+// objects, so grab our objects from a new Navigator
+let ifr = document.createElement("iframe");
+let connections;
+
+ifr.onload = function() {
+  connections = ifr.contentWindow.navigator.mozMobileConnections;
+
+  // mozMobileConnections hasn't been initialized yet.
+  ok(connections);
+  is(connections.length, 1);
+
+  ifr.parentNode.removeChild(ifr);
+  ifr = null;
+  connections = null;
+
+  SpecialPowers.gc();
+  cleanUp();
+};
+document.body.appendChild(ifr);
+
+function cleanUp() {
+  SpecialPowers.removePermission("mobileconnection", document);
+  finish();
+}