[tor-commits] [tor-browser/tor-browser-45.4.0esr-6.5-1] Bug 1273371, don't use the searchbar for this test, instead use a separate textbox, r=gijs

gk at torproject.org gk at torproject.org
Fri Oct 28 07:03:33 UTC 2016


commit 0aa148499aaa1748036e9e89567c6e709dd16dbc
Author: Neil Deakin <neil at mozilla.com>
Date:   Mon Oct 17 13:55:16 2016 -0400

    Bug 1273371, don't use the searchbar for this test, instead use a separate textbox, r=gijs
    
    This and the previous two commits fix bug 20442 in our bug tracker.
---
 .../test/general/browser_clipboard_pastefile.js     | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/browser/base/content/test/general/browser_clipboard_pastefile.js b/browser/base/content/test/general/browser_clipboard_pastefile.js
index 094628f..55acc2b 100644
--- a/browser/base/content/test/general/browser_clipboard_pastefile.js
+++ b/browser/base/content/test/general/browser_clipboard_pastefile.js
@@ -2,15 +2,16 @@
 // event.clipboardData.
 
 add_task(function*() {
-  var searchbar = document.getElementById("searchbar");
+  var textbox = document.createElement("textbox");
+  document.documentElement.appendChild(textbox);
 
-  searchbar.focus();
-  searchbar.value = "Text";
-  searchbar.select();
+  textbox.focus();
+  textbox.value = "Text";
+  textbox.select();
 
   yield new Promise((resolve, reject) => {
-    searchbar.addEventListener("copy", function copyEvent(event) {
-      searchbar.removeEventListener("copy", copyEvent, true);
+    textbox.addEventListener("copy", function copyEvent(event) {
+      textbox.removeEventListener("copy", copyEvent, true);
       event.clipboardData.setData("text/plain", "Alternate");
       // For this test, it doesn't matter that the file isn't actually a file.
       event.clipboardData.setData("application/x-moz-file", "Sample");
@@ -36,11 +37,11 @@ add_task(function*() {
   });
   is (output, "Passed", "Paste file");
 
-  searchbar.focus();
+  textbox.focus();
 
   yield new Promise((resolve, reject) => {
-    searchbar.addEventListener("paste", function copyEvent(event) {
-      searchbar.removeEventListener("paste", copyEvent, true);
+    textbox.addEventListener("paste", function copyEvent(event) {
+      textbox.removeEventListener("paste", copyEvent, true);
 
       let dt = event.clipboardData;
       is(dt.types.length, 3, "number of types");
@@ -55,5 +56,7 @@ add_task(function*() {
     EventUtils.synthesizeKey("v", { accelKey: true });
   });
 
+  document.documentElement.removeChild(textbox);
+
   yield BrowserTestUtils.removeTab(tab);
 });



More information about the tor-commits mailing list