Closed Bug 782421 Opened 12 years ago Closed 12 years ago

Use parsed result when clicking the reader icon

Categories

(Firefox for Android Graveyard :: Reader View, defect)

ARM
Android
defect
Not set
normal

Tracking

(firefox16- fixed)

RESOLVED FIXED
Firefox 17
Tracking Status
firefox16 - fixed

People

(Reporter: bnicholson, Assigned: bnicholson)

Details

Attachments

(1 file, 1 obsolete file)

Bug 780519 aims to fix this by storing articles in the cache. For a simpler, shorter term solution, we can attach the article to the tab, so only the most recent article is available. This makes clicking the reader mode button instant for general use (but going back/forward, restoring from OOM, etc. will require re-parsing).
This patch attaches the saved article to the tab. When the reader icon or "Reading List" in the menu is clicked, we can avoid re-parsing the current page.
Attachment #651869 - Flags: review?(lucasr.at.mozilla)
Comment on attachment 651869 [details] [diff] [review]
Use parsed result when clicking the reader icon

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

Looks good but I'd like it to only cover about:reader only instead of any about pages.

::: mobile/android/chrome/content/browser.js
@@ +2871,5 @@
> +          let tabURL = currentURI.specIgnoringRef;
> +          if (article == null || (article.url != tabURL)) {
> +            // Don't clear the article for about pages since we don't want to
> +            // lose it if we go to about:reader
> +            if (!currentURI.schemeIs("about"))

Any reason we should keep it if we go to, say, about:home? Feels like you should be more specific here to avoid any unexpected behaviour.

@@ +2872,5 @@
> +          if (article == null || (article.url != tabURL)) {
> +            // Don't clear the article for about pages since we don't want to
> +            // lose it if we go to about:reader
> +            if (!currentURI.schemeIs("about"))
> +              this.savedArticle = null;

nit: I'd add an empty line here to make the return more prominent.

@@ +6423,5 @@
>    },
>  
> +  getArticleForTab: function Reader_getArticleForTab(tabId, url, callback) {
> +    let tab = BrowserApp.getTabForId(tabId);
> +    let article = tab.savedArticle;

nit: add empty line here, let me breath :-)
Attachment #651869 - Flags: review?(lucasr.at.mozilla) → review-
(In reply to Lucas Rocha (:lucasr) from comment #2)
> Comment on attachment 651869 [details] [diff] [review]
> Use parsed result when clicking the reader icon
> 
> Review of attachment 651869 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: mobile/android/chrome/content/browser.js
> @@ +2871,5 @@
> > +          let tabURL = currentURI.specIgnoringRef;
> > +          if (article == null || (article.url != tabURL)) {
> > +            // Don't clear the article for about pages since we don't want to
> > +            // lose it if we go to about:reader
> > +            if (!currentURI.schemeIs("about"))
> 
> Any reason we should keep it if we go to, say, about:home? Feels like you
> should be more specific here to avoid any unexpected behaviour.
> 

I avoided it because there's no easy way to determine which about page we're on using nsIURI, but I can just do a simple regex test. I agree it's probably better to be more explicit.
Addressed comments.
Attachment #651869 - Attachment is obsolete: true
Attachment #651886 - Flags: review?(lucasr.at.mozilla)
Comment on attachment 651886 [details] [diff] [review]
Use parsed result when clicking the reader icon, v2

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

Nice.
Attachment #651886 - Flags: review?(lucasr.at.mozilla) → review+
Comment on attachment 651886 [details] [diff] [review]
Use parsed result when clicking the reader icon, v2

[Approval Request Comment]
Bug caused by (feature/regressing bug #): 
User impact if declined: clicking reader button or "Reading List" in menu item will take longer to finish
Testing completed (on m-c, etc.): just landed m-i
Risk to taking this patch (and alternatives if risky): low risk
String or UUID changes made by this patch: none
Attachment #651886 - Flags: approval-mozilla-aurora?
https://hg.mozilla.org/mozilla-central/rev/bb6adf1cdfe4
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 17
Attachment #651886 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
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

Created:
Updated:
Size: