Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Update 'Contributors' section automatically in about:nightly. Fixes #58. #85

Closed
wants to merge 10 commits into from

3 participants

Szabolcs Hubai Henrik Skupin Jorge Villalobos
Szabolcs Hubai
Owner

Hi!

This pull request contains:

  • fix for automatically filling Contributors
  • little styling fix for Songbird (it lacks of chrome://global/skin/about.css)
  • some fix for Nightly Tester Tools links
xabolcs added some commits
extension/chrome/content/aboutNightly/aboutNightly.js
((4 lines not shown))
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Nightly Tester Tools.
+ *
+ * The Initial Developer of the Original Code is
+ * Dave Townsend <dtownsend@oxymoronical.com>.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 2007
Henrik Skupin Owner
whimboo added a note

This credit goes to you. Also please update the year. I hope that we can have a patch for the MPL2 license soon. Would you be interested in doing that?

Szabolcs Hubai Owner
xabolcs added a note

whimboo commented on commit

I hope that we can have a patch for the MPL2 license soon. Would you be interested in doing that?

Sure!
I'd like to provide a file list with three element in the MPL2 issue (#39) before creating the commit:

  • files with new boilerplate
  • files with changed boilerplate
  • files with no boilerplate

Of course all files would came from extension directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
extension/chrome/content/aboutNightly/aboutNightly.js
((26 lines not shown))
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+
+const ourAddonID = "{8620c15f-30dc-4dba-a131-7c5d20cf4a29}";
Henrik Skupin Owner
whimboo added a note

That reminds me that we should move away from a guid and use a name like 'nightlytestertools@mozilla.org' for the id. Would you mind filing an issue for it?

Beside that I think we can remove the 'our' prefix of the constant. Further please make it all capital letters.

Szabolcs Hubai Owner
xabolcs added a note

whimboo wrote

... we should move away from a guid ...

Hmm. IMHO that will cause a new addon. How do You migrate 100k users?
CCing @jvillalobos to help count our possibilities about this move.

Henrik Skupin Owner
whimboo added a note

No, it will not. With Firefox 4 we included the feature to change the add-on id with the update.rdf. I'm fairly sure AMO supports that.

No, AMO doesn't support changing IDs. It's best that you stick to the one you have.

Henrik Skupin Owner
whimboo added a note

Do you have a bug open for AMO to support changing the pref? If not i would like to file one.

None that I know of. This is too much of an edge case and too much of an inconvenience (messes up blocklisting, stats, etc.) for it to be a priority.

Henrik Skupin Owner
whimboo added a note

Makes sense. In any way I have filed is as Bug 765717.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
extension/chrome/content/aboutNightly/aboutNightly.js
((32 lines not shown))
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+
+const ourAddonID = "{8620c15f-30dc-4dba-a131-7c5d20cf4a29}";
+
+
+function init() {
+ var has_EM = "@mozilla.org/extensions/manager;1" in Components.classes;
+ if (has_EM) {
+ extensionLoader();
Henrik Skupin Owner
whimboo added a note

we don't need the extra variable here. Just add the check directly to the if condition.

Henrik Skupin Owner
whimboo added a note

Or better directly try to import 'resource://gre/modules/AddonManager.jsm' and put a try/catch around. That way we can kill the other two functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
extension/chrome/content/aboutNightly/aboutNightly.js
((45 lines not shown))
+ var has_EM = "@mozilla.org/extensions/manager;1" in Components.classes;
+ if (has_EM) {
+ extensionLoader();
+ } else {
+ addonLoader();
+ }
+}
+
+function fillContributorsCB(addon) {
+ appendToList("about", "about", [ addon.creator ], "label");
+ appendToList("contributors", "contributorsList", addon.contributors, "li");
+}
+
+function addonLoader() {
+ Components.utils.import("resource://gre/modules/AddonManager.jsm");
+ AddonManager.getAddonByID(ourAddonID, function(addon) {
Henrik Skupin Owner
whimboo added a note

nit: function ( and can we start making use of an 'a' prefix for parameters? Given that file is new we could find our coding styles here. What do you think?

Szabolcs Hubai Owner
xabolcs added a note

whimboo

... Given that file is new we could find our coding styles here. What do you think?

Sure!
Then please nit all kind of styles here which doesn't fit! Of course You could also comment on #87.

Henrik Skupin Owner
whimboo added a note

I will do it here and you can sync it with issue #87 later. I think that's a good way. Before I do it I will wait for another update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
extension/chrome/content/aboutNightly/aboutNightly.js
((60 lines not shown))
+ AddonManager.getAddonByID(ourAddonID, function(addon) {
+ fillContributorsCB(addon);
+ });
+}
+
+function extensionLoader() {
+ function EM_NS(aProperty)
+ {
+ return "http://www.mozilla.org/2004/em-rdf#" + aProperty;
+ }
+
+ var em = Cc['@mozilla.org/extensions/manager;1']
+ .getService(Ci.nsIExtensionManager);
+ var rdfs = Cc["@mozilla.org/rdf/rdf-service;1"]
+ .getService(Ci.nsIRDFService);
+ var ds = em.datasource;
Henrik Skupin Owner
whimboo added a note

That should better align with Cc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
extension/chrome/content/aboutNightly/aboutNightly.js
((66 lines not shown))
+ function EM_NS(aProperty)
+ {
+ return "http://www.mozilla.org/2004/em-rdf#" + aProperty;
+ }
+
+ var em = Cc['@mozilla.org/extensions/manager;1']
+ .getService(Ci.nsIExtensionManager);
+ var rdfs = Cc["@mozilla.org/rdf/rdf-service;1"]
+ .getService(Ci.nsIRDFService);
+ var ds = em.datasource;
+ var extension = rdfs.GetResource("urn:mozilla:item:" + ourAddonID);
+
+ var addon = {};
+
+ var arc = rdfs.GetResource(EM_NS("homepageURL"));
+ addon.creator = {};
Henrik Skupin Owner
whimboo added a note

please move this up so it doesn't intersect the code flow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
extension/chrome/content/aboutNightly/aboutNightly.js
((82 lines not shown))
+ var homepage = ds.GetTarget(extension, arc, true);
+ if (homepage)
+ addon.creator.url = homepage.QueryInterface(Ci.nsIRDFLiteral).Value;
+
+ arc = rdfs.GetResource(EM_NS("creator"));
+ var creator = ds.GetTarget(extension, arc, true);
+ if (creator)
+ addon.creator.name = creator.QueryInterface(Ci.nsIRDFLiteral).Value;
+
+ arc = rdfs.GetResource(EM_NS("contributor"));
+ var contributors = ds.GetTargets(extension, arc, true);
+ if (contributors.hasMoreElements()) {
+ addon.contributors = [];
+ while (contributors.hasMoreElements()) {
+ var contributor = {};
+ contributor.name = contributors.getNext().QueryInterface(Ci.nsIRDFLiteral).Value;
Henrik Skupin Owner
whimboo added a note

I don't think we need another level here. Contributors only have a name and nothing else. So an array with strings would be sufficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
extension/chrome/content/aboutNightly/aboutNightly.js
((38 lines not shown))
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+
+const ourAddonID = "{8620c15f-30dc-4dba-a131-7c5d20cf4a29}";
+
+
+function init() {
+ var has_EM = "@mozilla.org/extensions/manager;1" in Components.classes;
+ if (has_EM) {
+ extensionLoader();
+ } else {
+ addonLoader();
+ }
+}
+
+function fillContributorsCB(addon) {
Henrik Skupin Owner
whimboo added a note

What is CB? Do we need this?

Szabolcs Hubai Owner
xabolcs added a note

CB is for CallBack.
Should I rename to fillContributorsCallback?

Henrik Skupin Owner
whimboo added a note

Just remove CB because it's not always a callback method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
extension/chrome/content/aboutNightly/aboutNightly.js
((39 lines not shown))
+const Ci = Components.interfaces;
+
+const ourAddonID = "{8620c15f-30dc-4dba-a131-7c5d20cf4a29}";
+
+
+function init() {
+ var has_EM = "@mozilla.org/extensions/manager;1" in Components.classes;
+ if (has_EM) {
+ extensionLoader();
+ } else {
+ addonLoader();
+ }
+}
+
+function fillContributorsCB(addon) {
+ appendToList("about", "about", [ addon.creator ], "label");
Henrik Skupin Owner
whimboo added a note

A bit overhead here. I would suggest to directly replace the element and make not use of appendToList.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
extension/chrome/content/aboutNightly/aboutNightly.js
((40 lines not shown))
+
+const ourAddonID = "{8620c15f-30dc-4dba-a131-7c5d20cf4a29}";
+
+
+function init() {
+ var has_EM = "@mozilla.org/extensions/manager;1" in Components.classes;
+ if (has_EM) {
+ extensionLoader();
+ } else {
+ addonLoader();
+ }
+}
+
+function fillContributorsCB(addon) {
+ appendToList("about", "about", [ addon.creator ], "label");
+ appendToList("contributors", "contributorsList", addon.contributors, "li");
Henrik Skupin Owner
whimboo added a note

I would also suggest we get rid of appendToList and move its code in here. Any reason we need this as a separate function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
extension/chrome/content/aboutNightly/aboutNightly.js
((116 lines not shown))
+ var listElem = document.createElement(aEType);
+ var textContainer = listElem;
+ if (url) {
+ textContainer = document.createElement("a");
+ listElem.appendChild(textContainer);
+ textContainer.href = url;
+ }
+ textContainer.textContent = currentItem.name;
+ node.appendChild(listElem);
+ });
+
+ return aItems.length;
+}
+
+
+window.addEventListener("load", init, false);
Henrik Skupin Owner
whimboo added a note

Please remove the listener in init().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
extension/chrome/content/aboutNightly/aboutNightly.js
((117 lines not shown))
+ var textContainer = listElem;
+ if (url) {
+ textContainer = document.createElement("a");
+ listElem.appendChild(textContainer);
+ textContainer.href = url;
+ }
+ textContainer.textContent = currentItem.name;
+ node.appendChild(listElem);
+ });
+
+ return aItems.length;
+}
+
+
+window.addEventListener("load", init, false);
+
Henrik Skupin Owner
whimboo added a note

nit: please add.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Szabolcs Hubai xabolcs Changes (mostly) based on comments:
- noting myself as initial developer, year
- adding others from cvs and hg blame (the EM stuff, appendToList)
- destructuring assignment to set Ci, Cu, ...
- uppercasing ADDONID
- no more has_EM
- real callback of fillContributorsCallback
- move extensionLoader() to ExtensionManager.getAddonByID()
- ... and it now fills just names, no url for creator
- new line at end of file
- removing event listener
- team changes in install.rdf
ba1062d
Henrik Skupin

nit: just separate both words by an underscore.

Henrik Skupin

You should do the if/else the other way around. Once we drop old features we wouldn't have to rewrite most of the stuff. As mentioned use a try/catch here.

Henrik Skupin
Owner

Otherwise I like that change. Looks good and we can land it soon.

extension/chrome/content/aboutNightly/aboutNightly.js
((45 lines not shown))
+
+
+function init() {
+ window.removeEventListener("load", init, false);
+
+ var haveAM;
+ try {
+ Cu.import("resource://gre/modules/AddonManager.jsm");
+ haveAM = true;
+ } catch(e) {
+ haveAM = false;
+ }
+ if (haveAM) {
+ AddonManager.getAddonByID(ADDON_ID, fillContributorsCallback);
+ } else {
+ ExtensionManager.getAddonByID(ADDON_ID, fillContributorsCallback);
Henrik Skupin Owner
whimboo added a note

There is no need for an if/else condition. Please directly put the code in the above try/catch block.

Szabolcs Hubai Owner
xabolcs added a note

whimboo commented on commit

There is no need for an if/else condition. Please directly put the code in the above try/catch block.

I desagree about that.
haveAM is almost as safe as have_EM was.
But the recommended try ... catch method is more unsafe. It could hide underlying problems. (At least more than haveAM could.)

Henrik Skupin Owner
whimboo added a note

With this method you will not get any other information why the Cu.import() could have been failed. So the code I'm talking about here should be:

'+ try {

  • Cu.import("resource://gre/modules/AddonManager.jsm");
  • AddonManager.getAddonByID(ADDON_ID, fillContributorsCallback);
  • } catch(e) {
  • ExtensionManager.getAddonByID(ADDON_ID, fillContributorsCallback);
  • }`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
extension/chrome/content/aboutNightly/aboutNightly.js
((56 lines not shown))
+ }
+ if (haveAM) {
+ AddonManager.getAddonByID(ADDON_ID, fillContributorsCallback);
+ } else {
+ ExtensionManager.getAddonByID(ADDON_ID, fillContributorsCallback);
+ }
+}
+
+function fillContributorsCallback(aAddon) {
+ appendToList("about", "about", [ aAddon.creator ], "label");
+ appendToList("contributors", "contributorsList", aAddon.contributors, "li");
+}
+
+var ExtensionManager = {
+ getAddonByID: function (aID, aCallback) {
+ if (!aID || typeof aID != "string")
Henrik Skupin Owner
whimboo added a note

Regarding coding style for comparisons... We should also change all of those instances and make use of the triple operator to check for the type too and kill the currently necessary type conversions. That means in this case use !==.

Szabolcs Hubai Owner
xabolcs added a note

Please note that typeof (typeof foobar) === "string" and typeof( Array().length) === "number" ! :)
There aren't any type conversion here ... in the whole aboutNightly.js!
So IMHO no changes needed in

  • typeof aID != "string" near L72
  • typeof aCallback != "function" near L76
  • aItems.length == 0 near L117

Of course if You ask for it, I will change them.

Henrik Skupin Owner
whimboo added a note

It's always safe to have them. It makes it more obvious when you run into conversion issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Szabolcs Hubai
Owner

whimboo commented on commit

With this method you will not get any other information why the Cu.import() could have been failed. ...

Yeah, because of that have I used have_EM.
I know what kind of code are You talking about. IMHO it's not the best pattern/practice.
As I said your try ... catch code is more unsafe like haveAM.
Because with Your method You will not get any other informarion why the Cu.import() or even AddonManager.getAddonByID() could have been failed.

Therefore I proposed the have_EM method: simply in check, without any exception to catch.

Henrik Skupin
Owner

Ah i see. Sure we can fix that by using:

var manager = null;
try:
  var { AddonManager: manager } = Cu.import("resource://gre/modules/AddonManager.jsm");
catch (e) {
  var manager = ExtensionManager;
}

if (manager) {
  ...
} else {
  throw whatever we want to report.
}
Szabolcs Hubai
Owner

whimboo commented on commit

Ah i see. Sure we can fix that by using ...

Thanks, this is more acceptable for me. :)

Szabolcs Hubai
Owner

Added commit d991c7f containing:

  • EM / AM changed to manager as recommended
  • no changes to comparisons - see my comment above!
extension/chrome/content/aboutNightly/aboutNightly.js
((37 lines not shown))
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
+
+const ADDON_ID = "{8620c15f-30dc-4dba-a131-7c5d20cf4a29}";
+
+
+function init() {
+ window.removeEventListener("load", init, false);
+
+ var manager = null;
+ try {
+ var { AddonManager: manager } = Cu.import("resource://gre/modules/AddonManager.jsm");
Henrik Skupin Owner
whimboo added a note

That would redeclare manager which already exists since line 50. We should simply remove the var here. I would assume that will work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
extension/chrome/content/aboutNightly/aboutNightly.js
((39 lines not shown))
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
+
+const ADDON_ID = "{8620c15f-30dc-4dba-a131-7c5d20cf4a29}";
+
+
+function init() {
+ window.removeEventListener("load", init, false);
+
+ var manager = null;
+ try {
+ var { AddonManager: manager } = Cu.import("resource://gre/modules/AddonManager.jsm");
+ } catch (e) {
+ var manager = ExtensionManager;
Henrik Skupin Owner
whimboo added a note

Same here. Or remove the declaration in line 50.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
extension/chrome/content/aboutNightly/aboutNightly.js
((47 lines not shown))
+function init() {
+ window.removeEventListener("load", init, false);
+
+ var manager = null;
+ try {
+ var { AddonManager: manager } = Cu.import("resource://gre/modules/AddonManager.jsm");
+ } catch (e) {
+ var manager = ExtensionManager;
+ }
+
+ if (manager) {
+ manager.getAddonByID(ADDON_ID, fillContributorsCallback);
+ } else {
+ throw Components.Exception("no usable Manager found",
+ Cr.NS_ERROR_NOT_IMPLEMENTED);
+ }
Henrik Skupin Owner
whimboo added a note

Actually to be honest, when would we fail? It should never happen except syntax failures in the ExtensionManager class we would see in either way. I don't see a reason for the else case here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Szabolcs Hubai
Owner

@whimboo:
added commits with changes:

  • strict checks: === and !==
  • do not define manager at L50:
  • not checking the existence of manager near L57: else is removed by Your comments, if is removed because I would avoid silent fails if something is wrong near before.
extension/chrome/content/aboutNightly/aboutNightly.js
((52 lines not shown))
+ } catch (e) {
+ var manager = ExtensionManager;
+ }
+
+ manager.getAddonByID(ADDON_ID, fillContributorsCallback);
+}
+
+function fillContributorsCallback(aAddon) {
+ appendToList("about", "about", [ aAddon.creator ], "label");
+ appendToList("contributors", "contributorsList", aAddon.contributors, "li");
+}
+
+var ExtensionManager = {
+ getAddonByID: function (aID, aCallback) {
+ if (!aID || typeof aID !== "string")
+ throw Components.Exception("aID must be a non-empty string",
Henrik Skupin Owner
whimboo added a note

Reading through the docs for Components.Exception it tells me that those should be used for XPCOM components. Here we do not have a XPCOM component implemented in JS so I think we should better throw an Error.

Szabolcs Hubai Owner
xabolcs added a note

I decided to use Components.Exception based on Bug 757663 comment 3, to be consistent with AddonManager. For the details see Bug 759642!

Henrik Skupin Owner
whimboo added a note

Chatted with unfocused about it and as he mentioned we can even safely make use of Components.Exception in our js modules. So we are good here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
extension/chrome/content/aboutNightly/aboutNightly.js
((57 lines not shown))
+}
+
+function fillContributorsCallback(aAddon) {
+ appendToList("about", "about", [ aAddon.creator ], "label");
+ appendToList("contributors", "contributorsList", aAddon.contributors, "li");
+}
+
+var ExtensionManager = {
+ getAddonByID: function (aID, aCallback) {
+ if (!aID || typeof aID !== "string")
+ throw Components.Exception("aID must be a non-empty string",
+ Cr.NS_ERROR_INVALID_ARG);
+
+ if (typeof aCallback !== "function")
+ throw Components.Exception("aCallback must be a function",
+ Cr.NS_ERROR_INVALID_ARG);
Henrik Skupin Owner
whimboo added a note

Same as above.

Henrik Skupin Owner
whimboo added a note

Also please add brackets for single statements within an if/else/for section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
extension/chrome/content/aboutNightly/aboutNightly.js
((60 lines not shown))
+ appendToList("about", "about", [ aAddon.creator ], "label");
+ appendToList("contributors", "contributorsList", aAddon.contributors, "li");
+}
+
+var ExtensionManager = {
+ getAddonByID: function (aID, aCallback) {
+ if (!aID || typeof aID !== "string")
+ throw Components.Exception("aID must be a non-empty string",
+ Cr.NS_ERROR_INVALID_ARG);
+
+ if (typeof aCallback !== "function")
+ throw Components.Exception("aCallback must be a function",
+ Cr.NS_ERROR_INVALID_ARG);
+
+ function EM_NS(aProperty)
+ {
Henrik Skupin Owner
whimboo added a note

Opening bracket at the same line as the function definition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
extension/chrome/content/aboutNightly/aboutNightly.js
((101 lines not shown))
+ }
+
+ aCallback(addon);
+ }
+}
+
+function appendToList(aHeaderId, aNodeId, aItems, aEType) {
+ var header = document.getElementById(aHeaderId);
+ var node = document.getElementById(aNodeId);
+
+ if (!aItems || aItems.length === 0) {
+ header.hidden = true;
+ return 0;
+ }
+
+ aItems.forEach(function (currentItem) {
Henrik Skupin Owner
whimboo added a note

You should use the 'a' prefix also for currentItem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Henrik Skupin whimboo commented on the diff
extension/chrome/skin/aboutNightly/aboutNightly-sb.css
((38 lines not shown))
+}
+
+ul {
+ margin: 0;
+ -moz-margin-start: 1.5em;
+ padding: 0;
+ list-style: square;
+}
+
+ul > li {
+ margin-top: .5em;
+}
+
+th, td {
+ padding: 0 5px;
+}
Henrik Skupin Owner
whimboo added a note

I will trust those styles because I cannot test it in the next time.

Szabolcs Hubai Owner
xabolcs added a note

It was grabbed from chrome://global/skin/about.css. Interestingly Songbird doesn't have one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Henrik Skupin
Owner

With the remaining items fixed we will have a good template for coding styles and we can get the code checked-in. Thanks in advance for the update.

Henrik Skupin
Owner

@xabolcs, would you mind to fix the remaining nits? I kinda would like to get this pushed soon.

Szabolcs Hubai
Owner

whimboo commented:

@xabolcs, would you mind to fix the remaining nits? I kinda would like to get this pushed soon.

I try my best, but I'm currently busy so not sure if I could provide an update this week.

Henrik Skupin
Owner

No worries. Whenever you have time. Thanks!

Szabolcs Hubai xabolcs Issue #58 - addressing comments part 5:
- if brackets
- aCurrentItem
4e7181b
Szabolcs Hubai
Owner

@whimboo, 5th set of commits added.

Henrik Skupin
Owner

Just tested and it looks great! I'm going to merge it now.

Henrik Skupin whimboo closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 12, 2012
  1. Szabolcs Hubai

    Issue #58 - Part 1: move aboutNightly.xhtml to it's own directory

    xabolcs authored
    --HG--
    rename : extension/chrome/content/aboutNightly.xhtml => extension/chrome/content/aboutNightly/aboutNightly.xhtml
  2. Szabolcs Hubai

    Issue #58 - Part 2: fill Contributors automatically by retrieving tho…

    xabolcs authored
    …se from the install.rdf
  3. Szabolcs Hubai
  4. Szabolcs Hubai

    Issue #58 - Part 4: fix NTT links

    xabolcs authored
Commits on Jun 16, 2012
  1. Szabolcs Hubai

    Changes (mostly) based on comments:

    xabolcs authored
    - noting myself as initial developer, year
    - adding others from cvs and hg blame (the EM stuff, appendToList)
    - destructuring assignment to set Ci, Cu, ...
    - uppercasing ADDONID
    - no more has_EM
    - real callback of fillContributorsCallback
    - move extensionLoader() to ExtensionManager.getAddonByID()
    - ... and it now fills just names, no url for creator
    - new line at end of file
    - removing event listener
    - team changes in install.rdf
Commits on Jun 18, 2012
  1. Szabolcs Hubai

    Issue #58 - addressing comments part 2

    xabolcs authored
    - ADDON_ID
    - haveAM
Commits on Jun 19, 2012
  1. Szabolcs Hubai
Commits on Jul 9, 2012
  1. Szabolcs Hubai
  2. Szabolcs Hubai
Commits on Sep 26, 2012
  1. Szabolcs Hubai

    Issue #58 - addressing comments part 5:

    xabolcs authored
    - if brackets
    - aCurrentItem
This page is out of date. Refresh to see the latest.
2  extension/chrome.manifest
View
@@ -35,4 +35,4 @@ overlay chrome://navigator/content/navigator.xul chrome://n
# Songbird chrome
overlay chrome://songbird/content/xul/layoutBaseOverlay.xul chrome://nightly/content/songbirdOverlay.xul application=songbird@songbirdnest.com
-
+override chrome://nightly/skin/aboutNightly/aboutNightly.css chrome://nightly/skin/aboutNightly/aboutNightly-sb.css application=songbird@songbirdnest.com
135 extension/chrome/content/aboutNightly/aboutNightly.js
View
@@ -0,0 +1,135 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Nightly Tester Tools.
+ *
+ * The Initial Developer of the Original Code is
+ * Szabolcs Hubai <szab.hu@gmail.com>.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 2012
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Robert Strong <robert.bugzilla@gmail.com>
+ * Blair McBride <bmcbride@mozilla.com>
+ * Marcos Santiago <littledodgeviper@sbcglobal.net>
+ * Jimmy Phan <jphan9@gmail.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
+
+const ADDON_ID = "{8620c15f-30dc-4dba-a131-7c5d20cf4a29}";
+
+
+function init() {
+ window.removeEventListener("load", init, false);
+
+ try {
+ var { AddonManager: manager } = Cu.import("resource://gre/modules/AddonManager.jsm");
+ } catch (e) {
+ var manager = ExtensionManager;
+ }
+
+ manager.getAddonByID(ADDON_ID, fillContributorsCallback);
+}
+
+function fillContributorsCallback(aAddon) {
+ appendToList("about", "about", [ aAddon.creator ], "label");
+ appendToList("contributors", "contributorsList", aAddon.contributors, "li");
+}
+
+var ExtensionManager = {
+ getAddonByID: function (aID, aCallback) {
+ if (!aID || typeof aID !== "string") {
+ throw Components.Exception("aID must be a non-empty string",
+ Cr.NS_ERROR_INVALID_ARG);
+ }
+
+ if (typeof aCallback !== "function") {
+ throw Components.Exception("aCallback must be a function",
+ Cr.NS_ERROR_INVALID_ARG);
+ }
+
+ function EM_NS(aProperty) {
+ return "http://www.mozilla.org/2004/em-rdf#" + aProperty;
+ }
+
+ var em = Cc['@mozilla.org/extensions/manager;1']
+ .getService(Ci.nsIExtensionManager);
+ var rdfs = Cc["@mozilla.org/rdf/rdf-service;1"]
+ .getService(Ci.nsIRDFService);
+ var ds = em.datasource;
+ var extension = rdfs.GetResource("urn:mozilla:item:" + aID);
+
+ var addon = { creator: {}, contributors: [] };
+
+ arc = rdfs.GetResource(EM_NS("creator"));
+ var creator = ds.GetTarget(extension, arc, true);
+ if (creator) {
+ addon.creator.name = creator.QueryInterface(Ci.nsIRDFLiteral).Value;
+ }
+
+ arc = rdfs.GetResource(EM_NS("contributor"));
+ var contributors = ds.GetTargets(extension, arc, true);
+ if (contributors.hasMoreElements()) {
+ while (contributors.hasMoreElements()) {
+ addon.contributors.push({
+ name: contributors.getNext().QueryInterface(Ci.nsIRDFLiteral).Value
+ });
+ }
+ }
+
+ aCallback(addon);
+ }
+}
+
+function appendToList(aHeaderId, aNodeId, aItems, aEType) {
+ var header = document.getElementById(aHeaderId);
+ var node = document.getElementById(aNodeId);
+
+ if (!aItems || aItems.length === 0) {
+ header.hidden = true;
+ return 0;
+ }
+
+ aItems.forEach(function (aCurrentItem) {
+ var url = aCurrentItem.url;
+ var listElem = document.createElement(aEType);
+ var textContainer = listElem;
+ if (url) {
+ textContainer = document.createElement("a");
+ listElem.appendChild(textContainer);
+ textContainer.href = url;
+ }
+ textContainer.textContent = aCurrentItem.name;
+ node.appendChild(listElem);
+ });
+
+ return aItems.length;
+}
+
+
+window.addEventListener("load", init, false);
18 extension/chrome/content/aboutNightly.xhtml → ...on/chrome/content/aboutNightly/aboutNightly.xhtml
View
@@ -57,24 +57,20 @@
<head>
<title>About Nightly Test Tools</title>
<link rel="stylesheet" href="chrome://global/skin/about.css" type="text/css"/>
+ <link rel="stylesheet" href="chrome://nightly/skin/aboutNightly/aboutNightly.css" type="text/css"/>
+ <script src="chrome://nightly/content/aboutNightly/aboutNightly.js"></script>
</head>
<body>
<h1>About Nightly Tester Tools</h1>
<div id="about"><a name="about"></a>
- Original author:
- <a href="http://www.oxymoronical.com/">
- Dave Townsend
- </a>
+ Author:
</div>
<div id="contributors"><a name="contributors"></a>
<h2>Contributors</h2>
- <ul>
- <li><a href="http://github.com/harthur">harth</a></li>
- <li><a href="http://k0s.org/mozilla">Jeff Hammel</a></li>
- </ul>
+ <ul id="contributorsList" />
</div>
<div id="features"><a name="features"></a>
@@ -100,7 +96,7 @@
</a>
</li>
<li>
- <a href="https://wiki.mozilla.org/Auto-tools/Projects/NightlyTesterTools">
+ <a href="https://wiki.mozilla.org/Auto-tools/Automation_Development/Projects/Addons/NightlyTesterTools">
Wiki
</a>
</li>
@@ -111,12 +107,12 @@
</li>
<li>
- <a href="https://bugzilla.mozilla.org/buglist.cgi?component=Nightly%20Tester%20Tools&amp;product=Other%20Applications&amp;resolution=---">
+ <a href="https://github.com/mozilla/nightlytt/issues">
Bugs and feature requests
</a>
</li>
<li>
- <a href="http://github.com/mozautomation/nightlytt">
+ <a href="https://github.com/mozilla/nightlytt">
Source code
</a>
</li>
53 extension/chrome/skin/aboutNightly/aboutNightly-sb.css
View
@@ -0,0 +1,53 @@
+html {
+ background: -moz-Dialog;
+ padding: 0 1em;
+ font: message-box;
+}
+
+body {
+ color: -moz-FieldText;
+ position: relative;
+ min-width: 330px;
+ max-width: 50em;
+ margin: 4em auto;
+ border: 1px solid ThreeDShadow;
+ -moz-border-radius: 10px;
+ padding: 3em;
+ -moz-padding-start: 30px;
+ background: -moz-Field;
+}
+
+.aboutPageWideContainer {
+ max-width: 80%;
+}
+
+#aboutLogoContainer {
+ border: 1px solid ThreeDLightShadow;
+ width: 300px;
+ margin-bottom: 2em;
+}
+
+img {
+ border: 0;
+}
+
+#version {
+ font-weight: bold;
+ color: #909090;
+ margin: -24px 0 9px 17px;
+}
+
+ul {
+ margin: 0;
+ -moz-margin-start: 1.5em;
+ padding: 0;
+ list-style: square;
+}
+
+ul > li {
+ margin-top: .5em;
+}
+
+th, td {
+ padding: 0 5px;
+}
Henrik Skupin Owner
whimboo added a note

I will trust those styles because I cannot test it in the next time.

Szabolcs Hubai Owner
xabolcs added a note

It was grabbed from chrome://global/skin/about.css. Interestingly Songbird doesn't have one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
0  extension/chrome/skin/aboutNightly/aboutNightly.css
View
No changes.
2  extension/components/aboutNightly.js
View
@@ -16,7 +16,7 @@ AboutNightly.prototype = {
newChannel: function(aURI) {
let ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
- let channel = ios.newChannel("chrome://nightly/content/aboutNightly.xhtml",
+ let channel = ios.newChannel("chrome://nightly/content/aboutNightly/aboutNightly.xhtml",
null, null);
channel.originalURI = aURI;
return channel;
4 extension/install.rdf
View
@@ -13,7 +13,7 @@
<!-- Front End MetaData -->
<em:name>Nightly Tester Tools</em:name>
<em:description>Useful tools for the nightly tester.</em:description>
- <em:creator>Mozilla QA Automation Services</em:creator>
+ <em:creator>Automation Development</em:creator>
<em:contributor>Dave Hunt</em:contributor>
<em:contributor>Dave Townsend (original author)</em:contributor>
<em:contributor>Ed Morley</em:contributor>
@@ -29,7 +29,7 @@
<em:contributor>Tony Mechelynck</em:contributor>
<em:iconURL>chrome://nightly/content/brand/icon.png</em:iconURL>
- <em:homepageURL>https://wiki.mozilla.org/QA/Automation_Services/Projects/Addons/NightlyTesterTools</em:homepageURL>
+ <em:homepageURL>https://wiki.mozilla.org/Auto-tools/Automation_Development/Projects/Addons/NightlyTesterTools</em:homepageURL>
<!-- Firefox version -->
<em:targetApplication>
Something went wrong with that request. Please try again.