From 0d35fc58e0c191629fa5a3ca55729670f2b8833d Mon Sep 17 00:00:00 2001 From: Pale Moon Date: Sat, 21 Jan 2017 18:07:32 +0100 Subject: [PATCH] Add a check if the URL bar selection is fired from user-input. This overrides the spec for input elements to special-case where we're not actually having the user select anything, but where it results from automatically-generated selections (e.g. autofill). This should fix #852, but will require Linux testing since Windows doesn't use a primary this way. --- browser/base/content/urlbarBindings.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/browser/base/content/urlbarBindings.xml b/browser/base/content/urlbarBindings.xml index 53755077d8..a39d4e312e 100644 --- a/browser/base/content/urlbarBindings.xml +++ b/browser/base/content/urlbarBindings.xml @@ -741,6 +741,13 @@ .getService(Ci.nsIClipboard) .supportsSelectionClipboard()) return; + + // Check if this selection was actually user-generated, and exit if not + // to prevent copying the selection (e.g autofill) to clipboard/primary + if (!window.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIDOMWindowUtils) + .isHandlingUserInput) + return; var val = this._getSelectedValueForClipboard(); if (!val)