diff --git a/mobile/android/base/BrowserApp.java b/mobile/android/base/BrowserApp.java index 6b61d3a79f83..284164951059 100644 --- a/mobile/android/base/BrowserApp.java +++ b/mobile/android/base/BrowserApp.java @@ -1668,7 +1668,7 @@ abstract public class BrowserApp extends GeckoApp @Override public void onPostExecute(Boolean shouldShowFeedbackPage) { if (shouldShowFeedbackPage) - Tabs.getInstance().loadUrlInTab("about:feedback"); + GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Feedback:Show", null)); } }).execute(); } diff --git a/mobile/android/chrome/content/Feedback.js b/mobile/android/chrome/content/Feedback.js new file mode 100644 index 000000000000..05fdd78c0754 --- /dev/null +++ b/mobile/android/chrome/content/Feedback.js @@ -0,0 +1,18 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ +"use strict"; + +var Feedback = { + observe: function(aMessage, aTopic, aData) { + if (aTopic !== "Feedback:Show") + return; + + // Only prompt for feedback if this isn't a distribution build. + try { + Services.prefs.getCharPref("distribution.id"); + } catch (e) { + BrowserApp.addTab("about:feedback", { selected: true, parentId: BrowserApp.selectedTab.id }); + } + } +}; diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index 54452db59d49..8e3101b0e4a7 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -107,6 +107,7 @@ var LazyNotificationGetter = { ["FindHelper", ["FindInPage:Find", "FindInPage:Prev", "FindInPage:Next", "FindInPage:Closed", "Tab:Selected"], "chrome://browser/content/FindHelper.js"], ["PermissionsHelper", ["Permissions:Get", "Permissions:Clear"], "chrome://browser/content/PermissionsHelper.js"], ["FeedHandler", ["Feeds:Subscribe"], "chrome://browser/content/FeedHandler.js"], + ["Feedback", ["Feedback:Show"], "chrome://browser/content/Feedback.js"], ].forEach(function (aScript) { let [name, notifications, script] = aScript; XPCOMUtils.defineLazyGetter(window, name, function() { diff --git a/mobile/android/chrome/jar.mn b/mobile/android/chrome/jar.mn index b77dfc51cb7e..9b7919cf0cd1 100644 --- a/mobile/android/chrome/jar.mn +++ b/mobile/android/chrome/jar.mn @@ -49,6 +49,7 @@ chrome.jar: content/FindHelper.js (content/FindHelper.js) content/PermissionsHelper.js (content/PermissionsHelper.js) content/FeedHandler.js (content/FeedHandler.js) + content/Feedback.js (content/Feedback.js) #ifdef MOZ_SERVICES_HEALTHREPORT content/aboutHealthReport.xhtml (content/aboutHealthReport.xhtml) * content/aboutHealthReport.js (content/aboutHealthReport.js)