Closed
Bug 1335890
Opened 8 years ago
Closed 8 years ago
Factor out getting to the Principal from JSContext
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla54
Tracking | Status | |
---|---|---|
firefox54 | --- | fixed |
People
(Reporter: zombie, Assigned: zombie)
Details
Attachments
(1 file)
If I understood Boris's comment in bug 1310318 comment #17, this is something we should do.
Assignee | ||
Comment 1•8 years ago
|
||
I can probably take this next week, provided my understanding above is correct.
Comment hidden (mozreview-request) |
Assignee | ||
Comment 3•8 years ago
|
||
mozreview-review |
Comment on attachment 8833810 [details]
Bug 1335890 - Factor out nsContentUtils::SubjectPrincipal version that takes JSContext
https://reviewboard.mozilla.org/r/109948/#review111068
::: dom/base/nsContentUtils.cpp:2818
(Diff revision 1)
> //
> // So we use a singleton null principal. To avoid it being accidentally
> // inherited and becoming a "real" subject or object principal, we do a
> // release-mode assert during compartment creation against using this
> // principal on an actual global.
> if (!compartment) {
This is my best guess at what each version of SubjectPrincipal() should do. Because of the big comment wall above, this still returns a NullPrincipal without a compartment, even if it marely calls the other version when the JSContext has a compartment (since it requires one).
Assignee | ||
Updated•8 years ago
|
Attachment #8833810 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 4•8 years ago
|
||
Hope this is what you had in mind for a followup Boris?
Assignee: nobody → tomica
Status: NEW → ASSIGNED
Comment 5•8 years ago
|
||
mozreview-review |
Comment on attachment 8833810 [details]
Bug 1335890 - Factor out nsContentUtils::SubjectPrincipal version that takes JSContext
https://reviewboard.mozilla.org/r/109948/#review111184
r=me with the one nit below. Thank you!
::: dom/base/nsContentUtils.cpp:2082
(Diff revision 1)
>
> // static
> bool
> nsContentUtils::CallerHasPermission(JSContext* aCx, const nsAString& aPerm)
> {
> // Chrome gets access by default.
So I think we should just make CallerHasPermission call PrincipalHasPermission(SubjectPrincipal(aCx)), and we should add such a PrincipalHasPermission.
Then we can also call that from nsContentUtils::IsCutCopyAllowed.
Attachment #8833810 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 6•8 years ago
|
||
mozreview-review |
Comment on attachment 8833810 [details]
Bug 1335890 - Factor out nsContentUtils::SubjectPrincipal version that takes JSContext
https://reviewboard.mozilla.org/r/109948/#review111198
::: dom/base/nsContentUtils.cpp:2082
(Diff revision 1)
>
> // static
> bool
> nsContentUtils::CallerHasPermission(JSContext* aCx, const nsAString& aPerm)
> {
> // Chrome gets access by default.
I meant to do that in the next bug 1312260, where I'll actually need PrincipalHasPermission().
Assignee | ||
Updated•8 years ago
|
Keywords: checkin-needed
Comment hidden (mozreview-request) |
Comment 8•8 years ago
|
||
> I meant to do that in the next bug 1312260, where I'll actually need PrincipalHasPermission().
Works for me!
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/ec252adeb5c3
Factor out nsContentUtils::SubjectPrincipal version that takes JSContext r=bz
Keywords: checkin-needed
Comment 10•8 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox54:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•