Closed
Bug 1484741
Opened 6 years ago
Closed 6 years ago
javascript: bookmarklets via keywords with Alt+Enter no longer work after disallowInheritPrincipal bug 1466801
Categories
(Firefox :: Address Bar, defect, P1)
Tracking
()
RESOLVED
FIXED
Firefox 64
Tracking | Status | |
---|---|---|
firefox-esr60 | --- | unaffected |
firefox61 | --- | unaffected |
firefox62 | --- | unaffected |
firefox63 | + | wontfix |
firefox64 | --- | fixed |
People
(Reporter: janmoesen_=-bugzilla-=+spamtrap, Assigned: jkt)
References
(Blocks 1 open bug)
Details
(Keywords: regression, Whiteboard: [fxsearch])
Attachments
(1 file)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:63.0) Gecko/20100101 Firefox/63.0
Build ID: 20180816220128
Steps to reproduce:
Filing a new bug as per :standard8's request in bug 1483148 comment 5.
Bookmarklets (bookmarks with a javascript: URI) no longer work after disallowInheritPrincipal bug 1466801. Executing those same bookmarklets with a keyword still works. Executing those same bookmarklets with a keyword but in a new tab with Alt+Enter no longer works.
1) Create a bookmarklet with URI: javascript:alert(%s)
2) Give it a keyword: xxx
3) Save
4) In the location bar, enter xxx 1 followed by Enter
5) In the location bar, enter xxx 2 followed by Alt+Enter
Actual results:
4) Pops up an alert box with “1”
5) Opens a new tab, but does not show the alert
Updated•6 years ago
|
Component: Untriaged → Address Bar
Assignee | ||
Updated•6 years ago
|
Blocks: require-triggering-principal
Flags: needinfo?(jkt)
Updated•6 years ago
|
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Priority: -- → P1
Comment 3•6 years ago
|
||
[Tracking Requested - why for this release]:
What's blocking the fix here? This is riding with 63 atm, but given it's a regression I don't think we should be shipping this.
status-firefox61:
--- → unaffected
status-firefox62:
--- → unaffected
status-firefox63:
--- → affected
tracking-firefox63:
--- → ?
Flags: needinfo?(jkt)
Assignee | ||
Comment 4•6 years ago
|
||
Assignee | ||
Updated•6 years ago
|
Flags: needinfo?(jkt)
Updated•6 years ago
|
Keywords: regression
Updated•6 years ago
|
Assignee | ||
Comment 6•6 years ago
|
||
No update currently. I was looking at this last week and got confused by some edge cases that I still need to look into.
Flags: needinfo?(jkt)
Assignee | ||
Comment 7•6 years ago
|
||
So I'm seeing that the contentPrincipal of the about:blank page is a null principal. It looks like we can't create about:blank principals (we explicitly test for this in: caps/tests/unit/test_origin.js).
We call addTab and loadUri into it, loadURIWithOptions
In nsJSProtocolHandler.cpp we check the principal subsumes the object principal before executing and return NS_ERROR_DOM_RETVAL_UNDEFINED because nothing but a system principal executes into null here other than the exact same. (https://searchfox.org/mozilla-central/rev/a23c3959b62cd3f616435e02810988ef5bac9031/dom/jsurl/nsJSProtocolHandler.cpp#249-255)
The submitted solution instead forces allowInheritPrincipal which copies the created null principal of the about:blank page as we can't inherit the system principal (both docshell and the protocol code are preventing this).
I'm leaning on just ignoring the location this should be created into given I don't understand the use-case of doing this really.
> I'm a little confused why this fixes anything. I also think we need to ensure we actually have a principal here, which AFAICT we don't in the normal return case, so presumably then this would inherit system principal, which seems bad. Can you elaborate on how this fix works?
Checking and preventing system in the urlbarBindings to allowInheritPrincipal actually breaks the code as docShell does the right thing for us when the about:blank is created.
I don't think I can pass anything into docshell here that is the correct triggeringPrincipal as my understanding is that docshell is creating the new principal within the load.
I still need to diagnose further how we are passing the correct null principal even when system is passed though to see if we can do something better here.
Assignee | ||
Comment 9•6 years ago
|
||
The code that make this safe is after:
> One more twist: Don't inherit the principal for external loads.
https://searchfox.org/mozilla-central/rev/ce57be88b8aa2ad03ace1b9684cd6c361be5109f/docshell/base/nsDocShell.cpp#9361
:Gijs Unless you have another direction of fixing this, I don't see any alternative to the already submitted patch (minus something more drastic into the docshell code).
Essentially the problem is we create a new tab with a null principal and anything passed in doesn't match that. I think in the long run we should instead pass in a null triggeringPrincipal and create the tab with that.
Flags: needinfo?(jkt) → needinfo?(gijskruitbosch+bugs)
Comment 10•6 years ago
|
||
Comment on attachment 9006191 [details]
Bug 1484741 - Fixing bookmarklet keywords from loading in a new tab.
:Gijs (he/him) has approved the revision.
Attachment #9006191 -
Flags: review+
Updated•6 years ago
|
Flags: needinfo?(gijskruitbosch+bugs)
Comment 11•6 years ago
|
||
Jonathan, do you want to land this patch and then request an uplift to 63?
Flags: needinfo?(jkt)
Updated•6 years ago
|
Whiteboard: [fxsearch]
Assignee | ||
Comment 12•6 years ago
|
||
I personally think we shouldn't uplift the patch I would rather we test it more in Nightly first. Despite the code working I'm not 100% on if we are doing the right thing still.
Sorry for the delay here.
Flags: needinfo?(jkt)
Comment 13•6 years ago
|
||
(In reply to Jonathan Kingston [:jkt] from comment #12)
> I personally think we shouldn't uplift the patch I would rather we test it
> more in Nightly first. Despite the code working I'm not 100% on if we are
> doing the right thing still.
>
> Sorry for the delay here.
This hasn't actually landed on nightly, AFAICT... Did you intend for it to land on 64 nightly? :-)
Flags: needinfo?(jkt)
Assignee | ||
Comment 14•6 years ago
|
||
I triggered it on lando with that comment, it's queued to go in now.
Flags: needinfo?(jkt)
Comment 15•6 years ago
|
||
Pushed by jkingston@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7d8d3fc3e9f4
Fixing bookmarklet keywords from loading in a new tab. r=Gijs
Comment 16•6 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox64:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 64
Updated•6 years ago
|
status-firefox-esr60:
--- → unaffected
Updated•6 years ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•