mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 872100 - app.clearBrowserData appears to not clear browser data immediately sr=mounir, r=jduell,ferjm
This commit is contained in:
parent
dfbbf813b3
commit
22954fcfa5
@ -368,7 +368,8 @@ WebappsApplication.prototype = {
|
||||
"Webapps:CheckForUpdate:Return:OK",
|
||||
"Webapps:CheckForUpdate:Return:KO",
|
||||
"Webapps:Launch:Return:KO",
|
||||
"Webapps:PackageEvent"]);
|
||||
"Webapps:PackageEvent",
|
||||
"Webapps:ClearBrowserData:Return"]);
|
||||
|
||||
cpmm.sendAsyncMessage("Webapps:RegisterForMessages",
|
||||
["Webapps:OfflineCache",
|
||||
@ -464,11 +465,26 @@ WebappsApplication.prototype = {
|
||||
},
|
||||
|
||||
clearBrowserData: function() {
|
||||
let request = this.createRequest();
|
||||
let browserChild =
|
||||
BrowserElementPromptService.getBrowserElementChildForWindow(this._window);
|
||||
if (browserChild) {
|
||||
browserChild.messageManager.sendAsyncMessage("Webapps:ClearBrowserData");
|
||||
browserChild.messageManager.sendAsyncMessage(
|
||||
"Webapps:ClearBrowserData",
|
||||
{ manifestURL: this.manifestURL,
|
||||
oid: this._id,
|
||||
requestID: this.getRequestId(request) }
|
||||
);
|
||||
} else {
|
||||
let runnable = {
|
||||
run: function run() {
|
||||
Services.DOMRequest.fireError(request, "NO_CLEARABLE_BROWSER");
|
||||
}
|
||||
}
|
||||
Services.tm.currentThread.dispatch(runnable,
|
||||
Ci.nsIThread.DISPATCH_NORMAL);
|
||||
}
|
||||
return request;
|
||||
},
|
||||
|
||||
uninit: function() {
|
||||
@ -590,6 +606,9 @@ WebappsApplication.prototype = {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "Webapps:ClearBrowserData:Return":
|
||||
Services.DOMRequest.fireSuccess(req, null);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -3015,7 +3015,7 @@ this.DOMApplicationRegistry = {
|
||||
|
||||
},
|
||||
|
||||
_notifyCategoryAndObservers: function(subject, topic, data) {
|
||||
_notifyCategoryAndObservers: function(subject, topic, data, msg) {
|
||||
const serviceMarker = "service,";
|
||||
|
||||
// First create observers from the category manager.
|
||||
@ -3064,6 +3064,8 @@ this.DOMApplicationRegistry = {
|
||||
observer.observe(subject, topic, data);
|
||||
} catch(e) { }
|
||||
});
|
||||
// Send back an answer to the child.
|
||||
ppmm.broadcastAsyncMessage("Webapps:ClearBrowserData:Return", msg);
|
||||
},
|
||||
|
||||
registerBrowserElementParentForApp: function(bep, appId) {
|
||||
@ -3080,18 +3082,18 @@ this.DOMApplicationRegistry = {
|
||||
receiveAppMessage: function(appId, message) {
|
||||
switch (message.name) {
|
||||
case "Webapps:ClearBrowserData":
|
||||
this._clearPrivateData(appId, true);
|
||||
this._clearPrivateData(appId, true, message.data);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
_clearPrivateData: function(appId, browserOnly) {
|
||||
_clearPrivateData: function(appId, browserOnly, msg) {
|
||||
let subject = {
|
||||
appId: appId,
|
||||
browserOnly: browserOnly,
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.mozIApplicationClearPrivateDataParams])
|
||||
};
|
||||
this._notifyCategoryAndObservers(subject, "webapps-clear-data", null);
|
||||
this._notifyCategoryAndObservers(subject, "webapps-clear-data", null, msg);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
interface nsIDOMDOMRequest;
|
||||
|
||||
[scriptable, uuid(d33ee8a0-00e4-4669-b55d-f77fbee1153d)]
|
||||
[scriptable, uuid(8bdeef38-e9cd-46f8-b8de-ed9e6b4d01ea)]
|
||||
interface mozIDOMApplication : nsISupports
|
||||
{
|
||||
readonly attribute jsval manifest;
|
||||
@ -85,8 +85,11 @@ interface mozIDOMApplication : nsISupports
|
||||
/* startPoint will be used when several launch_path exists for an app */
|
||||
nsIDOMDOMRequest launch([optional] in DOMString startPoint);
|
||||
|
||||
/* Clear data that has been collected through mozbrowser elements. */
|
||||
void clearBrowserData();
|
||||
/**
|
||||
* Clear data that has been collected through mozbrowser elements.
|
||||
* onsuccess will be called once data is actually cleared.
|
||||
*/
|
||||
nsIDOMDOMRequest clearBrowserData();
|
||||
};
|
||||
|
||||
[scriptable, uuid(cf742022-5ba3-11e2-868f-03310341b006)]
|
||||
|
@ -88,7 +88,8 @@ NeckoParent::GetValidatedAppInfo(const SerializedLoadContext& aSerialized,
|
||||
nsRefPtr<TabParent> tabParent = static_cast<TabParent*>(aBrowser);
|
||||
|
||||
*aAppId = tabParent->OwnOrContainingAppId();
|
||||
*aInBrowserElement = tabParent->IsBrowserElement();
|
||||
*aInBrowserElement = aSerialized.IsNotNull() ? aSerialized.mIsInBrowserElement
|
||||
: tabParent->IsBrowserElement();
|
||||
|
||||
if (*aAppId == NECKO_UNKNOWN_APP_ID) {
|
||||
return "TabParent reports appId=NECKO_UNKNOWN_APP_ID!";
|
||||
|
Loading…
Reference in New Issue
Block a user