Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(515)

Unified Diff: go-back-with-backspace/content_script.js

Issue 2400303003: Update UI and catch executeScript errors now shown in Canary (Closed)
Patch Set: Fix global-replace bug Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..b90e05afe20bdab045c87be64f4f45a63b124315 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 (!options.whitelist.includes(url) && disabledInApplet(target))
Devlin 2016/11/01 15:12:14 nit: seems like the options.whitelist check should
return;
- if (isEditable(document.activeElement))
+ if (isEditable(target))
return;
// Make sure this extension is still active.

Powered by Google App Engine
This is Rietveld 408576698