Bug 596427 - [Feedback] : The add URL of last visited page does not auto fill the last visited page [r=mbrubeck]

This commit is contained in:
Mark Finkle 2010-09-15 00:34:38 -04:00
Родитель 0aad30d4ef
Коммит 4a142ed90c
2 изменённых файлов: 16 добавлений и 2 удалений

Просмотреть файл

@ -40,6 +40,9 @@ var Feedback = {
let appInfo = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo);
document.getElementById("feedback-about").setAttribute("desc", appInfo.version);
// A simple frame script to fill in the referrer page
messageManager.loadFrameScript("data:,addMessageListener('Feedback:InitPage', function(m) { content.document.getElementById('id_url').value = m.json.referrer; });", true);
// Try to delay the widget initialization during startup
messageManager.addMessageListener("DOMContentLoaded", function() {
// We only want to delay one time
@ -50,6 +53,17 @@ var Feedback = {
});
},
openFeedback: function(aURL) {
let currentURL = Browser.selectedBrowser.currentURI.spec;
let newTab = BrowserUI.newTab(aURL);
// Tell the feedback page to fill in the referrer URL
newTab.browser.messageManager.addMessageListener("DOMContentLoaded", function() {
newTab.browser.messageManager.removeMessageListener("DOMContentLoaded", arguments.callee, true);
newTab.browser.messageManager.sendAsyncMessage("Feedback:InitPage", { referrer: currentURL });
});
},
openReadme: function() {
let formatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"].getService(Ci.nsIURLFormatter);
let url = formatter.formatURLPref("app.releaseNotesURL");

Просмотреть файл

@ -60,8 +60,8 @@
<richlistbox id="feedback-list" flex="1" onselect="this.ensureSelectedElementIsVisible()">
<settings id="feedback-communicate" label="&feedback.communicate.title;">
<setting title="&feedback.feedback.title;" type="control">
<button id="feedback-feedback-happy" class="button-dark" oncommand="BrowserUI.newTab('http://m.input.mozilla.com/en-US/happy');"/>
<button id="feedback-feedback-sad" class="button-dark" oncommand="BrowserUI.newTab('http://m.input.mozilla.com/en-US/sad');"/>
<button id="feedback-feedback-happy" class="button-dark" oncommand="Feedback.openFeedback('http://m.input.mozilla.com/en-US/happy');"/>
<button id="feedback-feedback-sad" class="button-dark" oncommand="Feedback.openFeedback('http://m.input.mozilla.com/en-US/sad');"/>
</setting>
</settings>
<settings id="feedback-information" label="&feedback.information.title;">