Bug 1028037 - NFC testcase failure with error message 'Accessing TypedArray data over Xrays is slow'. r=bholley
authorDimi Lee <dlee@mozilla.com>
Thu, 03 Jul 2014 14:55:13 +0800
changeset 192031 e257340ac8dc6c55b922b36190f4747d9a94369c
parent 192030 90db794507b3b051001c57f70acbaf0eaa439e6e
child 192032 1f24cbde93deafacf3d7f3e7c7061f528dad2900
push id8588
push useryhuang@mozilla.com
push dateThu, 03 Jul 2014 09:17:07 +0000
treeherderb2g-inbound@e257340ac8dc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs1028037
milestone33.0a1
Bug 1028037 - NFC testcase failure with error message 'Accessing TypedArray data over Xrays is slow'. r=bholley
dom/nfc/tests/marionette/head.js
dom/nfc/tests/marionette/test_nfc_tag.js
--- a/dom/nfc/tests/marionette/head.js
+++ b/dom/nfc/tests/marionette/head.js
@@ -1,15 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
+const Cu = SpecialPowers.Cu;
+
 let pendingEmulatorCmdCount = 0;
 
-let Promise =
-  SpecialPowers.Cu.import("resource://gre/modules/Promise.jsm").Promise;
+let Promise = Cu.import("resource://gre/modules/Promise.jsm").Promise;
 let nfc = window.navigator.mozNfc;
 
 SpecialPowers.addPermission("nfc-manager", true, document);
 
 /**
  * Emulator helper.
  */
 let emulator = (function() {
@@ -183,18 +184,18 @@ const NDEF = {
     isnot(ndef2, null, "RHS message is not null");
     is(ndef1.length, ndef2.length,
        "NDEF messages have the same number of records");
     ndef1.forEach(function(record1, index) {
       let record2 = this[index];
       is(record1.tnf, record2.tnf, "test for equal TNF fields");
       let fields = ["type", "id", "payload"];
       fields.forEach(function(value) {
-        let field1 = record1[value];
-        let field2 = record2[value];
+        let field1 = Cu.waiveXrays(record1)[value];
+        let field2 = Cu.waiveXrays(record2)[value];
         is(field1.length, field2.length,
            value + " fields have the same length");
         let eq = true;
         for (let i = 0; eq && i < field1.length; ++i) {
           eq = (field1[i] === field2[i]);
         }
         ok(eq, value + " fields contain the same data");
       });
--- a/dom/nfc/tests/marionette/test_nfc_tag.js
+++ b/dom/nfc/tests/marionette/test_nfc_tag.js
@@ -21,17 +21,17 @@ function testUrlTagDiscover(re) {
   let payload = url;
 
   window.navigator.mozSetMessageHandler("nfc-manager-tech-discovered", function(msg) {
     log("Received \'nfc-manager-tech-ndiscovered\'");
     is(msg.type, "techDiscovered", "check for correct message type");
     let index = msg.techList.indexOf("NDEF");
     isnot(index, -1, "check for \'NDEF\' in tech list");
 
-    let records = msg.records;
+    let records = Cu.waiveXrays(msg.records);
     ok(records.length > 0);
 
     is(tnf, records[0].tnf, "check for TNF field in NDEF");
     is(type, NfcUtils.toUTF8(records[0].type), "check for type field in NDEF");
     is(payload, NfcUtils.toUTF8(records[0].payload), "check for payload field in NDEF");
 
     toggleNFC(false).then(runNextTest);
   });