Closed
Bug 1110546
Opened 10 years ago
Closed 10 years ago
Passing null to Sandbox constructor should create a null principal
Categories
(Core :: XPConnect, defect)
Tracking
()
RESOLVED
FIXED
mozilla37
People
(Reporter: bholley, Assigned: bholley)
Details
(Keywords: dev-doc-complete)
Attachments
(1 file)
2.10 KB,
patch
|
gkrizsanits
:
review+
irakli
:
feedback+
|
Details | Diff | Splinter Review |
The current state of the art for getting a null principal is: Cc["@mozilla.org/nullprincipal;1"].createInstance(Ci.nsIPrincipal); Which is sucky, and encourages people to do things like passing "about:blank" to the sandbox constructor. The C++ API to creating sandboxes actually does the right thing when you pass it null. We just need to make the Cu API not barf.
Assignee | ||
Updated•10 years ago
|
Keywords: dev-doc-needed
Assignee | ||
Comment 1•10 years ago
|
||
Attachment #8535317 -
Flags: superreview?(mrbkap)
Attachment #8535317 -
Flags: review?(gkrizsanits)
Assignee | ||
Comment 2•10 years ago
|
||
https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=0fc2543dad95
Comment 3•10 years ago
|
||
Comment on attachment 8535317 [details] [diff] [review] Allow null as the principal argument for the sandbox constructor. v1 Review of attachment 8535317 [details] [diff] [review]: ----------------------------------------------------------------- Not a big fun of using js Null as an argument in general, but the current alternative is indeed painfully complicated for such a simple thing... Ideally the API would only take the options object and then we could just default the nullprincipal, but we are too late for that change. Another option would be to change the string parsing function and let it parse "null-principal" and "system-principal" (or just "null"/"system") strings, but since system is always easy in practice (we just pass in |this|) I'm fine with this. (little bit still leaning toward the string based approach because I believe passing Null in JS is a lot less conventional than in C++ but I leave this up to you to decide)
Attachment #8535317 -
Flags: review?(gkrizsanits) → review+
Assignee | ||
Comment 4•10 years ago
|
||
Comment on attachment 8535317 [details] [diff] [review] Allow null as the principal argument for the sandbox constructor. v1 Irakli, any thoughts on this as an API?
Attachment #8535317 -
Flags: feedback?(rFobic)
Comment 5•10 years ago
|
||
Comment on attachment 8535317 [details] [diff] [review] Allow null as the principal argument for the sandbox constructor. v1 Review of attachment 8535317 [details] [diff] [review]: ----------------------------------------------------------------- Seems reasonable to me & I don't expect that to break anything on SDK side. Although I have to say I would much rather have API like `Sandbox({ wantComponents: false, principal: window })` that way if `principal` omitted it can default to null principal (I presume number of passed args can be used to support legacy API as well). Another option to make gabro happy would be to built upon expanded principal and treat `Sandbox([])` as null principal. Either way all of the options seem good enough to me.
Attachment #8535317 -
Flags: feedback?(rFobic) → feedback+
Assignee | ||
Comment 6•10 years ago
|
||
Comment on attachment 8535317 [details] [diff] [review] Allow null as the principal argument for the sandbox constructor. v1 sr timeout. Pushing to inbound. https://hg.mozilla.org/integration/mozilla-inbound/rev/36f9d3196503
Attachment #8535317 -
Flags: superreview?(mrbkap)
Comment 7•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/36f9d3196503
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
Comment 8•9 years ago
|
||
I've added this, and cleaned up the stuff on specifying principals while I'm about it: https://developer.mozilla.org/en-US/docs/Components.utils.Sandbox#principal. Gabor, would you mind taking a look?
Flags: needinfo?(gkrizsanits)
Comment 9•9 years ago
|
||
(In reply to Will Bamberg [:wbamberg] from comment #8) > I've added this, and cleaned up the stuff on specifying principals while I'm > about it: > https://developer.mozilla.org/en-US/docs/Components.utils.Sandbox#principal. > > Gabor, would you mind taking a look? This looks perfect, thanks Will.
Flags: needinfo?(gkrizsanits)
Updated•9 years ago
|
Keywords: dev-doc-needed → dev-doc-complete
You need to log in
before you can comment on or make changes to this bug.
Description
•