Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1123637 - Remove all code relevant to quota prompts; r=bent,ehsan
Browse files Browse the repository at this point in the history
  • Loading branch information
janvarga committed Jan 22, 2015
1 parent 6ffdbc4 commit 6e2abd7
Show file tree
Hide file tree
Showing 47 changed files with 208 additions and 1,959 deletions.
3 changes: 0 additions & 3 deletions b2g/app/b2g.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,6 @@ pref("gfx.content.azure.backends", "cairo");
// Web Notifications
pref("notification.feature.enabled", true);

// IndexedDB
pref("dom.indexedDB.warningQuota", 5);

// prevent video elements from preloading too much data
pref("media.preload.default", 1); // default to preload none
pref("media.preload.auto", 2); // preload metadata if preload=auto
Expand Down
33 changes: 0 additions & 33 deletions b2g/chrome/content/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ var shell = {
CustomEventManager.init();
WebappsHelper.init();
UserAgentOverrides.init();
IndexedDBPromptHelper.init();
CaptivePortalLoginHelper.init();

this.contentBrowser.src = homeURL;
Expand All @@ -365,7 +364,6 @@ var shell = {
ppmm.removeMessageListener("content-handler", this);

UserAgentOverrides.uninit();
IndexedDBPromptHelper.uninit();
},

// If this key event represents a hardware button which needs to be send as
Expand Down Expand Up @@ -795,37 +793,6 @@ var WebappsHelper = {
}
}

let IndexedDBPromptHelper = {
_quotaPrompt: "indexedDB-quota-prompt",
_quotaResponse: "indexedDB-quota-response",

init:
function IndexedDBPromptHelper_init() {
Services.obs.addObserver(this, this._quotaPrompt, false);
},

uninit:
function IndexedDBPromptHelper_uninit() {
Services.obs.removeObserver(this, this._quotaPrompt);
},

observe:
function IndexedDBPromptHelper_observe(subject, topic, data) {
if (topic != this._quotaPrompt) {
throw new Error("Unexpected topic!");
}

let observer = subject.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIObserver);
let responseTopic = this._quotaResponse;

setTimeout(function() {
observer.observe(null, responseTopic,
Ci.nsIPermissionManager.DENY_ACTION);
}, 0);
}
}

