зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset a2601d3f3214 (bug 919496) for xpcshell assertions during test_webappsActor.js
This commit is contained in:
Родитель
cf68f3f923
Коммит
4fc6d15479
|
@ -8,6 +8,9 @@ const {Connection} = require("devtools/client/connection-manager");
|
||||||
|
|
||||||
const {Cu} = require("chrome");
|
const {Cu} = require("chrome");
|
||||||
const dbgClient = Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
|
const dbgClient = Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
|
||||||
|
dbgClient.UnsolicitedNotifications.appOpen = "appOpen";
|
||||||
|
dbgClient.UnsolicitedNotifications.appClose = "appClose"
|
||||||
|
|
||||||
const _knownWebappsStores = new WeakMap();
|
const _knownWebappsStores = new WeakMap();
|
||||||
|
|
||||||
let WebappsStore;
|
let WebappsStore;
|
||||||
|
@ -100,14 +103,6 @@ WebappsStore.prototype = {
|
||||||
this._onAppClose(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.resolve();
|
||||||
})
|
})
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
|
@ -182,10 +177,6 @@ WebappsStore.prototype = {
|
||||||
let a = allApps[idx++];
|
let a = allApps[idx++];
|
||||||
request.manifestURL = a.manifestURL;
|
request.manifestURL = a.manifestURL;
|
||||||
return client.request(request, (res) => {
|
return client.request(request, (res) => {
|
||||||
if (res.error) {
|
|
||||||
Cu.reportError(res.message || res.error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (res.url) {
|
if (res.url) {
|
||||||
a.iconURL = res.url;
|
a.iconURL = res.url;
|
||||||
}
|
}
|
||||||
|
@ -213,57 +204,4 @@ WebappsStore.prototype = {
|
||||||
return m != manifest;
|
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);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,23 +57,6 @@ add_test(function testGetAll() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
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() {
|
add_test(function testLaunchApp() {
|
||||||
let manifestURL = APP_ORIGIN + "/manifest.webapp";
|
let manifestURL = APP_ORIGIN + "/manifest.webapp";
|
||||||
let startPoint = "/index.html";
|
let startPoint = "/index.html";
|
||||||
|
@ -120,7 +103,6 @@ add_test(function testCloseApp() {
|
||||||
let red1px = "data:application/xml;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVQI12P4z8AAAAMBAQAY3Y2wAAAAAElFTkSuQmCC";
|
let red1px = "data:application/xml;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVQI12P4z8AAAAMBAQAY3Y2wAAAAAElFTkSuQmCC";
|
||||||
let blue1px = "data:application/xml;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVQI12MwZDgHAAFlAQBDpjhLAAAAAElFTkSuQmCC";
|
let blue1px = "data:application/xml;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVQI12MwZDgHAAFlAQBDpjhLAAAAAElFTkSuQmCC";
|
||||||
|
|
||||||
/* testGetIcon and testGetIconWithCustomSize disabled: bug 920981
|
|
||||||
add_test(function testGetIcon() {
|
add_test(function testGetIcon() {
|
||||||
let manifestURL = APP_ORIGIN + "/manifest.webapp";
|
let manifestURL = APP_ORIGIN + "/manifest.webapp";
|
||||||
let request = {
|
let request = {
|
||||||
|
@ -152,7 +134,6 @@ add_test(function testGetIconWithCustomSize() {
|
||||||
run_next_test();
|
run_next_test();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
*/
|
|
||||||
|
|
||||||
add_test(function testUninstall() {
|
add_test(function testUninstall() {
|
||||||
let manifestURL = APP_ORIGIN + "/manifest.webapp";
|
let manifestURL = APP_ORIGIN + "/manifest.webapp";
|
||||||
|
|
|
@ -4,3 +4,4 @@ tail = tail_apps.js
|
||||||
support-files = data/app.zip
|
support-files = data/app.zip
|
||||||
|
|
||||||
[test_webappsActor.js]
|
[test_webappsActor.js]
|
||||||
|
skip-if = (os == "win" || "linux" || "mac")
|
||||||
|
|
|
@ -541,32 +541,6 @@ WebappsActor.prototype = {
|
||||||
return deferred.promise;
|
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() {
|
_areCertifiedAppsAllowed: function wa__areCertifiedAppsAllowed() {
|
||||||
let pref = "devtools.debugger.forbid-certified-apps";
|
let pref = "devtools.debugger.forbid-certified-apps";
|
||||||
return !Services.prefs.getBoolPref(pref);
|
return !Services.prefs.getBoolPref(pref);
|
||||||
|
@ -954,7 +928,6 @@ if (Services.prefs.getBoolPref("devtools.debugger.enable-content-actors")) {
|
||||||
let requestTypes = WebappsActor.prototype.requestTypes;
|
let requestTypes = WebappsActor.prototype.requestTypes;
|
||||||
requestTypes.uploadPackage = WebappsActor.prototype.uploadPackage;
|
requestTypes.uploadPackage = WebappsActor.prototype.uploadPackage;
|
||||||
requestTypes.getAll = WebappsActor.prototype.getAll;
|
requestTypes.getAll = WebappsActor.prototype.getAll;
|
||||||
requestTypes.getApp = WebappsActor.prototype.getApp;
|
|
||||||
requestTypes.launch = WebappsActor.prototype.launch;
|
requestTypes.launch = WebappsActor.prototype.launch;
|
||||||
requestTypes.close = WebappsActor.prototype.close;
|
requestTypes.close = WebappsActor.prototype.close;
|
||||||
requestTypes.uninstall = WebappsActor.prototype.uninstall;
|
requestTypes.uninstall = WebappsActor.prototype.uninstall;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче