Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Issue 2391523002: Do not revalidate when ResourceLoaderOptions.synchronousPolicy is different (Closed)

Created:
4 years, 2 months ago by hiroshige
Modified:
3 years, 11 months ago
CC:
chromium-reviews, blink-reviews, loading-reviews+fetch_chromium.org, tyoshino+watch_chromium.org, Nate Chapin, gavinp+loader_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Do not revalidate when ResourceLoaderOptions.synchronousPolicy is different This CL adds a check of synchronousPolicy to ResourceLoaderOptions::canReuseRequest() to avoid Resources to be reused between sync and async requests. This CL also removes a condition from ResourceFetcher::determineRevalidationPolicy() that is covered by the newly added check. CachingCorrectnessTest is updated so that it doesn't use synchronous RawResource requests. BUG=652172 Committed: https://crrev.com/733a476495c43c1f472e5770c9d8aeeb94c5caca Cr-Commit-Position: refs/heads/master@{#422725}

Patch Set 1 #

Patch Set 2 : Fix unit tests #

Patch Set 3 : Modify determineRevalidationPolicy() #

Patch Set 4 : git cl format #

Messages

Total messages: 35 (20 generated)
hiroshige
Could you take a look? Another option would be to update/overwrite ResourceLoaderOptions on revalidation.
4 years, 2 months ago (2016-10-03 09:03:28 UTC) #9
ThomasJones
On 2016/10/03 09:03:28, hiroshige wrote: > Could you take a look? > > Another option ...
4 years, 2 months ago (2016-10-03 09:14:04 UTC) #10
hiroshige
On 2016/10/03 09:14:04, ThomasJones wrote: > On 2016/10/03 09:03:28, hiroshige wrote: > > Could you ...
4 years, 2 months ago (2016-10-03 09:21:19 UTC) #11
yhirano
lgtm
4 years, 2 months ago (2016-10-03 10:53:55 UTC) #12
yhirano
By the way, can we remove // Don't try to reuse an in-progress async request ...
4 years, 2 months ago (2016-10-03 11:18:31 UTC) #13
hiroshige
On 2016/10/03 11:18:31, yhirano wrote: > By the way, can we remove > > // ...
4 years, 2 months ago (2016-10-03 12:54:51 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2391523002/60001
4 years, 2 months ago (2016-10-04 05:44:03 UTC) #25
commit-bot: I haz the power
Committed patchset #4 (id:60001)
4 years, 2 months ago (2016-10-04 06:55:45 UTC) #27
commit-bot: I haz the power
Patchset 4 (id:??) landed as https://crrev.com/733a476495c43c1f472e5770c9d8aeeb94c5caca Cr-Commit-Position: refs/heads/master@{#422725}
4 years, 2 months ago (2016-10-04 06:58:15 UTC) #29
pcc1
On 2016/10/04 06:58:15, commit-bot: I haz the power wrote: > Patchset 4 (id:??) landed as ...
4 years, 2 months ago (2016-10-05 00:10:43 UTC) #30
hiroshige
On 2016/10/05 00:10:43, pcc1 wrote: > On 2016/10/04 06:58:15, commit-bot: I haz the power wrote: ...
4 years, 2 months ago (2016-10-05 04:48:36 UTC) #31
hiroshige
On 2016/10/05 04:48:36, hiroshige wrote: > On 2016/10/05 00:10:43, pcc1 wrote: > > On 2016/10/04 ...
4 years, 2 months ago (2016-10-06 07:43:58 UTC) #32
pcc1
On 2016/10/06 07:43:58, hiroshige wrote: > On 2016/10/05 04:48:36, hiroshige wrote: > > On 2016/10/05 ...
4 years, 2 months ago (2016-10-06 17:18:34 UTC) #33
awesome.agouti
On 2016/10/06 17:18:34, pcc1 wrote: > On 2016/10/06 07:43:58, hiroshige wrote: > > On 2016/10/05 ...
3 years, 11 months ago (2017-01-13 12:04:25 UTC) #34
hiroshige
3 years, 11 months ago (2017-01-13 17:02:32 UTC) #35
Message was sent while issue was closed.
On 2017/01/13 12:04:25, awesome.agouti wrote:
> On 2016/10/06 17:18:34, pcc1 wrote:
> > On 2016/10/06 07:43:58, hiroshige wrote:
> > > On 2016/10/05 04:48:36, hiroshige wrote:
> > > > On 2016/10/05 00:10:43, pcc1 wrote:
> > > > > On 2016/10/04 06:58:15, commit-bot: I haz the power wrote:
> > > > > > Patchset 4 (id:??) landed as
> > > > > > https://crrev.com/733a476495c43c1f472e5770c9d8aeeb94c5caca
> > > > > > Cr-Commit-Position: refs/heads/master@{#422725}
> > > > > 
> > > > > I believe this change caused a regression on the "CFI Linux ToT" bot
as
> a
> > > > result
> > > > > of introducing a bad cast. See e.g.
> > > > >
> > > >
> > >
> >
>
https://build.chromium.org/p/chromium.fyi/builders/CFI%20Linux%20ToT/builds/4446
> > > > > 
> > > > > Specifically, each of the failing tests contains code that looks like
> > this:
> > > > > 
> > > > >   Resource* firstResource =
> > > > >       Resource::create(ResourceRequest(redirectUrl), Resource::Raw);
> > > > >   [...]
> > > > >   Resource* fetched = fetch();
> > > > >   EXPECT_EQ(firstResource, fetched);
> > > > > 
> > > > > This CL changed CachingCorrectnessTest::fetch() to call
> > RawResource::fetch()
> > > > > instead of RawResource::fetchSynchronously(). The former function
casts
> > what
> > > > > ends up being firstResource (which is a Resource) from Resource to
> > > RawResource
> > > > > (see toRawResource), which fails the bad cast check.
> > > > > 
> > > > > Can you please take a look?
> > > > 
> > > > Er, Resource::create() creates Resource (not RawResource) with type
> > > > Resource::Raw. MemoryCache etc. assumes Resource with type Resource::Raw
> is
> > > > RawResource, so causing wrong cast. Thanks, fixing.
> > > 
> > > Tracked by https://crbug.com/652999, landed a fix, waiting for bot
results.
> > 
> > Bot is green now, thanks Hiroshige!
> 
> 
> > Could you take a look?
> > 
> > Another option would be to update/overwrite ResourceLoaderOptions on
> > revalidation.
> 
> I came  across the same issues when I was working on my project at
> http://www.mobi-spy.net/. So how can I overwrite ResourceLoaderOptions on
> revalidation? If I cannot to it myself, who may I refer to get some help with
> that? This really affects the efficiency of my working progress.

First, I'd like to know your need more in detail, so could you create a new
entry on https://crbug.com/?
- Do you mean overwriting synchronousPolicy, i.e. reusing Resource on
MemoryCache among sync and async requests?
- What problematic behavior does the issue cause? Is it for XHRs?
- Is serving from disk cache acceptable?

Basically, I'd like to avoid rewriting/overwriting ResourceLoaderOptions because
it is hard and/or complicates the logic at the risk of new security bugs (and
sync XHR on the main thread is deprecated).
However, there might be another way of fixes, depending on your situation.

Powered by Google App Engine
This is Rietveld 408576698