Closed Bug 801611 Opened 12 years ago Closed 11 years ago

In some cases, WebApps require synchronous startup file I/O

Categories

(Firefox for Android Graveyard :: General, defect)

All
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 838210

People

(Reporter: Yoric, Unassigned)

Details

(Whiteboard: [mentor=Yoric][lang=js])

Attachments

(1 file)

I can see this at least in the mobile version: http://hg.mozilla.org/mozilla-central/annotate/942ed5747b63/mobile/android/chrome/content/browser.js#l7440

It is my understanding that these code paths are not used yet, but should be used within a few months. We should get rid of this.
Component: DOM: Apps → Web Apps
Product: Core → Firefox
QA Contact: jsmith
OS: Mac OS X → Android
Product: Firefox → Firefox for Android
QA Contact: jsmith → aaron.train
Component: Web Apps → General
QA Contact: aaron.train
What's the replacement for readInputStreamToString ?
Note that Webapps.jsm also uses the method in some startup code:
http://mxr.mozilla.org/mozilla-central/source/dom/apps/src/Webapps.jsm
(In reply to Mark Finkle (:mfinkle) from comment #1)
> What's the replacement for readInputStreamToString ?

To read the contents of a file to a string, asynchronously, off main thread:

let decoder = new TextDecoder(); // Can be reused
OS.File.read(path).then(
  function onSuccess(array) {
    return decoder.decode(array);
  }
);
I will try and fix this.
Assignee: nobody → dteller
Looks like I won't have time to do this. Rebranding as a mentored bug.
Assignee: dteller → nobody
Whiteboard: [mentor=Yoric][lang=js]
If I understand this bug correctly, the idea is to replace the synchronous call to readInputStreamToString with the async version?
Yep. To use TextDecoder, you may need to use OS.File.read() instead of what we do currently.
Ok, I think I understand. How can I tell that I've got it working? Will the application fail to startup or is there something specific I need to test for?
Given that this is in the install path, this will make tests fail.
Attachment #713596 - Flags: review?
I've made an attempt at using the async loading mechanism. I'm not sure how to test that it is loading asynchronously, but running it on my phone does work. If this is the correct approach, I will do the same thing for Webapps.jsm
Comment on attachment 713596 [details] [diff] [review]
First attempt at async loading

Taking the r? for the time being.
Attachment #713596 - Flags: review? → review?(dteller)
Comment on attachment 713596 [details] [diff] [review]
First attempt at async loading

Review of attachment 713596 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good to me.
Passing to mfinkle.

::: mobile/android/chrome/content/browser.js
@@ +8275,2 @@
>        try {
> +        let decoder = new TextDecoder(); // Can be reused

I guess that's a "could be reused", since you don't actually reuse it.
Attachment #713596 - Flags: review?(mark.finkle)
Attachment #713596 - Flags: review?(dteller)
Attachment #713596 - Flags: feedback+
Yes, we can get rid of the comment.

Should I try the same approach in Webapps.jsm? Or leave that as a separate bug? I'm not sure how I would go about testing any changes to Webapps.jsm
Comment on attachment 713596 [details] [diff] [review]
First attempt at async loading

I think bug 838210 is overlapping this bug/patch. This section of code has changed a good bit too and will need to be rebased. Take a look at bug 838210 to see if we can consolidate.

r- until we are sure we want this patch alone.
Attachment #713596 - Flags: review?(mark.finkle) → review-
I think this is a duplicate of bug 838210.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: