Backed out changeset a2601d3f3214 (bug 919496) for xpcshell assertions during test_webappsActor.js
authorEd Morley <emorley@mozilla.com>
Thu, 26 Sep 2013 16:22:26 +0100
changeset 148907 a9ed5d97225fdbdc74e84475b72de0c472bbbd8d
parent 148906 c0ba6ce1d34dc7f9ba10aa6ccbd02086922b9cde
child 148908 e6af0f7d99da3c42a8559f7f72948ebc3f85e44f
push id34380
push userryanvm@gmail.com
push dateFri, 27 Sep 2013 01:41:00 +0000
treeherdermozilla-inbound@fdc6054e33e4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs919496
milestone27.0a1
backs outa2601d3f3214489582750fb8c88db5ada6d3ceea
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
Backed out changeset a2601d3f3214 (bug 919496) for xpcshell assertions during test_webappsActor.js
browser/devtools/app-manager/webapps-store.js
toolkit/devtools/apps/tests/unit/test_webappsActor.js
toolkit/devtools/apps/tests/unit/xpcshell.ini
toolkit/devtools/server/actors/webapps.js
--- a/browser/devtools/app-manager/webapps-store.js
+++ b/browser/devtools/app-manager/webapps-store.js
@@ -3,16 +3,19 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 const ObservableObject = require("devtools/shared/observable-object");
 const promise = require("sdk/core/promise");
 const {Connection} = require("devtools/client/connection-manager");
 
 const {Cu} = require("chrome");
 const dbgClient = Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
+dbgClient.UnsolicitedNotifications.appOpen = "appOpen";
+dbgClient.UnsolicitedNotifications.appClose = "appClose"
+
 const _knownWebappsStores = new WeakMap();
 
 let WebappsStore;
 
 module.exports = WebappsStore = function(connection) {
   // If we already know about this connection,
   // let's re-use the existing store.
   if (_knownWebappsStores.has(connection)) {
@@ -95,24 +98,16 @@ WebappsStore.prototype = {
       client.addListener("appOpen", (type, { manifestURL }) => {
         this._onAppOpen(manifestURL);
       });
 
       client.addListener("appClose", (type, { manifestURL }) => {
         this._onAppClose(manifestURL);
       });
 
-      client.addListener("appInstall", (type, { manifestURL }) => {
-        this._onAppInstall(manifestURL);
-      });
-
-      client.addListener("appUninstall", (type, { manifestURL }) => {
-        this._onAppUninstall(manifestURL);
-      });
-
       return deferred.resolve();
     })
     return deferred.promise;
   },
 
   _getAllApps: function() {
     let deferred = promise.defer();
     let request = {
@@ -177,20 +172,16 @@ WebappsStore.prototype = {
     let idx = 0;
     (function getIcon() {
       if (idx == allApps.length) {
         return deferred.resolve();
       }
       let a = allApps[idx++];
       request.manifestURL = a.manifestURL;
       return client.request(request, (res) => {
-        if (res.error) {
-          Cu.reportError(res.message || res.error);
-        }
-
         if (res.url) {
           a.iconURL = res.url;
         }
         getIcon();
       });
     })();
 
     return deferred.promise;
@@ -208,62 +199,9 @@ WebappsStore.prototype = {
   _onAppClose: function(manifest) {
     let a = this._getAppFromManifest(manifest);
     a.running = false;
     let running = this.object.running;
     this.object.running = running.filter((m) => {
       return m != manifest;
     });
   },
-
-  _onAppInstall: function(manifest) {
-    let client = this._connection.client;
-    let request = {
-      to: this._webAppsActor,
-      type: "getApp",
-      manifestURL: manifest
-    };
-
-    client.request(request, (res) => {
-      if (res.error) {
-        if (res.error == "forbidden") {
-          // We got a notification for an app we don't have access to.
-          // Ignore.
-          return;
-        }
-        Cu.reportError(res.message || res.error);
-        return;
-      }
-
-      let app = res.app;
-      app.running = false;
-
-      let notFound = true;
-      let proxifiedApp;
-      for (let i = 0; i < this.object.all.length; i++) {
-        let storedApp = this.object.all[i];
-        if (storedApp.manifestURL == app.manifestURL) {
-          this.object.all[i] = app;
-          proxifiedApp = this.object.all[i];
-          notFound = false;
-          break;
-        }
-      }
-      if (notFound) {
-        this.object.all.push(app);
-        proxifiedApp = this.object.all[this.object.all.length - 1];
-      }
-
-      request.type = "getIconAsDataURL";
-      client.request(request, (res) => {
-        if (res.url) {
-          proxifiedApp.iconURL = res.url;
-        }
-      });
-    });
-  },
-
-  _onAppUninstall: function(manifest) {
-    this.object.all = this.object.all.filter((app) => {
-      return (app.manifestURL != manifest);
-    });
-  },
 }
--- a/toolkit/devtools/apps/tests/unit/test_webappsActor.js
+++ b/toolkit/devtools/apps/tests/unit/test_webappsActor.js
@@ -52,33 +52,16 @@ add_test(function testGetAll() {
         run_next_test();
         return;
       }
     }
     do_throw("Unable to find the test app by its id");
   });
 });
 
