Skip to content
This repository has been archived by the owner on Apr 2, 2019. It is now read-only.

Commit

Permalink
Merge pull request #50 from mozilla/add-acr-to-comment-27
Browse files Browse the repository at this point in the history
Show e10s status in comment form (fix #27)
  • Loading branch information
tofumatt committed Aug 12, 2016
2 parents afdeae7 + c14523c commit da6b163
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 30 deletions.
7 changes: 7 additions & 0 deletions data/panel.css
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ overflow-x: hidden;
}

#version { color: gray; }
#submitReportButton + .appE10sEnabled {
display: block;
}
.multiProcessEnabled {
display: block;
font-weight: normal;
}
textarea {
resize: none;
width: 100%;
Expand Down
10 changes: 7 additions & 3 deletions data/reporter.htm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h2>Report any issues with add-ons below.</h2>
</div>

<div id="buttons">
<span id="appE10sEnabled"></span>
<span class="appE10sEnabled"></span>
<button id="collectReportsButton">Submit</button>
</div>
</div>
Expand All @@ -39,7 +39,11 @@ <h2>Answering these will make Firefox better for millions of users.</h2>

<div id="details-form">

<h3><span id="addon"> </span> <span id="version"> </span></h3>
<h3>
<span id="addon"> </span>
<span id="version"> </span>
<span class="multiProcessEnabled"> </span>
</h3>

<p style="margin: 0.5em 0">Briefly describe the issues</p>

Expand All @@ -49,6 +53,7 @@ <h3><span id="addon"> </span> <span id="version"> </span></h3>

<div id="buttons">
<button id="submitReportButton">Submit</button>
<span class="appE10sEnabled"></span>
</div>

<div id="spinner" class="result hidden">
Expand Down Expand Up @@ -78,4 +83,3 @@ <h2>Thank you so much for making Firefox a better place.</h2>

</body>
</html>

24 changes: 14 additions & 10 deletions data/reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ var initialize = function(data) {
return;
}

$('.page').hide(); $('#addonslist').show(); $('#addons').empty();
$('.page').hide();
$('#addonslist').show();
$('#addons').empty();

var table = document.getElementById("addons");
$('#spinner').hide();
Expand Down Expand Up @@ -105,16 +107,19 @@ var initialize = function(data) {
document.initialized = true;
};

self.port.on("app_e10s_enabled", function(enabled) {
$("#appE10sEnabled").empty();
var e10s_link = document.createElement("a");
e10s_link.setAttribute("href", "#");
e10s_link.addEventListener("click", function() {
self.port.on("app_e10s_enabled", function(appE10sEnabled, addonE10sEnabled) {
$(".appE10sEnabled").html('<a href="#">Multi-process</a> is ' +
(appE10sEnabled ? '' : 'not ') + 'enabled.');
$(".appE10sEnabled a").on("click", function() {
self.port.emit("openE10sIntroLink");
});

$(".multiProcessEnabled").html(
(addonE10sEnabled ? 'Compatible' : 'Not compatible') +
' with <a href="#">multi-process</a>.');
$(".multiProcessEnabled a").on("click", function() {
self.port.emit("openE10sIntroLink");
});
e10s_link.appendChild(document.createTextNode("Multi-process"));
document.getElementById("appE10sEnabled").appendChild(e10s_link);
document.getElementById("appE10sEnabled").appendChild(document.createTextNode(" is " + (enabled ? "" : "not ") + "enabled."));
});

self.port.on("have_addon_reports", initialize);
Expand Down Expand Up @@ -230,4 +235,3 @@ document.getElementById("collectReportsButton").addEventListener("click", collec
document.getElementById("skipcommenta").addEventListener("click", function() { submitReport(""); }, true);
document.getElementById("submitReportButton").addEventListener("click", function() { submitReport(document.getElementById("details").value); }, true);
document.getElementById("closeButton").addEventListener("click", function() { self.port.emit("user_closed_panel", document.hasAnsweredQuestions); }, true);

1 change: 0 additions & 1 deletion data/submitsinglereport.htm
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,3 @@ <h3><span id="addon"> </span> <span id="version">&nbsp;</span></h3>
</body>

</html>

4 changes: 2 additions & 2 deletions data/submitsinglereport.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ self.port.on("submit_report_success", function(data) {
document.getElementById("success").style.display = 'block';
});

document.getElementById("closeButton").addEventListener("click",
function(e) {
document.getElementById("closeButton").addEventListener("click",
function(e) {
self.port.emit("user_closed_panel");
}, false);
6 changes: 4 additions & 2 deletions lib/acr-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ exports.getLocalStorageForOrigin = function(origin)

return storage;
}
catch (e) { Logger.warn(e); return null; }
catch (e) {
Logger.warn(e);
return null;
}
}

exports.getMostRecentAppWindow = function()
Expand All @@ -155,4 +158,3 @@ exports.getMostRecentAppWindow = function()
.getMostRecentWindow(appWinString);
return appWindow;
}

26 changes: 14 additions & 12 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ else
var { ChromeMod } = require("./chrome-page-mod");

const ALLOW_REPEAT_SUBMISSION = true;
const REPORTER_PANEL_HEIGHT = 250;

ACR.setAMOShowIncompatibleAddons();
ACR.registerAddonListener();
Expand Down Expand Up @@ -96,7 +97,7 @@ function openSubmitSingleReportDialog(addonReport, worker)
contentURL: self.data.url("submitsinglereport.htm"),
contentScriptFile: self.data.url("submitsinglereport.js"),
width: 430,
height: 250
height: 270
});

var data = {
Expand Down Expand Up @@ -238,7 +239,7 @@ if (!prefService.isSet("extensions.acr.donefirstrun"))

var reporterPanel = panel.Panel({
width: 420,
height: 230, // also change below
height: REPORTER_PANEL_HEIGHT,
contentURL: self.data.url("reporter.htm"),
contentScriptFile: [self.data.url("reporter.js"),
self.data.url("lib/jquery-1.7.2.min.js"),
Expand Down Expand Up @@ -288,19 +289,21 @@ reporterPanel.sendAddonReports = function() {
reportsProcessed++;

if (reportsProcessed === addonsCount) {
var by = addonReports.length*55;
if (by>220)
by=220;
if (by<110)
by=110;
let panelSize = 240+(by-110);
var by = addonReports.length * 55;
if (by > 220)
by = 220;
if (by < 110)
by = 110;
let panelSize = REPORTER_PANEL_HEIGHT + 10 + (by - 110);
let scrollSize = (by);
ACR.Logger.log("Panel size = "+panelSize);
ACR.Logger.log("Scroll size = "+scrollSize);
ACR.Logger.log("Panel size = " + panelSize);
ACR.Logger.log("Scroll size = " + scrollSize);
reporterPanel.resize(reporterPanel.width, panelSize);
reporterPanel.port.emit("set_scroller_height", scrollSize);
reporterPanel.port.emit("have_addon_reports", addonReports);
reporterPanel.port.emit("app_e10s_enabled", ACR.Util.getHostEnvironmentInfo().multiprocessEnabled);
reporterPanel.port.emit("app_e10s_enabled",
ACR.Util.getHostEnvironmentInfo().multiprocessEnabled,
addonReport.multiprocessCompatible);
}
});
}
Expand Down Expand Up @@ -437,4 +440,3 @@ events.on("acr_prompt_for_reports", function () {
ACR.Logger.log("ACR is running.");

//Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator).getMostRecentWindow("navigator:browser").moveBy(300,0);

0 comments on commit da6b163

Please sign in to comment.