Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed

Conversation

xabolcs
Copy link
Collaborator

@xabolcs xabolcs commented Jun 12, 2012

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

--HG--
rename : extension/chrome/content/aboutNightly.xhtml => extension/chrome/content/aboutNightly/aboutNightly.xhtml
* The Initial Developer of the Original Code is
* Dave Townsend <dtownsend@oxymoronical.com>.
*
* Portions created by the Initial Developer are Copyright (C) 2007
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

- 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
@whimboo
Copy link
Contributor

whimboo commented Jun 18, 2012

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

if (haveAM) {
AddonManager.getAddonByID(ADDON_ID, fillContributorsCallback);
} else {
ExtensionManager.getAddonByID(ADDON_ID, fillContributorsCallback);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
  • }`

@xabolcs
Copy link
Collaborator Author

xabolcs commented Jun 19, 2012

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.

@whimboo
Copy link
Contributor

whimboo commented Jun 19, 2012

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.
}

@xabolcs
Copy link
Collaborator Author

xabolcs commented Jun 19, 2012

whimboo commented on commit

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

Thanks, this is more acceptable for me. :)

@xabolcs
Copy link
Collaborator Author

xabolcs commented Jun 19, 2012

Added commit d991c7f containing:

  • EM / AM changed to manager as recommended
  • no changes to comparisons - see my comment above!


var manager = null;
try {
var { AddonManager: manager } = Cu.import("resource://gre/modules/AddonManager.jsm");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

} else {
throw Components.Exception("no usable Manager found",
Cr.NS_ERROR_NOT_IMPLEMENTED);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@xabolcs
Copy link
Collaborator Author

xabolcs commented Jul 9, 2012

@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.

var ExtensionManager = {
getAddonByID: function (aID, aCallback) {
if (!aID || typeof aID !== "string")
throw Components.Exception("aID must be a non-empty string",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@whimboo
Copy link
Contributor

whimboo commented Aug 26, 2012

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.

@whimboo
Copy link
Contributor

whimboo commented Sep 19, 2012

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

@xabolcs
Copy link
Collaborator Author

xabolcs commented Sep 19, 2012

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.

@whimboo
Copy link
Contributor

whimboo commented Sep 19, 2012

No worries. Whenever you have time. Thanks!

- if brackets
- aCurrentItem
@xabolcs
Copy link
Collaborator Author

xabolcs commented Sep 26, 2012

@whimboo, 5th set of commits added.

@whimboo
Copy link
Contributor

whimboo commented Sep 26, 2012

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

@whimboo
Copy link
Contributor

whimboo commented Sep 26, 2012

3368984

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants