Closed Bug 830983 Opened 11 years ago Closed 11 years ago

Remember my decision for desktop notification API in browser, clear storage data, access API again - API does not work

Categories

(Core :: Permission Manager, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla21
blocking-b2g tef+
Tracking Status
firefox19 --- wontfix
firefox20 --- wontfix
firefox21 --- fixed
b2g18 --- fixed
b2g18-v1.0.0 --- fixed

People

(Reporter: jsmith, Assigned: mounir)

References

Details

(Keywords: dataloss)

Attachments

(2 files, 1 obsolete file)

Build: B2G 18 1/15/2013
Device: Unagi

Steps:

1. Go to http://jds2501.github.com/webapi-permissions-tests/webapi_permissions_test.html
2. Select the desktop notification API test and remember my choice
3. Go to browser settings and clear your storage data
4. Restart the browser
5. Repeat step #1 and step #2

Expected:

A desktop notification should appear.

Actual:

Nothing happens.

Additional Notes:

I'm generally noticing "weird" behavior happening when you clear your storage data and try to reuse an existing site/WebAPI. What's really bad here is that clearing your storage data is supposed help you start with a clean state, but in this case, you are stuck unless you factory reset the phone.
blocking-b2g: --- → tef?
So there's some "strange" behavior happening as a result of clearing storage data. Mounir - Any ideas on why there's some weird behavior going on here?
Flags: needinfo?(mounir)
Attached file Logcat
Looks like there may be more than one bug here. I'm seeing really not so nice things in the logcat after trying to use the browser after clearing storage data.

01-15 13:52:33.349: E/GeckoConsole(587): [JavaScript Error: "NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [inIDOMUtils.setContentState]" {file: "chrome://global/content/BrowserElementChild.js" line: 1254}]

01-15 13:52:52.619: E/GeckoConsole(109): [JavaScript Error: "NO SETTINGS PERMISSION FOR: app://browser.gaiamobile.org

01-15 13:53:18.779: E/GeckoConsole(109): [JavaScript Error: "TypeError: this.currentTab.dom.reload is not a function" {file: "app://browser.gaiamobile.org/js/browser.js" line: 597}]
Those logcat messages hint that the browser app has lost all of its permissions including settings and access to the Browser API.

Clearing private data in the browser should clear permissions for browser content, but not the browser app itself.
Keywords: dataloss
Flags: needinfo?(mounir)
Ben, I'm facing same kind of issues in bug 829397, could you give a try to this platform patch and see if it fix your issue without breaking permission cleaning?
FWIW that patch looks right to me, but we should get Mounir to look at it.
Attachment #702787 - Flags: review?(mounir)
Can't be permanently breaking permissions.
blocking-b2g: tef? → tef+
Assignee: nobody → poirot.alex
Comment on attachment 702787 [details] [diff] [review]
Bug 830983: Prevent removing in-memory app permissions when deleting only its in-browser permissions.

Review of attachment 702787 [details] [diff] [review]:
-----------------------------------------------------------------

Trivial fix. I'll mark this one since Mounir is traveling.
Attachment #702787 - Flags: review?(mounir) → review+
Isn't that a regression from bug 827050 where we are removing stuff from the DB but not from the memory representation of the PermissionManager? The patch was clearly wrong (if aBrowserOnly=false, we remove no permissions...) and was a hack anyway because we should have change GetPermissionsForApp (the enumerator).

Taking this.
Assignee: poirot.alex → mounir
Blocks: 827050
Status: NEW → ASSIGNED
Component: General → Permission Manager
Product: Boot2Gecko → Core
Hmm I would have put the      

data.permissions[i]->GetHost(host);

and

data.permissions[i]->GetType(type);

after the continue to avoid getting data we're not going to use. But other than that the patch looked correct. If aBrowserOnly=false then all permissions will be removed (which is the uninstall app use) otherwise only the ones that have isInBrowserElement=true will be removed (which are the same that are being deleted from the database).

Are you sure this isn't a test failure (as in the test not being correct, not the function being incorrect)?
Attached patch PatchSplinter Review
Attachment #702787 - Attachment is obsolete: true
Attachment #704124 - Flags: review?(jonas)
Resolved fixed per jst rules - inbound + b2g18.
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Keywords: verifyme
QA Contact: jsmith
Verified on 1/20 build.
Status: RESOLVED → VERIFIED
Keywords: verifyme
Landed on mozilla-b2g18/gaia master prior to the 1/25 branching to mozilla-b2g18_v1_0_0/v1.0.0, updating status-b2g-v1.0.0 to fixed.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: