Closed Bug 1280775 Opened 8 years ago Closed 8 years ago

Crash in nsPermissionManager::RemovePermission when removing an already-removed website’s offline data

Categories

(Core :: Permission Manager, defect)

42 Branch
Unspecified
Linux
defect
Not set
critical

Tracking

()

RESOLVED FIXED
mozilla51
Tracking Status
firefox47 --- wontfix
firefox48 --- wontfix
firefox49 --- fix-optional
firefox-esr38 --- unaffected
firefox-esr45 --- affected
firefox50 --- fixed
firefox51 --- fixed

People

(Reporter: bugs, Assigned: aryx)

References

Details

(Keywords: crash, regression, reproducible)

Crash Data

Attachments

(2 files)

This bug was filed from the Socorro interface and is 
report bp-706fdaf9-ae97-4f77-b676-067b22160618.
=============================================================

Steps to reproduce:
- Go to about:preferences > Advanced > Network
- Select a website in “Offline Web Content and User Data”
- Select “Remove…” and press on it twice
- Accept the removal in the first dialog
- On accepting the removal in the second dialog, Firefox will crash.
The problem is reproduce since Firefox42, not on Firefox41.

Seems regressed by Bug 1173523
Blocks: 1173523
Status: UNCONFIRMED → NEW
Has STR: --- → yes
Component: Preferences → Permission Manager
Ever confirmed: true
Flags: needinfo?(michael)
Product: Firefox → Core
and Bug 1201365
Blocks: 1201365
Assignee: nobody → aryx.bugmail
Status: NEW → ASSIGNED
Comment on attachment 8763632 [details]
Bug 1280775 - null check in removePermission to prevent crash: permission manager change.

https://reviewboard.mozilla.org/r/59808/#review56900
Attachment #8763632 - Flags: review?(michael) → review+
Attachment #8763633 - Flags: review?(michael) → review+
Comment on attachment 8763633 [details]
Bug 1280775 - null check in removePermission to prevent crash: add test.

https://reviewboard.mozilla.org/r/59810/#review56904

lgtm
https://reviewboard.mozilla.org/r/59808/#review56902

::: extensions/cookie/nsPermissionManager.cpp:1871
(Diff revision 1)
>  NS_IMETHODIMP
>  nsPermissionManager::RemovePermission(nsIPermission* aPerm)
>  {
> +  if (!aPerm) {
> +    return NS_OK;
> +  }

I don't have a problem with this check, but I think that we should also perform a null check in advanced.js => removeOfflineApp to check that getPermissionObject actually returns a non-null object before trying to call matchesURI or remove the permission.
Flags: needinfo?(michael)
Comment on attachment 8763632 [details]
Bug 1280775 - null check in removePermission to prevent crash: permission manager change.

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/59808/diff/1-2/
Comment on attachment 8763633 [details]
Bug 1280775 - null check in removePermission to prevent crash: add test.

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/59810/diff/1-2/
(In reply to Michael Layzell [:mystor] from comment #7)
> I don't have a problem with this check, but I think that we should also
> perform a null check in advanced.js => removeOfflineApp to check that
> getPermissionObject actually returns a non-null object before trying to call
> matchesURI or remove the permission.
Ok, put that for loop and the removePermission call into an |if (perm)|. I didn't exit the method early so zombie permissions get still removed from the UI at its bottom. The STR with doubleclick don't work for me, so I test like this:
1. Open http://html5demos.com/offlineapp
2. Open Options/Preferences and go to Advanced > Network.
3. Copy the url of the Options tab.
4. Open a second browser window.
5. Paste and load the url from the clipboard.
6. Go to Advanced > Network.
7. Remove permission in one window.
8. Remove permission in other window.
Since this is not a new regression, we'll try to fix it in 48+.
Version: 50 Branch → 42 Branch
What's the current status of this bug? It is probably too late to take a fix for 48 but maybe we can make 49 (aurora)...
Flags: needinfo?(michael)
Flags: needinfo?(aryx.bugmail)
(In reply to David Bolter [:davidb] from comment #12)
> What's the current status of this bug? It is probably too late to take a fix
> for 48 but maybe we can make 49 (aurora)...

I think this patch could land right now.
Flags: needinfo?(michael)
Pushed by archaeopteryx@coole-files.de:
https://hg.mozilla.org/integration/autoland/rev/acc54d397653
null check in removePermission to prevent crash: permission manager change. r=mystor
https://hg.mozilla.org/integration/autoland/rev/489b889ae02f
null check in removePermission to prevent crash: add test. r=mystor
https://hg.mozilla.org/mozilla-central/rev/acc54d397653
https://hg.mozilla.org/mozilla-central/rev/489b889ae02f
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
Comment on attachment 8763632 [details]
Bug 1280775 - null check in removePermission to prevent crash: permission manager change.

Sorry for the unresponsiveness.

Approval Request Comment (also for the attachment with the test)
[Feature/regressing bug #]: bug 1173523
[User impact if declined]: Firefox will crash if requests twice to remove offline data but accepts the confirmation dialogs only after clicking the button twice (edge case)
[Describe test coverage new/current, TreeHerder]: Tested locally, landed on integration and central https://treeherder.mozilla.org/#/jobs?repo=autoland&revision=489b889ae02f182fdf3dd12c0b9e3c470732f674&filter-resultStatus=testfailed&filter-resultStatus=busted&filter-resultStatus=exception&filter-resultStatus=retry&filter-resultStatus=usercancel&filter-resultStatus=running&filter-resultStatus=pending&filter-resultStatus=runnable Also added a test.
[Risks and why]: low (added if conditions and a test)
[String/UUID change made/needed]: none
Attachment #8763632 - Flags: approval-mozilla-aurora?
Comment on attachment 8763632 [details]
Bug 1280775 - null check in removePermission to prevent crash: permission manager change.

Crash fix, Aurora50+
Attachment #8763632 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: