Closed Bug 1191653 Opened 9 years ago Closed 9 years ago

Listen to clear-origin-data in nsPermissionManager.cpp

Categories

(Core :: Permission Manager, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla44
Tracking Status
firefox42 --- affected
firefox44 --- fixed

People

(Reporter: allstars.chh, Assigned: allstars.chh)

References

Details

Attachments

(1 file, 3 obsolete files)

We should listen to clear-origin-data instead of webapps-clear-data,

See comments from Jonas in https://bugzilla.mozilla.org/show_bug.cgi?id=1168300#c8
this will also change nsIPermissionManager.removePermissionsForApp, so making this blocks Bug 1179985
Assignee: nobody → allstars.chh
Blocks: 1179985
Comment on attachment 8673535 [details] [diff] [review]
Patch.

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

::: dom/base/ChromeUtils.cpp
@@ +30,5 @@
> +
> +/* static */ bool
> +ChromeUtils::OriginAttributesMatchPattern(const dom::OriginAttributesDictionary& aAttrs,
> +                                          const dom::OriginAttributesPatternDictionary& aPattern)
> +{

Please revert the changes in ChromeUtils, and just use |pattern.Matches| directly in any C++ consumers - there's no reason that code needs to go through ChromeUtils.

::: extensions/cookie/nsPermissionManager.cpp
@@ +7,5 @@
>  #include "mozilla/DebugOnly.h"
>  
>  #include "mozilla/dom/ContentParent.h"
>  #include "mozilla/dom/ContentChild.h"
> +#include "mozilla/dom/ChromeUtils.h"

Please revert this.

@@ +48,5 @@
>  static nsPermissionManager *gPermissionManager = nullptr;
>  
>  using mozilla::dom::ContentParent;
>  using mozilla::dom::ContentChild;
> +using mozilla::dom::ChromeUtils;

And this.

@@ +2321,5 @@
>      if (NS_FAILED(rv)) {
>        continue;
>      }
>  
> +    if (!ChromeUtils::OriginAttributesMatchPattern(mozilla::BasePrincipal::Cast(principal)->OriginAttributesRef(), aPattern)) {

As noted above, please just do:

!aPattern.Matches(mozilla::BasePrincipal::Cast(principal)->OriginAttributesRef());

::: extensions/cookie/nsPermissionManager.h
@@ +205,5 @@
>     */
> +  static void ClearOriginDataObserverInit();
> +
> +  nsresult
> +  RemovePermissionsForOriginAttributes(mozilla::OriginAttributesPattern& aAttrs);

Please call this RemovePermissionsWithAttributes

::: extensions/cookie/test/unit/test_permmanager_cleardata.js
@@ +10,4 @@
>  }
>  
> +// Return the data required by 'clear-origin-data' notification.
> +function getData(aOriginAttributes)

This should be "aPattern", right?

::: netwerk/base/nsIPermissionManager.idl
@@ +238,2 @@
>     */
> +  void removePermissionsForOriginAttributes(in DOMString pattern);

You should specify here that this is JSON. I'd call it "patternAsJSON" or "jsonPattern" or something.
Attachment #8673535 - Flags: review?(bobbyholley) → review+
Attached patch Patch. v2 (obsolete) — Splinter Review
Attachment #8673535 - Attachment is obsolete: true
Attachment #8674104 - Flags: review+
Attached patch Patch. v2Splinter Review
Attachment #8674104 - Attachment is obsolete: true
Attachment #8674119 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/48a895231734
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
Nice job! Thanks Yoshi!
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: