Closed
Bug 801618
Opened 12 years ago
Closed 12 years ago
WebApps installer does not need asyncCopy
Categories
(Firefox Graveyard :: Web Apps, defect)
Firefox Graveyard
Web Apps
Tracking
(Not tracked)
RESOLVED
FIXED
Firefox 22
People
(Reporter: Yoric, Assigned: berkerpeksag)
References
(Blocks 1 open bug)
Details
(Whiteboard: [mentor=Yoric][lang=js])
Attachments
(1 file, 4 obsolete files)
(deleted),
patch
|
Details | Diff | Splinter Review |
Reporter | ||
Updated•12 years ago
|
Whiteboard: [mentor=Yoric][lang=js]
Comment 1•12 years ago
|
||
Can you elaborate on the task to be completed?
Assignee | ||
Comment 2•12 years ago
|
||
Assignee: nobody → berker.peksag
Status: NEW → ASSIGNED
Attachment #712084 -
Flags: feedback?(dteller)
Comment 3•12 years ago
|
||
Comment on attachment 712084 [details] [diff] [review]
Patch v1
Review of attachment 712084 [details] [diff] [review]:
-----------------------------------------------------------------
Yoric, the other asyncCopy functions are being used to copy PNG images. Is it better to use asyncCopy in those cases?
::: toolkit/webapps/WebappsInstaller.jsm
@@ +342,5 @@
> writer.setString("TASKBAR", "Migrated", "true");
> writer.writeFile(null, Ci.nsIINIParserWriter.WRITE_UTF16);
>
> // ${UninstallDir}/uninstall.log
> + let uninstallContent =
You should remove this trailing whitespace.
@@ +876,5 @@
>
> /* Helper Functions */
>
> /**
> + * Atomic write a data string into a file
I wouldn't change this comment.
@@ +892,5 @@
> + promise.then(
> + function onSuccess(x) {
> + aCallback(x);
> + }
> + );
If you remove the aCallback argument (that isn't used by any caller), I think you can simply do something like this:
> let data = new TextEncoder().encode(aData);
> OS.File.writeAtomic(aFile.path, data, { tmpPath: aFile.path + ".tmp" });
Comment 4•12 years ago
|
||
(In reply to Marco Castelluccio [:marco] from comment #3)
> You should remove this trailing whitespace.
Oh, sorry, it was there and you removed it :)
Assignee | ||
Comment 5•12 years ago
|
||
Attachment #712084 -
Attachment is obsolete: true
Attachment #712084 -
Flags: feedback?(dteller)
Attachment #712259 -
Flags: review?(mar.castelluccio)
Comment 6•12 years ago
|
||
(In reply to Berker Peksag [:berkerpeksag] from comment #5)
> Created attachment 712259 [details] [diff] [review]
> Patch v2
Hey Berker, my comments were only suggestions, you should ask Yoric to review your code :)
Assignee | ||
Updated•12 years ago
|
Attachment #712084 -
Attachment is obsolete: false
Assignee | ||
Comment 7•12 years ago
|
||
(In reply to Marco Castelluccio [:marco] from comment #6)
> (In reply to Berker Peksag [:berkerpeksag] from comment #5)
> > Created attachment 712259 [details] [diff] [review]
> > Patch v2
>
> Hey Berker, my comments were only suggestions, you should ask Yoric to
> review your code :)
Ah, okay. The whitespace change still out of scope for the bug, thanks for the noticing :)
Assignee | ||
Updated•12 years ago
|
Attachment #712084 -
Flags: feedback?(dteller)
Assignee | ||
Updated•12 years ago
|
Attachment #712259 -
Flags: review?(mar.castelluccio) → feedback?(dteller)
Reporter | ||
Comment 8•12 years ago
|
||
Comment on attachment 712084 [details] [diff] [review]
Patch v1
Review of attachment 712084 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good.
::: toolkit/webapps/WebappsInstaller.jsm
@@ +876,5 @@
>
> /* Helper Functions */
>
> /**
> + * Atomic write a data string into a file
Agreed with marco.
@@ +892,5 @@
> + promise.then(
> + function onSuccess(x) {
> + aCallback(x);
> + }
> + );
This is good, but I agree with marco's remark that we can take the opportunity to remove the callback from this function and its callers.
In case we ever need the feature some day, just return the promise.
Attachment #712084 -
Flags: feedback?(dteller) → feedback+
Reporter | ||
Comment 9•12 years ago
|
||
Comment on attachment 712259 [details] [diff] [review]
Patch v2
Review of attachment 712259 [details] [diff] [review]:
-----------------------------------------------------------------
::: toolkit/webapps/WebappsInstaller.jsm
@@ +884,5 @@
> * @param aCallback a callback to be called after the process is finished
> */
> function writeToFile(aFile, aData, aCallback) {
> + let data = new TextEncoder().encode(aData);
> + OS.File.writeAtomic(aFile.path, data, { tmpPath: aFile.path + ".tmp" });
Please:
- remove argument |aCallback|;
- remove the third argument from all the call sites of |writeToFile|;
- return the result of |writeAtomic|.
Attachment #712259 -
Flags: feedback?(dteller) → feedback+
Assignee | ||
Comment 10•12 years ago
|
||
Attachment #712084 -
Attachment is obsolete: true
Attachment #712259 -
Attachment is obsolete: true
Attachment #712868 -
Flags: review?(dteller)
Reporter | ||
Comment 11•12 years ago
|
||
Comment on attachment 712868 [details] [diff] [review]
Patch v3
Review of attachment 712868 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good to me.
r=me if it passes Try
Attachment #712868 -
Flags: review?(dteller) → review+
Assignee | ||
Comment 12•12 years ago
|
||
(In reply to David Rajchenbach Teller [:Yoric] from comment #11)
> Looks good to me.
> r=me if it passes Try
Thanks for the review, Yoric.
I've rebased the patch and ran the tests in dom/tests/mochitest/webapps/. Is the location correct?
I don't have a level 1 hg account to push the try server. Can you help me with this?
Flags: needinfo?(dteller)
Reporter | ||
Comment 13•12 years ago
|
||
I think that the correct tests are actually on webapprt/test.
Pushed to Try, though: https://tbpl.mozilla.org/?tree=Try&rev=288ffadc2d84
Flags: needinfo?(dteller)
Assignee | ||
Comment 14•12 years ago
|
||
(In reply to David Rajchenbach Teller [:Yoric] from comment #13)
> I think that the correct tests are actually on webapprt/test.
>
> Pushed to Try, though: https://tbpl.mozilla.org/?tree=Try&rev=288ffadc2d84
Thanks! Looks like these failures are not related with the patch. Should I add the "checkin-needed" keyword?
Reporter | ||
Comment 15•12 years ago
|
||
Looks good to me. You will need to add ";r=yoric" at the end of your commit message.
See
http://blog.bonardo.net/2010/06/22/so-youre-about-to-use-checkin-needed
Assignee | ||
Comment 16•12 years ago
|
||
Attachment #712868 -
Attachment is obsolete: true
Attachment #715266 -
Attachment is obsolete: true
Assignee | ||
Updated•12 years ago
|
Keywords: checkin-needed
Comment 17•12 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/cf2e08f56575
Thanks for the patch!
Keywords: checkin-needed
Comment 18•12 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 22
Comment 19•11 years ago
|
||
Yoric, the other asyncCopy functions are being used to copy PNG images. Is it better to use asyncCopy in those cases?
Flags: needinfo?(dteller)
Reporter | ||
Comment 20•11 years ago
|
||
Taking a look at WebApps.jsm and WebappsIconHelpers.js, it seems that the remaining calls of asyncCopy are used to copy an icon that has already been downloaded to /tmp. In that case, just use OS.File.copy, which is much more efficient than asyncCopy.
Flags: needinfo?(dteller)
Comment 21•11 years ago
|
||
(In reply to David Rajchenbach Teller [:Yoric] from comment #20)
> Taking a look at WebApps.jsm and WebappsIconHelpers.js, it seems that the
> remaining calls of asyncCopy are used to copy an icon that has already been
> downloaded to /tmp. In that case, just use OS.File.copy, which is much more
> efficient than asyncCopy.
We're actually also converting the images, so I think asyncCopy should be necessary.
Updated•9 years ago
|
Product: Firefox → Firefox Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•