-add_test(function testGetApp() {
-  let manifestURL = APP_ORIGIN + "/manifest.webapp";
-  let request = {type: "getApp", manifestURL: manifestURL};
-  webappActorRequest(request, function (aResponse) {
-    do_check_true("app" in aResponse);
-    let app = aResponse.app;
-    do_check_eq(app.id, gAppId);
-    do_check_eq(app.name, "Test app");
-    do_check_eq(app.manifest.description, "Testing webapps actor");
-    do_check_eq(app.manifest.launch_path, "/index.html");
-    do_check_eq(app.origin, APP_ORIGIN);
-    do_check_eq(app.installOrigin, app.origin);
-    do_check_eq(app.manifestURL, app.origin + "/manifest.webapp");
-    run_next_test();
-  });
-});
-
 add_test(function testLaunchApp() {
   let manifestURL = APP_ORIGIN + "/manifest.webapp";
   let startPoint = "/index.html";
   let request = {
     type: "launch",
     manifestURL: manifestURL,
     startPoint: startPoint
   };
@@ -115,17 +98,16 @@ add_test(function testCloseApp() {
 });
 
 // The 128px icon is a single red pixel and the 64px one is a blue one
 // bug 899177: there is a bug with xhr and app:// and jar:// uris
 // that ends up forcing the content type to application/xml
 let red1px =  "data:application/xml;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVQI12P4z8AAAAMBAQAY3Y2wAAAAAElFTkSuQmCC";
 let blue1px = "data:application/xml;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVQI12MwZDgHAAFlAQBDpjhLAAAAAElFTkSuQmCC";
 
-/* testGetIcon and testGetIconWithCustomSize disabled: bug 920981
 add_test(function testGetIcon() {
   let manifestURL = APP_ORIGIN + "/manifest.webapp";
   let request = {
     type: "getIconAsDataURL",
     manifestURL: manifestURL
   };
 
   webappActorRequest(request, function (aResponse) {
@@ -147,17 +129,16 @@ add_test(function testGetIconWithCustomS
 
   webappActorRequest(request, function (aResponse) {
     do_check_false("error" in aResponse);
 
     do_check_eq(aResponse.url, blue1px);
     run_next_test();
   });
 });
-*/
 
 add_test(function testUninstall() {
   let manifestURL = APP_ORIGIN + "/manifest.webapp";
   let request = {
     type: "uninstall",
     manifestURL: manifestURL
   };
 
--- a/toolkit/devtools/apps/tests/unit/xpcshell.ini
+++ b/toolkit/devtools/apps/tests/unit/xpcshell.ini
@@ -1,6 +1,7 @@
 [DEFAULT]
 head = head_apps.js
 tail = tail_apps.js
 support-files = data/app.zip
 
 [test_webappsActor.js]
+skip-if = (os == "win" || "linux" || "mac")
--- a/toolkit/devtools/server/actors/webapps.js
+++ b/toolkit/devtools/server/actors/webapps.js
@@ -536,42 +536,16 @@ WebappsActor.prototype = {
     let reg = DOMApplicationRegistry;
     reg.getAll(apps => {
       deferred.resolve({ apps: this._filterAllowedApps(apps) });
     });
 
     return deferred.promise;
   },
 
-  getApp: function wa_actorGetApp(aRequest) {
-    debug("getAll");
-
-    let manifestURL = aRequest.manifestURL;
-    if (!manifestURL) {
-      return { error: "missingParameter",
-               message: "missing parameter manifestURL" };
-    }
-
-    let reg = DOMApplicationRegistry;
-    let app = reg.getAppByManifestURL(manifestURL);
-    if (!app) {
-      return { error: "appNotFound" };
-    }
-
-    if (this._isAppAllowedForManifest(app.manifestURL)) {
-      let deferred = promise.defer();
-      reg.getManifestFor(manifestURL, function (manifest) {
-        app.manifest = manifest;
-        deferred.resolve({app: app});
-      });
-      return deferred.promise;
-    }
-    return { error: "forbidden" };
-  },
-
   _areCertifiedAppsAllowed: function wa__areCertifiedAppsAllowed() {
     let pref = "devtools.debugger.forbid-certified-apps";
     return !Services.prefs.getBoolPref(pref);
   },
 
   _isAppAllowedForManifest: function wa__isAppAllowedForManifest(aManifest) {
     if (this._areCertifiedAppsAllowed()) {
       return true;
@@ -949,17 +923,16 @@ WebappsActor.prototype.requestTypes = {
 };
 
 // Until we implement unix domain socket, we only enable app install
 // only on production devices
 if (Services.prefs.getBoolPref("devtools.debugger.enable-content-actors")) {
   let requestTypes = WebappsActor.prototype.requestTypes;
   requestTypes.uploadPackage = WebappsActor.prototype.uploadPackage;
   requestTypes.getAll = WebappsActor.prototype.getAll;
-  requestTypes.getApp = WebappsActor.prototype.getApp;
   requestTypes.launch = WebappsActor.prototype.launch;
   requestTypes.close  = WebappsActor.prototype.close;
   requestTypes.uninstall = WebappsActor.prototype.uninstall;
   requestTypes.listRunningApps = WebappsActor.prototype.listRunningApps;
   requestTypes.getAppActor = WebappsActor.prototype.getAppActor;
   requestTypes.watchApps = WebappsActor.prototype.watchApps;
   requestTypes.unwatchApps = WebappsActor.prototype.unwatchApps;
   requestTypes.getIconAsDataURL = WebappsActor.prototype.getIconAsDataURL;