Closed Bug 1339213 Opened 3 years ago Closed 3 years ago

Inline IsRestrictOpenerAccessForFPI

Categories

(Core :: DOM: Security, defect, P2)

50 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla54
Tracking Status
firefox54 --- fixed

People

(Reporter: smaug, Assigned: smaug)

References

Details

(Whiteboard: [domsecurity-active])

Attachments

(2 files)

IsRestrictOpenerAccessForFPI is called in very hot code paths so better to inline it.

Patch coming.
Assignee: nobody → bugs
Blocks: 1338880
Attached patch v1Splinter Review
privacy.firstparty.isolate.restrict_opener_access part is untested since we don't seem to have tests for it.
Attachment #8836884 - Flags: review?(tihuang)
Comment on attachment 8836884 [details] [diff] [review]
v1

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

::: caps/BasePrincipal.h
@@ +100,5 @@
>    // flags. Once all other flags are removed, this can be removed too.
>    void SyncAttributesWithPrivateBrowsing(bool aInPrivateBrowsing);
>  
>    // check if "privacy.firstparty.isolate" is enabled.
> +  static bool IsFirstPartyEnabled()

I believe that the compiler will optimize for us to make this an inline function. However, I think we should use 'static inline' here to tell the compiler explicitly.

@@ +108,5 @@
>  
>    // check if the access of window.opener across different FPDs is restricted.
>    // We only restrict the access of window.opener when first party isolation
>    // is enabled and "privacy.firstparty.isolate.restrict_opener_access" is on.
> +  static bool IsRestrictOpenerAccessForFPI()

ditto
Attachment #8836884 - Flags: review?(tihuang) → review+
Bug 1339336 has been filed for the test case. Thanks for bringing this up, smaug.
I guess inline does kind of self document the performance sensitiveness, I could add them.
Usually we don't use them with this kind of small methods, but just expect compiler to inline.
Attached patch inline_fpi.diffSplinter Review
Pushed by opettay@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/29784b27d405
Inline IsRestrictOpenerAccessForFPI, r=tihuang
Priority: -- → P2
Whiteboard: [domsecurity-active]
Status: NEW → ASSIGNED
https://hg.mozilla.org/mozilla-central/rev/29784b27d405
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
You need to log in before you can comment on or make changes to this bug.