Bug 136916 - Pending API request URL no set when loading Alternate HTML or plain text
Summary: Pending API request URL no set when loading Alternate HTML or plain text
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 136913 156691
Blocks: 139342
  Show dependency treegraph
 
Reported: 2014-09-18 02:42 PDT by Carlos Garcia Campos
Modified: 2016-04-18 03:01 PDT (History)
10 users (show)

See Also:


Attachments
Patch (10.50 KB, patch)
2014-09-18 02:55 PDT, Carlos Garcia Campos
no flags Details | Formatted Diff | Diff
Rebased patch after r174029 (9.82 KB, patch)
2014-09-26 23:57 PDT, Carlos Garcia Campos
no flags Details | Formatted Diff | Diff
Rebased patch (12.06 KB, patch)
2014-10-08 23:51 PDT, Carlos Garcia Campos
no flags Details | Formatted Diff | Diff
Rebased patch (11.25 KB, patch)
2015-01-05 04:52 PST, Carlos Garcia Campos
no flags Details | Formatted Diff | Diff
Now also including the xcode file changes (14.10 KB, patch)
2015-01-05 06:30 PST, Carlos Garcia Campos
darin: review+
Details | Formatted Diff | Diff
Patch for landing (15.12 KB, patch)
2016-02-02 04:08 PST, Carlos Garcia Campos
no flags Details | Formatted Diff | Diff
Try to fix iOS build (15.12 KB, patch)
2016-04-18 02:55 PDT, Carlos Garcia Campos
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Garcia Campos 2014-09-18 02:42:48 PDT
The effect in all the cases is that PageLoadState::isLoading() is false right after requesting a load, and the activeURL can be NULL or a previous URL.
Comment 1 Carlos Garcia Campos 2014-09-18 02:55:55 PDT
Created attachment 238300 [details]
Patch

I've added a new unit test, but only to GTK and EFL builds, since I don't have a mac to add it to the xcode file too.
Comment 2 Carlos Garcia Campos 2014-09-18 02:56:46 PDT
Making this depend on #136913, since the new unit test will fail if #136913 is not fixed before.
Comment 3 Carlos Garcia Campos 2014-09-26 23:52:41 PDT
loadFile() has already been fixed in r174029
Comment 4 Carlos Garcia Campos 2014-09-26 23:57:38 PDT
Created attachment 238763 [details]
Rebased patch after r174029
Comment 5 Darin Adler 2014-09-28 17:14:12 PDT
Sam, Anders, could one of you review?
Comment 6 Carlos Garcia Campos 2014-10-08 23:51:47 PDT
Created attachment 239519 [details]
Rebased patch
Comment 7 Carlos Garcia Campos 2015-01-05 03:58:44 PST
loadData was already fixed in r176408
Comment 8 Carlos Garcia Campos 2015-01-05 04:52:28 PST
Created attachment 243972 [details]
Rebased patch
Comment 9 Carlos Garcia Campos 2015-01-05 06:30:10 PST
Created attachment 243974 [details]
Now also including the xcode file changes

