Bug 988816 - Test case to read memory-mapped array buffer in a packaged app with OOP. r=fabrice
authorShian-Yow Wu <swu@mozilla.com>
Fri, 18 Jul 2014 10:46:25 +0800
changeset 216750 a5446bb5fa7d082fb022af063811343a57f15376
parent 216749 f7de657a37ed109072f19e1dffe4867f856a5047
child 216751 a9d2ca71f904b9fbd8afaec44e8f662cd121f124
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfabrice
bugs988816
milestone33.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 988816 - Test case to read memory-mapped array buffer in a packaged app with OOP. r=fabrice
dom/apps/tests/file_bug_945152.html
dom/apps/tests/test_bug_945152.html
--- a/dom/apps/tests/file_bug_945152.html
+++ b/dom/apps/tests/file_bug_945152.html
@@ -18,16 +18,23 @@
 
   function ok(p, msg) {
     if (p)
       sendMessage("OK: " + msg);
     else
       sendMessage("KO: " + msg);
   }
 
+  function is(a, b, msg) {
+    if (a == b)
+      sendMessage("OK: " + a + " == " + b + " - " + msg);
+    else
+      sendMessage("KO: " + a + " != " + b + " - " + msg);
+  }
+
   function testXHR(file, data_head, mapped, cb) {
     var xhr = new XMLHttpRequest();
     xhr.open('GET', file);
     xhr.responseType = 'arraybuffer';
     xhr.onreadystatechange = function xhrReadystatechange() {
       if (xhr.readyState !== xhr.DONE) {
         return;
       }
@@ -36,18 +43,18 @@
         if (mapped) {
           ok(ct.indexOf("mem-mapped") != -1, "Data is memory-mapped");
         } else {
           ok(ct.indexOf("mem-mapped") == -1, "Data is not memory-mapped");
         }
         var data = xhr.response;
         ok(data, "Data is non-null");
         var str = String.fromCharCode.apply(null, Uint8Array(data));
-        ok(str.length == data_head.length + gPaddingSize, "Data size is correct");
-        ok(str.slice(0, data_head.length) == data_head, "Data head is correct");
+        is(str.length, data_head.length + gPaddingSize, "Data size is correct");
+        is(str.slice(0, data_head.length), data_head, "Data head is correct");
         ok(str.slice(data_head.length) == gPadding, "Data padding is correct");
         cb();
       } else {
         ok(false, "XHR error: " + xhr.status + " - " + xhr.statusText + "\n");
         cb();
       }
     }
     xhr.send();
--- a/dom/apps/tests/test_bug_945152.html
+++ b/dom/apps/tests/test_bug_945152.html
@@ -86,18 +86,24 @@ https://bugzilla.mozilla.org/show_bug.cg
 
     var req = navigator.mozApps.installPackage(gSJS + '?getManifest=1');
     req.onerror = mozAppsError;
     req.onsuccess = function() {
       ok(true, "Application installed");
     };
     yield undefined;
 
-    // Launch app.
-    launchApp(app, continueTest);
+    // Launch app non-OOP.
+    info("Launch app with non-OOP");
+    launchApp(app, continueTest, false);
+    yield undefined;
+
+    // Launch app OOP.
+    info("Launch app with OOP");
+    launchApp(app, continueTest, true);
     yield undefined;
 
     // Uninstall app.
     var req = navigator.mozApps.mgmt.uninstall(app);
     req.onerror = mozAppsError;
     req.onsuccess = continueTest;
     yield undefined;
 
@@ -111,19 +117,20 @@ https://bugzilla.mozilla.org/show_bug.cg
     var url = gSJS + '?createApp=1';
     xhr.addEventListener("load", function() { is(xhr.responseText, "OK", "createApp OK"); cb(); });
     xhr.addEventListener("error", event => xhrError(event, url));
     xhr.addEventListener("abort", event => xhrAbort(url));
     xhr.open('GET', url, true);
     xhr.send();
   }
 
-  function launchApp(app, cb) {
+  function launchApp(app, cb, oop) {
     // Set up the app.
     var ifr = document.createElement('iframe');
+    ifr.setAttribute('remote', oop ? 'true' : 'false');
     ifr.setAttribute('mozbrowser', 'true');
     ifr.setAttribute('mozapp', app.manifestURL);
     ifr.setAttribute('src', app.origin + app.manifest.launch_path);
     var domParent = document.getElementById('container');
 
     // Set us up to listen for messages from the app.
     var listener = function(e) {
       var message = e.detail.message;