let KeyboardHelper = {
handleEvent: function keyboard_handleEvent(detail) {
switch (detail.type) {
Expand Down
31 changes: 2 additions & 29 deletions browser/base/content/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -6294,31 +6294,21 @@ var IndexedDBPromptHelper = {
_permissionsPrompt: "indexedDB-permissions-prompt",
_permissionsResponse: "indexedDB-permissions-response",

_quotaPrompt: "indexedDB-quota-prompt",
_quotaResponse: "indexedDB-quota-response",
_quotaCancel: "indexedDB-quota-cancel",

_notificationIcon: "indexedDB-notification-icon",

init:
function IndexedDBPromptHelper_init() {
Services.obs.addObserver(this, this._permissionsPrompt, false);
Services.obs.addObserver(this, this._quotaPrompt, false);
Services.obs.addObserver(this, this._quotaCancel, false);
},

uninit:
function IndexedDBPromptHelper_uninit() {
Services.obs.removeObserver(this, this._permissionsPrompt);
Services.obs.removeObserver(this, this._quotaPrompt);
Services.obs.removeObserver(this, this._quotaCancel);
},

observe:
function IndexedDBPromptHelper_observe(subject, topic, data) {
if (topic != this._permissionsPrompt &&
topic != this._quotaPrompt &&
topic != this._quotaCancel) {
if (topic != this._permissionsPrompt) {
throw new Error("Unexpected topic!");
}

Expand Down Expand Up @@ -6346,14 +6336,6 @@ var IndexedDBPromptHelper = {
[ host ]);
responseTopic = this._permissionsResponse;
}
else if (topic == this._quotaPrompt) {
message = gNavigatorBundle.getFormattedString("indexedDB.usage",
[ host, data ]);
responseTopic = this._quotaResponse;
}
else if (topic == this._quotaCancel) {
responseTopic = this._quotaResponse;
}

const hiddenTimeoutDuration = 30000; // 30 seconds
const firstTimeoutDuration = 300000; // 5 minutes
Expand Down Expand Up @@ -6384,9 +6366,7 @@ var IndexedDBPromptHelper = {
}
];

// This will be set to the result of PopupNotifications.show() below, or to
// the result of PopupNotifications.getNotification() if this is a
// quotaCancel notification.
// This will be set to the result of PopupNotifications.show().
var notification;

function timeoutNotification() {
Expand Down Expand Up @@ -6426,13 +6406,6 @@ var IndexedDBPromptHelper = {
}
};

if (topic == this._quotaCancel) {
notification = PopupNotifications.getNotification(this._quotaPrompt,
browser);
timeoutNotification();
return;
}

notification = PopupNotifications.show(browser, topic, message,
this._notificationIcon, mainAction,
secondaryActions, options);
Expand Down
4 changes: 0 additions & 4 deletions browser/base/content/pageinfo/permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,6 @@ function onCheckboxClick(aPartId)
var checkbox = document.getElementById(aPartId + "Def");
if (checkbox.checked) {
SitePermissions.remove(gPermURI, aPartId);
if (aPartId == "indexedDB") {
SitePermissions.remove(gPermURI, "indexedDB-unlimited");
}
command.setAttribute("disabled", "true");
var perm = SitePermissions.getDefault(aPartId);
setRadioState(aPartId, perm);
Expand Down Expand Up @@ -210,7 +207,6 @@ function onIndexedDBClear()
.clearStoragesForURI(gPermURI);

SitePermissions.remove(gPermURI, "indexedDB");
SitePermissions.remove(gPermURI, "indexedDB-unlimited");
initIndexedDBRow();
}

Expand Down
4 changes: 0 additions & 4 deletions browser/locales/en-US/chrome/browser/browser.properties
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,6 @@ offlineApps.usage=This website (%S) is now storing more than %SMB of data on you
offlineApps.manageUsage=Show settings
offlineApps.manageUsageAccessKey=S

# LOCALIZATION NOTE (indexedDB.usage): %1$S is the website host name
# %2$S a number of megabytes.
indexedDB.usage=This website (%1$S) is attempting to store more than %2$S MB of data on your computer for offline use.

identity.identified.verifier=Verified by: %S
identity.identified.verified_by_you=You have added a security exception for this site.
identity.identified.state_and_country=%S, %S
Expand Down
13 changes: 1 addition & 12 deletions browser/metro/base/content/bindings/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -707,22 +707,16 @@ let IndexedDB = {
_permissionsPrompt: "indexedDB-permissions-prompt",
_permissionsResponse: "indexedDB-permissions-response",

_quotaPrompt: "indexedDB-quota-prompt",
_quotaResponse: "indexedDB-quota-response",
_quotaCancel: "indexedDB-quota-cancel",

waitingObservers: [],

init: function IndexedDBPromptHelper_init() {
let os = Services.obs;
os.addObserver(this, this._permissionsPrompt, false);
os.addObserver(this, this._quotaPrompt, false);
os.addObserver(this, this._quotaCancel, false);
addMessageListener("IndexedDB:Response", this);
},

observe: function IndexedDBPromptHelper_observe(aSubject, aTopic, aData) {
if (aTopic != this._permissionsPrompt && aTopic != this._quotaPrompt && aTopic != this._quotaCancel) {
if (aTopic != this._permissionsPrompt) {
throw new Error("Unexpected topic!");
}

Expand All @@ -732,11 +726,6 @@ let IndexedDB = {
let contentWindow = requestor.getInterface(Ci.nsIDOMWindow);
let contentDocument = contentWindow.document;

if (aTopic == this._quotaCancel) {
observer.observe(null, this._quotaResponse, Ci.nsIPermissionManager.UNKNOWN_ACTION);
return;
}

// Remote to parent
sendAsyncMessage("IndexedDB:Prompt", {
topic: aTopic,
Expand Down
12 changes: 0 additions & 12 deletions browser/metro/base/content/helperui/IndexedDB.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ let IndexedDB = {
_permissionsPrompt: "indexedDB-permissions-prompt",
_permissionsResponse: "indexedDB-permissions-response",

_quotaPrompt: "indexedDB-quota-prompt",
_quotaResponse: "indexedDB-quota-response",
_quotaCancel: "indexedDB-quota-cancel",

_notificationIcon: "indexedDB-notification-icon",

receiveMessage: function(aMessage) {
Expand All @@ -33,14 +29,6 @@ let IndexedDB = {
if (topic == this._permissionsPrompt) {
type = "indexedDB";
payload.responseTopic = this._permissionsResponse;
} else if (topic == this._quotaPrompt) {
type = "indexedDBQuota";
payload.responseTopic = this._quotaResponse;
} else if (topic == this._quotaCancel) {
payload.permission = Ci.nsIPermissionManager.UNKNOWN_ACTION;
browser.messageManager.sendAsyncMessage("IndexedDB:Response", payload);
// XXX Need to actually save this?
return;
}

let prompt = Cc["@mozilla.org/content-permission/prompt;1"].createInstance(Ci.nsIContentPermissionPrompt);
Expand Down
3 changes: 1 addition & 2 deletions browser/metro/components/ContentPermissionPrompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ const kCountBeforeWeRemember = 5;

const kEntities = {
"geolocation": "geolocation2",
"indexedDB": "offlineApps",
"indexedDBQuota": "indexedDBQuota"
"indexedDB": "offlineApps"
};

const kIcons = {
Expand Down
6 changes: 1 addition & 5 deletions browser/metro/locales/en-US/chrome/browser.properties
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ contentPermissions.neverForSite=Never for this site
# word Share, please use Allow and Block in your language.
geolocation2.allow=Share location

# LOCALIZATION NOTE (geolocation2.wantsTo offlineApps.wantsTo indexedDBQuota.wantsTo):
# LOCALIZATION NOTE (geolocation2.wantsTo offlineApps.wantsTo):
# %S is the domain name of the web site.
geolocation2.wantsTo=Share your location with %S?

Expand All @@ -121,10 +121,6 @@ typeWarning=Warning:
offlineApps.allow=Allow
offlineApps.wantsTo=%S wants to store data on your device for offline use.

# IndexedDB Quota increases
indexedDBQuota.allow=Allow
indexedDBQuota.wantsTo=%S wants to store a lot of data on your device for offline use.

tabs.emptyTabTitle=New Tab

# Open Search
Expand Down
18 changes: 1 addition & 17 deletions browser/modules/SitePermissions.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@ this.SitePermissions = {
}

Services.perms.add(aURI, aPermissionID, aState);

if (aPermissionID in gPermissionObject &&
gPermissionObject[aPermissionID].onChange)
gPermissionObject[aPermissionID].onChange(aURI, aState);
},

/* Removes the saved state of a particular permission for a given URI.
Expand All @@ -98,10 +94,6 @@ this.SitePermissions = {
return;

Services.perms.remove(aURI.host, aPermissionID);

if (aPermissionID in gPermissionObject &&
gPermissionObject[aPermissionID].onChange)
gPermissionObject[aPermissionID].onChange(aURI, this.UNKNOWN);
},

/* Returns the localized label for the permission with the given ID, to be
Expand Down Expand Up @@ -144,9 +136,6 @@ let gPermissionObject = {
* Defaults to UNKNOWN, indicating that the user will be asked each time
* a page asks for that permissions.
*
* - onChange
* Called when a permission state changes.
*
* - states
* Array of permission states to be exposed to the user.
* Defaults to ALLOW, BLOCK and the default state (see getDefault).
Expand Down Expand Up @@ -195,12 +184,7 @@ let gPermissionObject = {
exactHostMatch: true
},

"indexedDB": {
onChange: function (aURI, aState) {
if (aState == SitePermissions.BLOCK)
Services.perms.remove(aURI.host, "indexedDB-unlimited");
}
},
"indexedDB": {},

"fullscreen": {},

Expand Down
1 change: 0 additions & 1 deletion browser/themes/linux/browser.css
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,6 @@ toolbarbutton[sdk-button="true"][cui-areatype="toolbar"] > .toolbarbutton-icon {
}

.popup-notification-icon[popupid="indexedDB-permissions-prompt"],
.popup-notification-icon[popupid="indexedDB-quota-prompt"],
.popup-notification-icon[popupid*="offline-app-requested"],
.popup-notification-icon[popupid="offline-app-usage"] {
list-style-image: url(chrome://global/skin/icons/question-64.png);
Expand Down
1 change: 0 additions & 1 deletion browser/themes/osx/browser.css
Original file line number Diff line number Diff line change
Expand Up @@ -4170,7 +4170,6 @@ menulist.translate-infobar-element > .menulist-dropmarker {
}

.popup-notification-icon[popupid="indexedDB-permissions-prompt"],
.popup-notification-icon[popupid="indexedDB-quota-prompt"],
.popup-notification-icon[popupid*="offline-app-requested"],
.popup-notification-icon[popupid="offline-app-usage"] {
list-style-image: url(chrome://global/skin/icons/question-64.png);
Expand Down
1 change: 0 additions & 1 deletion browser/themes/windows/browser.css
Original file line number Diff line number Diff line change
Expand Up @@ -2200,7 +2200,6 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
}

.popup-notification-icon[popupid="indexedDB-permissions-prompt"],
.popup-notification-icon[popupid="indexedDB-quota-prompt"],
.popup-notification-icon[popupid*="offline-app-requested"],
.popup-notification-icon[popupid="offline-app-usage"] {
list-style-image: url(chrome://global/skin/icons/question-64.png);
Expand Down
9 changes: 0 additions & 9 deletions dom/apps/PermissionsTable.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -306,15 +306,6 @@ this.PermissionsTable = { geolocation: {
privileged: ALLOW_ACTION,
certified: ALLOW_ACTION
},
"storage": {
app: ALLOW_ACTION,
trusted: ALLOW_ACTION,
privileged: ALLOW_ACTION,
certified: ALLOW_ACTION,
substitute: [
"indexedDB-unlimited"
]
},
"background-sensors": {
app: DENY_ACTION,
trusted: DENY_ACTION,
Expand Down
11 changes: 3 additions & 8 deletions dom/asmjscache/AsmJSCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,6 @@ class MainProcessRunnable : public virtual FileDescriptorHolder
mState(eInitial),
mResult(JS::AsmJSCache_InternalError),
mIsApp(false),
mHasUnlimStoragePerm(false),
mEnforcingQuota(true)
{
MOZ_ASSERT(IsMainProcess());
Expand Down Expand Up @@ -675,7 +674,6 @@ class MainProcessRunnable : public virtual FileDescriptorHolder
JS::AsmJSCacheResult mResult;

bool mIsApp;
bool mHasUnlimStoragePerm;
bool mEnforcingQuota;
};

Expand All @@ -700,7 +698,7 @@ MainProcessRunnable::InitPersistenceType()

if (mWriteParams.mInstalled &&
!QuotaManager::IsQuotaEnforced(quota::PERSISTENCE_TYPE_PERSISTENT,
mOrigin, mIsApp, mHasUnlimStoragePerm)) {
mOrigin, mIsApp)) {
mPersistence = quota::PERSISTENCE_TYPE_PERSISTENT;
} else {
mPersistence = quota::PERSISTENCE_TYPE_TEMPORARY;
Expand Down Expand Up @@ -735,15 +733,13 @@ MainProcessRunnable::InitOnMainThread()
NS_ENSURE_STATE(qm);

nsresult rv =
QuotaManager::GetInfoFromPrincipal(mPrincipal, &mGroup, &mOrigin, &mIsApp,
&mHasUnlimStoragePerm);
QuotaManager::GetInfoFromPrincipal(mPrincipal, &mGroup, &mOrigin, &mIsApp);
NS_ENSURE_SUCCESS(rv, rv);

InitPersistenceType();

mEnforcingQuota =
QuotaManager::IsQuotaEnforced(mPersistence, mOrigin, mIsApp,
mHasUnlimStoragePerm);
QuotaManager::IsQuotaEnforced(mPersistence, mOrigin, mIsApp);

QuotaManager::GetStorageId(mPersistence, mOrigin, quota::Client::ASMJS,
NS_LITERAL_STRING("asmjs"), mStorageId);
Expand All @@ -762,7 +758,6 @@ MainProcessRunnable::ReadMetadata()

nsresult rv =
qm->EnsureOriginIsInitialized(mPersistence, mGroup, mOrigin, mIsApp,
mHasUnlimStoragePerm,
getter_AddRefs(mDirectory));
NS_ENSURE_SUCCESS(rv, rv);

Expand Down
Loading

0 comments on commit 6e2abd7

Please sign in to comment.