To add the new api test to the build also for mac
Comment 10 Michael Catanzaro 2015-06-05 14:37:58 PDT
(In reply to comment #5)
> Sam, Anders, could one of you review?
Comment 11 Michael Catanzaro 2016-01-02 10:13:00 PST
Owners?
Comment 12 Darin Adler 2016-01-15 10:12:00 PST
Comment on attachment 243974 [details]
Now also including the xcode file changes

View in context: https://bugs.webkit.org/attachment.cgi?id=243974&action=review

I’m saying review+ but I’d still like to understand if Anders agrees about this use of "about:blank".

> Source/WebKit2/UIProcess/WebPageProxy.cpp:860
> +    auto transaction = m_pageLoadState.transaction();
> +    m_pageLoadState.setPendingAPIRequestURL(transaction, ASCIILiteral("about:blank"));

I think it’s a little peculiar to actually set the URL to about::blank here. Do we agree that explicitly giving it this particular URL makes sense? Does WebKit already treat this as if it came from that URL in other ways or is that a new concept we are introducing? If WebKit does already use this URL then why are we having to inject it specifically here?

I think this would read better without the local variable even though the other function does have it in a local variable since it uses it twice. I think blankURL().string() is better than ASCIILiteral("about:blank").

    m_pageLoadState.setPendingAPIRequestURL(m_pageLoadState.transaction(), blankURL().string());

> Source/WebKit2/UIProcess/WebPageProxy.cpp:875
> +    auto transaction = m_pageLoadState.transaction();
> +    m_pageLoadState.setPendingAPIRequestURL(transaction, ASCIILiteral("about:blank"));

Same comments as above.
Comment 13 Darin Adler 2016-01-15 10:18:42 PST
Comment on attachment 243974 [details]
Now also including the xcode file changes

View in context: https://bugs.webkit.org/attachment.cgi?id=243974&action=review

>> Source/WebKit2/UIProcess/WebPageProxy.cpp:860
>> +    m_pageLoadState.setPendingAPIRequestURL(transaction, ASCIILiteral("about:blank"));
> 
> I think it’s a little peculiar to actually set the URL to about::blank here. Do we agree that explicitly giving it this particular URL makes sense? Does WebKit already treat this as if it came from that URL in other ways or is that a new concept we are introducing? If WebKit does already use this URL then why are we having to inject it specifically here?
> 
> I think this would read better without the local variable even though the other function does have it in a local variable since it uses it twice. I think blankURL().string() is better than ASCIILiteral("about:blank").
> 
>     m_pageLoadState.setPendingAPIRequestURL(m_pageLoadState.transaction(), blankURL().string());

I found comments in FrameLoader::reload that say, "If a window is created by javascript, its main frame can have an empty but non-nil URL."

Maybe that’s how the plain text string should work. Have an empty URL, not "about:blank".
Comment 14 Carlos Garcia Campos 2016-02-02 03:23:35 PST
Comment on attachment 243974 [details]
Now also including the xcode file changes

View in context: https://bugs.webkit.org/attachment.cgi?id=243974&action=review

>>> Source/WebKit2/UIProcess/WebPageProxy.cpp:860
>>> +    m_pageLoadState.setPendingAPIRequestURL(transaction, ASCIILiteral("about:blank"));
>> 
>> I think it’s a little peculiar to actually set the URL to about::blank here. Do we agree that explicitly giving it this particular URL makes sense? Does WebKit already treat this as if it came from that URL in other ways or is that a new concept we are introducing? If WebKit does already use this URL then why are we having to inject it specifically here?
>> 
>> I think this would read better without the local variable even though the other function does have it in a local variable since it uses it twice. I think blankURL().string() is better than ASCIILiteral("about:blank").
>> 
>>     m_pageLoadState.setPendingAPIRequestURL(m_pageLoadState.transaction(), blankURL().string());
> 
> I found comments in FrameLoader::reload that say, "If a window is created by javascript, its main frame can have an empty but non-nil URL."
> 
> Maybe that’s how the plain text string should work. Have an empty URL, not "about:blank".

This is what we are doing in other load methods, see WebPageProxy::loadHTMLString() and WebPageProxy::loadData(). You can see in the unit test I'm adding that it also checks existing cases like WKPageLoadData that indeed returns about:blank. So, I don't know if it's the best to do it, but it's consistent with what we do already.
Comment 15 Carlos Garcia Campos 2016-02-02 03:33:56 PST
(In reply to comment #12)
> Comment on attachment 243974 [details]
> Now also including the xcode file changes
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=243974&action=review
> 
> I’m saying review+ but I’d still like to understand if Anders agrees about
> this use of "about:blank".
> 
> > Source/WebKit2/UIProcess/WebPageProxy.cpp:860
> > +    auto transaction = m_pageLoadState.transaction();
> > +    m_pageLoadState.setPendingAPIRequestURL(transaction, ASCIILiteral("about:blank"));
> 
> I think it’s a little peculiar to actually set the URL to about::blank here.
> Do we agree that explicitly giving it this particular URL makes sense? Does
> WebKit already treat this as if it came from that URL in other ways or is
> that a new concept we are introducing? If WebKit does already use this URL
> then why are we having to inject it specifically here?
> 
> I think this would read better without the local variable even though the
> other function does have it in a local variable since it uses it twice. I
> think blankURL().string() is better than ASCIILiteral("about:blank").
> 
>     m_pageLoadState.setPendingAPIRequestURL(m_pageLoadState.transaction(),
> blankURL().string());

The local variable is not because it's reused, but because we want the transaction to be finished when the function goes out of scope, the transaction destructor is the one committing the changes to the page load state.
Comment 16 Carlos Garcia Campos 2016-02-02 04:08:47 PST
Created attachment 270483 [details]
Patch for landing
Comment 17 Carlos Garcia Campos 2016-02-11 01:15:23 PST
Anders?
Comment 18 Carlos Garcia Campos 2016-04-14 23:01:15 PDT
This patch has almost two years, and has been r+'ed for three months, just pending the final approval from Anders. And the same situation happens in bug #139342. If nobody objects I'll apply the inverse logic and land these patches next Monday, so Anders can roll them out if he disagrees. I don't see any other option to unblock these bugs.
Comment 19 Anders Carlsson 2016-04-15 09:36:29 PDT
OK.
Comment 20 Carlos Garcia Campos 2016-04-18 01:50:16 PDT
Committed r199660: <http://trac.webkit.org/changeset/199660>
Comment 21 WebKit Commit Bot 2016-04-18 02:45:32 PDT
Re-opened since this is blocked by bug 156691
Comment 22 Carlos Garcia Campos 2016-04-18 02:55:34 PDT
Created attachment 276628 [details]
Try to fix iOS build

I think the only problem was a missing #if WK_HAVE_C_SPI in the test
Comment 23 Carlos Garcia Campos 2016-04-18 03:01:42 PDT
Committed r199663: <http://trac.webkit.org/changeset/199663>