Closed Bug 980777 Opened 10 years ago Closed 10 years ago

JavaScript can trap and disable core browser functionality like Ctrl+W, Ctrl+N

Categories

(Firefox :: Untriaged, defect)

29 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 380637

People

(Reporter: mozilla.org, Unassigned)

References

()

Details

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:29.0) Gecko/20100101 Firefox/29.0 (Beta/Release)
Build ID: 20140305110602

Steps to reproduce:

Visit http://www.hardwaresecrets.com/

Try using Ctrl+W to close the tab. In fact, try closing the tab without using your mouse/touchscreen.


Actual results:

Nothing happens when Ctrl+W is pressed.

The page has a script, disableCtrlKeyCombination(), that traps certain Ctrl-combinations, among them Ctrl-N and Ctrl-W, and simply returns. This prevents browser functionality used by keyboard (and keyboard-only) users.


Expected results:

Ctrl-W should close the tab.

There is no obvious way to close the tab from the keyboard without Ctrl-W, apart from closing all other tabs and then using Alt+F4.
(In reply to comment #0)
> There is no obvious way to close the tab from the keyboard without Ctrl-W,
> apart from closing all other tabs and then using Alt+F4.
One workaround I found is Ctrl-Shift-I, selecting the "Toolbox Options" gear, then ticking the "Disable Javascript" checkbox, and Ctrl-W will work again. There needs be a better way to get to that option with the keyboard.
I suppose the user could use a bookmark or the URL bar to navigate away from the page, or globally disable JavaScript (if that's still an option in the Settings dialog), or reload the page and hit escape before it completed reloading, but these bend-over-backwards solutions didn't occur to me at the time.
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
(In reply to mozilla.org from comment #2)
> I suppose the user could use a bookmark or globally disable JavaScript
A combination of these is to bookmark the following URL
about:config?filter=javascript.enabled
then click that bookmark when on the site, double-click that pref line to toggle javascript off globally, and just click the Back button to return to the site.

The previous workaround I mentioned just for the site is better than disabling it globally though, and someone else found the bug this is a dupe of before me.
(In reply to Mardeg from comment #4)

> A combination of these is to bookmark the following URL
> about:config?filter=javascript.enabled
> then click that bookmark when on the site, double-click that pref line to
> toggle javascript off globally, and just click the Back button to return to
> the site.

Toggling JavaScript off and on is (much) easier to do with the (life saver) extension QuickJS : https://addons.mozilla.org/fr/firefox/addon/quickjs/ 

However, without the bug we wouldn't have to do to that.
You need to log in before you can comment on or make changes to this bug.