Closed Bug 894979 Opened 12 years ago Closed 12 years ago

Fix webapprt-test-chrome

Categories

(Firefox Graveyard :: Webapp Runtime, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 25

People

(Reporter: marco, Assigned: marco)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch Patch (obsolete) — Splinter Review
No description provided.
Attachment #777206 - Flags: review?(myk)
For details see bug 894162 comment 5 and following.
Comment on attachment 777206 [details] [diff] [review] Patch Review of attachment 777206 [details] [diff] [review]: ----------------------------------------------------------------- Looks great! Just a couple minor issues. But Fabrice should review the dom/apps/src/ changes, for which my comments here are just feedback. ::: dom/apps/src/AppDownloadManager.jsm @@ +66,1 @@ > return this.downloads[aManifestURL]; Is it important to return `null` in this case? Without the change, this function returns `undefined`, which tends to have the same effect (f.e. on callers that check for truthiness, since both `null` and `undefined` evaluate to `false` in conditionals). In situations like this, it's useful to add a code comment explaining why the code is doing something that doesn't appear to be necessary at first glance. ::: dom/apps/src/Webapps.jsm @@ +2788,3 @@ > Cu.reportError("DOMApplicationRegistry: Exception on app uninstall: " + > ex + "\n" + ex.stack); > } Normally I would say it's a good thing to check that a function exists before calling it! But in this case we catch all exceptions and treat them the same. So it isn't clear why it's important to check the function. Can you elaborate? Here again, if there's a subtle behavior variation, it would be useful to know what it is, ideally via a code comment that explained why the code is doing this extra check. Also, nit: the emerging convention in Mozilla code is to use brackets around all conditional blocks, even one-liners. ::: webapprt/test/chrome/browser_window-title.js @@ +13,5 @@ > let tests = [ > ["http://example.com/webapprtChrome/webapprt/test/chrome/window-title.html", > "http://example.com" + " - " + WebappRT.config.app.manifest.name, > "window title should show origin of page at different origin"], > + ["http://test:80/webapprtChrome/webapprt/test/chrome/window-title.html", Nice use of test:80 to make these URLs shorter! But is the port reference (":80") necessary? It seems like it shouldn't be, since the "http" scheme implies that default. ::: webapprt/test/chrome/head.js @@ +11,5 @@ > > +const MANIFEST_URL_BASE = Services.io.newURI( > + "http://test:80/webapprtChrome/webapprt/test/chrome/", null, null); > + > +let manifestName; Instead of declaring *manifestName* globally so you can call *registerCleanupFunction* globally, call *registerCleanupFunction* within *loadWebapp* so you can also declare *manifestName* locally within that function, and there isn't a chance of multiple tests within the same test script stepping on each others' toes.
Attachment #777206 - Flags: review?(myk)
Attachment #777206 - Flags: review?(fabrice)
Attachment #777206 - Flags: review-
(In reply to Myk Melez [:myk] [@mykmelez] from comment #2) > Looks great! Just a couple minor issues. But Fabrice should review the > dom/apps/src/ changes, for which my comments here are just feedback. > > ::: dom/apps/src/AppDownloadManager.jsm > @@ +66,1 @@ > > return this.downloads[aManifestURL]; > > Is it important to return `null` in this case? Without the change, this > function returns `undefined`, which tends to have the same effect (f.e. on > callers that check for truthiness, since both `null` and `undefined` > evaluate to `false` in conditionals). > > In situations like this, it's useful to add a code comment explaining why > the code is doing something that doesn't appear to be necessary at first > glance. > > ::: dom/apps/src/Webapps.jsm > @@ +2788,3 @@ > > Cu.reportError("DOMApplicationRegistry: Exception on app uninstall: " + > > ex + "\n" + ex.stack); > > } > > Normally I would say it's a good thing to check that a function exists > before calling it! But in this case we catch all exceptions and treat them > the same. So it isn't clear why it's important to check the function. Can > you elaborate? > > Here again, if there's a subtle behavior variation, it would be useful to > know what it is, ideally via a code comment that explained why the code is > doing this extra check. > > Also, nit: the emerging convention in Mozilla code is to use brackets around > all conditional blocks, even one-liners. I made both changes just to avoid showing warnings during the tests: JavaScript Warning: "ReferenceError: reference to undefined property this.downloads[aManifestURL]" {file: "resource://gre/modules/AppDownloadManager.jsm" line: 62} JavaScript Error: "DOMApplicationRegistry: Exception on app uninstall: TypeError: aOnSuccess is not a function
Attached patch Patch v2Splinter Review
This patch doesn't contain dom/apps changes (only a typo fix that shouldn't require fabrice's attention).
Assignee: nobody → mar.castelluccio
Status: NEW → ASSIGNED
Attachment #777421 - Flags: review?(myk)
(In reply to Marco Castelluccio [:marco] from comment #3) > I made both changes just to avoid showing warnings during the tests: > JavaScript Warning: "ReferenceError: reference to undefined property > this.downloads[aManifestURL]" {file: > "resource://gre/modules/AppDownloadManager.jsm" line: 62} > JavaScript Error: "DOMApplicationRegistry: Exception on app uninstall: > TypeError: aOnSuccess is not a function Ah, that's actually a good reason to make those changes (and doesn't require further commentary, as I suggested; I and other developers should see why the checks exist)!
Comment on attachment 777421 [details] [diff] [review] Patch v2 Looks good, r=myk! And feedback+ on the changes in dom/apps/, now that I understand them. But you'll still need Fabrice's review for them, since I'm not a reviewer of that code.
Attachment #777421 - Flags: review?(myk) → review+
Inbound "CLOSED. Debug browser-chrome logs are getting truncated." -> checkin-needed
Keywords: checkin-needed
OS: Linux → All
Hardware: x86_64 → All
Attachment #777206 - Attachment is obsolete: true
Attachment #777206 - Flags: review?(fabrice)
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 25
Product: Firefox → Firefox Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: