RESOLVED FIXED 161865
Switch remaining users of Document::inPageCache() to pageCacheState()
https://bugs.webkit.org/show_bug.cgi?id=161865
Summary Switch remaining users of Document::inPageCache() to pageCacheState()
Chris Dumez
Reported 2016-09-12 10:06:28 PDT
Switch remaining users of Document::inPageCache() to pageCacheState() as the former one is confusing (given that it returns true while the pagehide event is being fired).
Attachments
Patch (29.33 KB, patch)
2016-09-12 10:08 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2016-09-12 10:08:59 PDT
WebKit Commit Bot
Comment 2 2016-09-12 12:52:55 PDT
Comment on attachment 288576 [details] Patch Clearing flags on attachment: 288576 Committed r205818: <http://trac.webkit.org/changeset/205818>
WebKit Commit Bot
Comment 3 2016-09-12 12:53:00 PDT
All reviewed patches have been landed. Closing bug.
Simon Fraser (smfr)
Comment 4 2016-10-11 09:45:36 PDT
I don't think frameView.frame().document()->pageCacheState() != Document::NotInPageCache is clearer than: frameView.frame().document()->inPageCache() particularly because of the double negative. Can you add back inPageCache() as a helper?
Chris Dumez
Comment 5 2016-10-11 10:03:46 PDT
(In reply to comment #4) > I don't think > frameView.frame().document()->pageCacheState() != Document::NotInPageCache > is clearer than: > frameView.frame().document()->inPageCache() > particularly because of the double negative. Can you add back inPageCache() > as a helper? Well, clearly it was not clear because it was not used properly and introduced security bugs. You'd like inPageCache() as a helper for what? frameView.frame().document()->pageCacheState() != Document::NotInPageCache means it could be either: - about to enter page cache (a) - in page cache (b) previously, inPageCache() was a helper for returning true for both (a) and (b). We could re-introduce it for (b) only, which would be equivalent to: frameView.frame().document()->pageCacheState() == Document::InPageCache not frameView.frame().document()->pageCacheState() != Document::NotInPageCache
Darin Adler
Comment 6 2016-10-12 09:11:04 PDT
I understand the need to clearly distinguish the three different cases and not have this be a simple "in" vs. "out" of page cache. But I also agree that boolean expressions with pageCacheState are not easy to read; not really clear unless you know what the three states are, and even then pretty wording. Maybe we can name two or three boolean-returning functions with clear unambiguous names, even if they are longer names, and use them. I think that would be better than what we currently have.
Chris Dumez
Comment 7 2016-10-12 09:23:50 PDT
(In reply to comment #6) > I understand the need to clearly distinguish the three different cases and > not have this be a simple "in" vs. "out" of page cache. But I also agree > that boolean expressions with pageCacheState are not easy to read; not > really clear unless you know what the three states are, and even then pretty > wording. > > Maybe we can name two or three boolean-returning functions with clear > unambiguous names, even if they are longer names, and use them. I think that > would be better than what we currently have. Yes, I think this would be nice. It looks like the checks we're using currently are: - pageCacheState() != NotInPageCache -> could become aboutToEnterOrInPageCache() - pageCacheState() == NotInPageCache -> could become !aboutToEnterOrInPageCache() - pageCacheState() == Document::InPageCache -> could become enteredPageCache() or inPageCache() - pageCacheState() == Document::AboutToEnterPageCache -> could become aboutToEnterPageCache() Let me know what you think.
Note You need to log in before you can comment on or make changes to this bug.