Bookmarklet fails on about:newtab

NEW
Unassigned

Status

()

Firefox
New Tab Page
6 years ago
15 days ago

People

(Reporter: bz, Unassigned)

Tracking

(Depends on: 2 bugs)

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [parity-chrome])

Attachments

(1 attachment)

(Reporter)

Description

6 years ago
Build: anything with bug 723808 fixed.

Steps to reproducs:

1)  Follow instructions at http://lifehacker.com/240552/firefox-tip--how-to-set-up-multi+parameter-keyword-searches

2)  Hit Cmd-N

3)  Type in the bookmark keyword for the bookmark in step 1

ACTUAL RESULTS: JS doesn't run, since it has no principal to do so with

EXPECTED RESULTS: Make it work.

The problem is that about:newtab is system-principal, and we're trying to run the JS against it.

Perhaps we should consider replacing system-principal pages with about:blank before loading javascript: URIs?
(In reply to Boris Zbarsky (:bz) from comment #0)
> Perhaps we should consider replacing system-principal pages with about:blank
> before loading javascript: URIs?

This would be ideal (for more than just this bug), but I was under the impression that it was kind of hard. Or did you mean a front-end fix?
(Reporter)

Comment 2

6 years ago
Does just calling CreateAboutBlankContentViewer() not do the right thing?
Created attachment 600103 [details] [diff] [review]
attempt #1

I'm not confident this patch is suitable to land, but it's a quick hack to test whether this approach would work. It doesn't seem to work (the new tab page stays loaded and the JS doesn't run), but I don't really know why.
Duplicate of this bug: 739387

Updated

5 years ago
Duplicate of this bug: 762626

Comment 6

5 years ago
> Perhaps we should consider replacing system-principal pages with about:blank before 
> loading javascript: URIs?

Another possibility would be to use disallowInheritPrincipal.  Then clicking a bookmarklet on about:newtab would be equivalent to typing a javascript: URL into the address bar (on any page).

Problem is, "location=" and "location.replace" don't seem to work with disallowInheritPrincipal.
Summary: Using a bookmark keyword to a bookmarklet fails on new tabs → Bookmarklet fails on about:newtab
Depends on: 776477

Updated

5 years ago
Duplicate of this bug: 791407

Updated

5 years ago
OS: Mac OS X → All
Depends on: 792532

Updated

5 years ago
Duplicate of this bug: 776560

Comment 9

4 years ago
Workaround: Change the new tab page as described here https://support.mozilla.org/en-US/kb/new-tab-page-show-hide-and-customize-top-sites#w_how-do-i-turn-the-new-tab-page-off

Setting it to e.g. about:blank makes the bookmarklets work again. This is obviously only viable if you think it's acceptable to get a blank page when opening a new tab.
Mass-move to Firefox::New Tab Page.

Filter on new-tab-page-component.
Component: General → New Tab Page
Now that browser.newtab.url has been disabled, imo, this is a great annoiance.
(Reporter)

Comment 12

2 years ago
You should probably just install https://addons.mozilla.org/en-US/firefox/addon/new-tab-override/ for now like I just did, pending bug 776477 getting fixed.
Thanks a lot Boris, this add-on is what I want, perfect :-)

Updated

15 days ago
Duplicate of this bug: 1379699

Updated

15 days ago
Hardware: x86 → All
Whiteboard: [parity-chrome]
You need to log in before you can comment on or make changes to this bug.