Bug 1296934 - Prevent background pages from showing up in global history. r=gabor, a=ritu
authorKris Maglione <maglione.k@gmail.com>
Sun, 21 Aug 2016 12:43:50 -0700
changeset 349956 eb26f80b9dc8f05442d16effbb5747afe062676a
parent 349955 1536a4c14d4e6741d5b06fd32f92bb7ee59f601f
child 349957 e3325d1992029b7636ebfcbd1e0ef1fe13d36f46
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgabor, ritu
bugs1296934
milestone50.0a2
Bug 1296934 - Prevent background pages from showing up in global history. r=gabor, a=ritu MozReview-Commit-ID: GRIJwCsfqVB
toolkit/components/extensions/ext-backgroundPage.js
toolkit/components/extensions/test/xpcshell/test_ext_background_global_history.js
toolkit/components/extensions/test/xpcshell/xpcshell.ini
--- a/toolkit/components/extensions/ext-backgroundPage.js
+++ b/toolkit/components/extensions/ext-backgroundPage.js
@@ -58,16 +58,17 @@ BackgroundPage.prototype = {
     // underlying docShell, and `QueryInterface(nsIWebNavigation)` gives us
     // access to the webNav methods that are already available on the
     // windowless browser, but contrary to appearances, they are not the same
     // object.
     let chromeShell = windowlessBrowser.QueryInterface(Ci.nsIInterfaceRequestor)
                                        .getInterface(Ci.nsIDocShell)
                                        .QueryInterface(Ci.nsIWebNavigation);
 
+    chromeShell.useGlobalHistory = false;
     chromeShell.createAboutBlankContentViewer(system);
     chromeShell.loadURI(XUL_URL, 0, null, null, null);
 
 
     yield promiseObserved("chrome-document-global-created",
                           win => win.document == chromeShell.document);
 
     let chromeDoc = yield promiseDocumentLoaded(chromeShell.document);
new file mode 100644
--- /dev/null
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_background_global_history.js
@@ -0,0 +1,22 @@
+/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim: set sts=2 sw=2 et tw=80: */
+"use strict";
+
+Cu.import("resource://testing-common/PlacesTestUtils.jsm");
+
+add_task(function* test_global_history() {
+  let extension = ExtensionTestUtils.loadExtension({
+    background() {
+      browser.test.sendMessage("background-loaded", location.href);
+    },
+  });
+
+  yield extension.startup();
+
+  let backgroundURL = yield extension.awaitMessage("background-loaded");
+
+  yield extension.unload();
+
+  let exists = yield PlacesTestUtils.isPageInDB(backgroundURL);
+  ok(!exists, "Background URL should not be in history database");
+});
--- a/toolkit/components/extensions/test/xpcshell/xpcshell.ini
+++ b/toolkit/components/extensions/test/xpcshell/xpcshell.ini
@@ -9,16 +9,18 @@ support-files =
 [test_csp_custom_policies.js]
 [test_csp_validator.js]
 [test_ext_alarms.js]
 [test_ext_alarms_does_not_fire.js]
 [test_ext_alarms_periodic.js]
 [test_ext_alarms_replaces.js]
 [test_ext_background_generated_load_events.js]
 [test_ext_background_generated_reload.js]
+[test_ext_background_global_history.js]
+skip-if = os == "android" # Android does not use Places for history.
 [test_ext_background_runtime_connect_params.js]
 [test_ext_background_sub_windows.js]
 [test_ext_background_window_properties.js]
 skip-if = os == "android"
 [test_ext_contexts.js]
 [test_ext_downloads.js]
 [test_ext_downloads_download.js]
 skip-if = os == "android"