NEW 34555
All the different "top tier" classes need to share One True URL
https://bugs.webkit.org/show_bug.cgi?id=34555
Summary All the different "top tier" classes need to share One True URL
Brady Eidson
Reported 2010-02-03 19:41:01 PST
All the different "top tier" classes need to share One True URL. At the time of me writing this bug, FrameLoader, Document, DOMWindow, DocLoader, and CachedFrame all have an m_url member that - as far as I can tell - refer to the same thing: the real world URL of the document currently in a frame. This url is accessible via a ::url() method in each. When code needs to figure the url of a document/frame it has a wide array of options for the url() method to call, and this leads to both confusion and bugs. And I haven't even mentioned DocumentLoader, which also hangs on to an "m_url" in the form of "m_request", and there might be others such classes that hold on to the url via a request also. I propose that: -A Document has a URL and a ::url() method. -FrameLoader, DocLoader, DOMWindow, and CachedFrame all have a 1-to-1 relationship with a Document, should get the url from the Document, and should have their ::url() methods stripped. -DocumentLoader has special needs for keeping a resource request around, but we should explore removing it's ::url() method in case it is being misused
Attachments
Adam Barth
Comment 1 2010-02-04 02:39:25 PST
I suspect you'll find that life is not quite that simple. However, it's definitely worth trying.
Brady Eidson
Comment 2 2010-02-04 09:46:55 PST
I also suspect it won't be that simple. As I plan for the time to try, do you mind sharing any specific insights? ;)
Adam Barth
Comment 3 2010-02-04 11:26:59 PST
> As I plan for the time to try, do you mind sharing any specific insights? ;) There's the basic issue that some thing have Frame lifetime, which is neither a subset nor a superset of Document lifetime. I think the FrameLoader's URL might represent a "working" URL that's not updated atomically with the Document's URL. DocLoader and DOMWindow should be easier. Sam wanted to make DOMWindow and Document have identical lifetimes. I'm not sure if he got around to doing that. DocLoader is already has identical lifetime to Document. I'd just go slowly. :)
Brady Eidson
Comment 4 2010-02-04 11:31:47 PST
Going slowly is a given. Re: the "Frame can outlive a document" issue. Do you think a possible solution would be to have FrameLoader::url() return the Document's URL if a Document exists, or return it's copy of the "working URL" if the document is gone?
Adam Barth
Comment 5 2010-02-04 16:55:01 PST
> Re: the "Frame can outlive a document" issue. Do you think a possible solution > would be to have FrameLoader::url() return the Document's URL if a Document > exists, or return it's copy of the "working URL" if the document is gone? You'll have to look at the clients to see what they want. Ideally, we'd remove as many of these APIs as possible.
Note You need to log in before you can comment on or make changes to this bug.