Closed
Bug 1128774
Opened 9 years ago
Closed 9 years ago
Reader Mode fails hard on initial Gmail loading
Categories
(Firefox for iOS :: Browser, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: bnicholson, Assigned: bnicholson)
References
Details
Attachments
(1 file, 1 obsolete file)
STR: 1) Go to gmail.com and log in. 2) Wait until the page loads. 3) If the page appears, go back to step 1 (you can stay logged in). After a few tries, I end up on a blank page. When clicking the URL bar, no URL is filled in the awesomescreen. When clicking the tabs button, the tab title is blank. Adding some logging, I found that webView.URL is null when this happens. I doubt this is specific to Gmail, but I haven't been able to reproduce it anywhere else yet.
Assignee | ||
Comment 1•9 years ago
|
||
There are no errors in the Xcode console. I tried to debug this using the Safari Develop console, but the console just closes itself when this happens. So far, it's been a big pain to debug. Through some elimination, it looks like it could be related to reader mode. I commented out the ReaderMode helper creation in BVC didCreateTab(), and the STR don't seem to work anymore. Thought it might be memory related, so I added logging to didReceiveMemoryWarning() in BVC, but it's not called.
Comment 2•9 years ago
|
||
I'll take a look at this in more detail. Assigning to myself since the Reader Mode hint seems to be strong.
Assignee: nobody → sarentz
Status: NEW → ASSIGNED
Comment 3•9 years ago
|
||
The first thing I noticed is that GMail does a couple of redirects. It looks like it does these redirects by settings window.location, which is why I don't see redirect responses from the HTTP requests. We run Readability every time we get a onShow event. But in this case, gmail also triggers that location change pretty much immediately. I would think that should not make a difference, but it seems it does. Couple notes: While this is happening we do not call into the page with webView.evaluateJavascript() so we can eliminate that. Commenting out the calls to webkit.messageHandlers.readerModeMessageHandler.postMessage() makes no difference, so it also has nothing to do with messaging back to the native code.
Updated•9 years ago
|
Summary: Gmail intermittently causes the webview URL to be nil → Reader Mode fails hard on initial Gmail loading
Comment 4•9 years ago
|
||
This patch adds an extra check to `checkReadability` to find out of the body of the document actually has child elements. If it has not then we can already say that the page is most likely an empty page used to redirect to another page. The redirection is certainly what GMail is doing. Unfortunately I don't yet fully understand the underlying issue. My gut feeling says it is a race condition in the WKWebView code where it executes a User Script while the page is suddenly being reloaded. I think it could be worthwhile to write an isolated test case so that we can submit this to Apple if this guess is correct.
Attachment #8558626 -
Flags: review?(bnicholson)
Assignee | ||
Comment 5•9 years ago
|
||
Comment on attachment 8558626 [details] [review] PR: https://github.com/mozilla/firefox-ios/pull/132 Sadly, doesn't fix the issue as mentioned in the PR.
Attachment #8558626 -
Flags: review?(bnicholson) → review-
Assignee | ||
Comment 6•9 years ago
|
||
Here's another attempt. Haven't been able to hit the bug with this applied.
Assignee: sarentz → bnicholson
Attachment #8558626 -
Attachment is obsolete: true
Attachment #8558746 -
Flags: review?(sarentz)
Comment 7•9 years ago
|
||
Comment on attachment 8558746 [details] [review] Pull request Nice one. Seems to work well. Lets include this but also file a followup that we should optimize this later (if possible) because from a performance and memory perspective I don't think it is awesome to serialize the DOM and then parse it again. One way to optimize this is to look at the failing DOM and make a decision to not call Readability() at all, earlier. I tried doing that by looking at the number of child nodes in the body but obviously that is not enough.
Attachment #8558746 -
Flags: review?(sarentz) → review+
Assignee | ||
Comment 8•9 years ago
|
||
Merged. (In reply to Stefan Arentz [:st3fan] from comment #7) > Lets include this but also file a followup that we should optimize this > later (if possible) because from a performance and memory perspective I > don't think it is awesome to serialize the DOM and then parse it again. Yeah, it's hard to say what the perf impact of this is. We actually do this in Gecko too [1], though the parsing part happens in a web worker. [1] http://mxr.mozilla.org/mozilla-central/source/toolkit/components/reader/ReaderMode.jsm?rev=ad3867772421#245
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Updated•9 years ago
|
Blocks: iosbrowsingui
You need to log in
before you can comment on or make changes to this bug.
Description
•