Bug 1063698 - Add action to UITour.jsm for opening the Reset Firefox dialog. r=Unfocused
authorAlex Bardas <alex.bardas@gmail.com>
Wed, 17 Sep 2014 14:58:00 +0200
changeset 206158 5ac8150b6745644dc5f19591fba05b3995748564
parent 206157 4a0a256c54e227485bef20727f770a6d5f0ca8d7
child 206159 922368bec251bf367257796a6297ca6ca6189560
push id27514
push usercbook@mozilla.com
push dateFri, 19 Sep 2014 12:24:09 +0000
treeherdermozilla-central@3475e6a1665a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersUnfocused
bugs1063698
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1063698 - Add action to UITour.jsm for opening the Reset Firefox dialog. r=Unfocused
browser/modules/UITour.jsm
browser/modules/test/browser.ini
browser/modules/test/browser_UITour_resetProfile.js
browser/modules/test/uitour.js
--- a/browser/modules/UITour.jsm
+++ b/browser/modules/UITour.jsm
@@ -11,16 +11,18 @@ const {classes: Cc, interfaces: Ci, util
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Promise.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeManager",
   "resource://gre/modules/LightweightThemeManager.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "PermissionsUtils",
   "resource://gre/modules/PermissionsUtils.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "ResetProfile",
+  "resource://gre/modules/ResetProfile.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
   "resource:///modules/CustomizableUI.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "UITelemetry",
   "resource://gre/modules/UITelemetry.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "BrowserUITelemetry",
   "resource:///modules/BrowserUITelemetry.jsm");
 
 
@@ -422,16 +424,22 @@ this.UITour = {
 
       case "showFirefoxAccounts": {
         // 'signup' is the only action that makes sense currently, so we don't
         // accept arbitrary actions just to be safe...
         // We want to replace the current tab.
         contentDocument.location.href = "about:accounts?action=signup&entrypoint=uitour";
         break;
       }
+
+      case "resetFirefox": {
+        // Open a reset profile dialog window.
+        ResetProfile.openConfirmationDialog(window);
+        break;
+      }
     }
 
     if (!this.originTabs.has(window))
       this.originTabs.set(window, new Set());
 
     this.originTabs.get(window).add(tab);
     tab.addEventListener("TabClose", this);
     tab.addEventListener("TabBecomingWindow", this);
--- a/browser/modules/test/browser.ini
+++ b/browser/modules/test/browser.ini
@@ -29,11 +29,13 @@ skip-if = e10s # Bug 941428 - UITour.jsm
 [browser_UITour_annotation_size_attributes.js]
 skip-if = e10s # Bug 941428 - UITour.jsm not e10s friendly.
 [browser_UITour_panel_close_annotation.js]
 skip-if = true # Disabled due to frequent failures, bugs 1026310 and 1032137
 [browser_UITour_registerPageID.js]
 skip-if = e10s # Bug 941428 - UITour.jsm not e10s friendly
 [browser_UITour_sync.js]
 skip-if = e10s # Bug 941428 - UITour.jsm not e10s friendly
+[browser_UITour_resetProfile.js]
+skip-if = e10s # Bug 941428 - UITour.jsm not e10s friendly
 [browser_taskbar_preview.js]
 run-if = os == "win"
 skip-if = e10s # Bug 666808 - AeroPeek support for e10s
new file mode 100644
--- /dev/null
+++ b/browser/modules/test/browser_UITour_resetProfile.js
@@ -0,0 +1,39 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+let gTestTab;
+let gContentAPI;
+let gContentWindow;
+
+Components.utils.import("resource:///modules/UITour.jsm");
+
+function test() {
+  UITourTest();
+}
+
+let tests = [
+  // Test that a reset profile dialog appears when "resetFirefox" event is triggered
+  function test_resetFirefox(done) {
+    let winWatcher = Cc["@mozilla.org/embedcomp/window-watcher;1"].
+                     getService(Ci.nsIWindowWatcher);
+    winWatcher.registerNotification(function onOpen(subj, topic, data) {
+      if (topic == "domwindowopened" && subj instanceof Ci.nsIDOMWindow) {
+        subj.addEventListener("load", function onLoad() {
+          subj.removeEventListener("load", onLoad);
+          if (subj.document.documentURI ==
+              "chrome://global/content/resetProfile.xul") {
+            winWatcher.unregisterNotification(onOpen);
+            ok(true, "Observed search manager window open");
+            is(subj.opener, window,
+               "Reset Firefox event opened a reset profile window.");
+            subj.close();
+            done();
+          }
+        });
+      }
+    });
+    gContentAPI.resetFirefox();
+  },
+];
--- a/browser/modules/test/uitour.js
+++ b/browser/modules/test/uitour.js
@@ -174,9 +174,13 @@ if (typeof Mozilla == 'undefined') {
 			configuration: configName,
 		});
 	};
 
 	Mozilla.UITour.showFirefoxAccounts = function() {
 		_sendEvent('showFirefoxAccounts');
 	};
 
+	Mozilla.UITour.resetFirefox = function() {
+		_sendEvent('resetFirefox');
+	};
+
 })();