| Index: go-back-with-backspace/content_script.js
|
| diff --git a/go-back-with-backspace/content_script.js b/go-back-with-backspace/content_script.js
|
| index cc7fca6218a17ebc7f28b84725daee28d3925a22..c462d5b72188c17320e904d9b4afb98dad8f4bfb 100644
|
| --- a/go-back-with-backspace/content_script.js
|
| +++ b/go-back-with-backspace/content_script.js
|
| @@ -44,14 +44,16 @@ function handleBackspace(e) {
|
| return;
|
|
|
| // The whitelist overrides applet focus.
|
| - // Listening on the Window means the event has no path (see
|
| - // http://crbug.com/645527), so we'll have to look at the focused (active)
|
| - // element. This means it will not work properly with shadow DOM.
|
| - // TODO: Fix behavior with shadow DOM when the above bug is resolved.
|
| - if (!options.whitelist.includes(url) &&
|
| - disabledInApplet(document.activeElement))
|
| + // Before Chrome 55, listening on the Window means the event has no path,
|
| + // instead pointing to the Window (see http://crbug.com/645527). In that
|
| + // case, we have to look at the focused (active) element.
|
| + // TODO: Switch entirely to e.path once Chrome 55 is launched.
|
| + var target = e.path[0];
|
| + if (target === window)
|
| + target = document.activeElement;
|
| + if (disabledInApplet(url, target))
|
| return;
|
| - if (isEditable(document.activeElement))
|
| + if (isEditable(target))
|
| return;
|
|
|
| // Make sure this extension is still active.
|
| @@ -78,9 +80,10 @@ function handleBackspace(e) {
|
| }
|
|
|
| // Return true if the option to disable the extension in applets is enabled,
|
| -// and focus is in an embedded Flash or Java applet.
|
| -function disabledInApplet(target) {
|
| - if (!options.disableInApplets)
|
| +// focus is in an embedded Flash or Java applet, and the current page is not
|
| +// in the whitelist of pages for which that should not apply.
|
| +function disabledInApplet(url, target) {
|
| + if (!options.disableInApplets || options.whitelist.includes(url))
|
| return false;
|
|
|
| var nodeName = target.nodeName.toUpperCase();
|
|
|