Bug 87838 - Expose setApplicationCacheOriginQuota via window.internals
Summary: Expose setApplicationCacheOriginQuota via window.internals
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Afonso Costa
URL:
Keywords:
Depends on: 87993
Blocks: 87284
  Show dependency treegraph
 
Reported: 2012-05-30 02:53 PDT by Ravi Phaneendra Kasibhatla
Modified: 2014-02-13 09:30 PST (History)
13 users (show)

See Also:


Attachments
Initial patch. (16.77 KB, patch)
2012-05-30 02:53 PDT, Ravi Phaneendra Kasibhatla
no flags Details | Formatted Diff | Diff
Moving of setApplicationCacheOriginQuota from LayoutTestController to Internals (20.10 KB, patch)
2012-06-02 16:08 PDT, Ravi Phaneendra Kasibhatla
no flags Details | Formatted Diff | Diff
WIP patch for EWS testing (18.75 KB, patch)
2013-10-17 14:26 PDT, Afonso Costa
buildbot: commit-queue-
Details | Formatted Diff | Diff
WIP patch (v2) (20.04 KB, patch)
2013-10-17 15:27 PDT, Afonso Costa
no flags Details | Formatted Diff | Diff
Proposed patch (20.87 KB, patch)
2013-10-17 17:28 PDT, Afonso Costa
no flags Details | Formatted Diff | Diff
Proposed patch (v2) (20.87 KB, patch)
2013-10-29 14:03 PDT, Afonso Costa
no flags Details | Formatted Diff | Diff
Proposed patch (v3) (21.54 KB, patch)
2013-10-31 14:51 PDT, Afonso Costa
buildbot: commit-queue-
Details | Formatted Diff | Diff
Patch (21.69 KB, patch)
2013-10-31 15:47 PDT, Afonso Costa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ravi Phaneendra Kasibhatla 2012-05-30 02:53:31 PDT
Created attachment 144773 [details]
Initial patch. 

Move setApplicationCacheOriginQuota API to  WebCore::Internals instead of LayoutTestController interface. This is from the set of functions that were identified in the contributor meeting's hackaton. http://trac.webkit.org/wiki/Internals_Hackathon.
Comment 1 Ravi Phaneendra Kasibhatla 2012-05-30 02:56:21 PDT
I have attached just the basic patch (even with change log) since I am facing some issues with building chromium port. I will be soon uploading final patch after checking & resolving build issues in other ports (if any) complete with Change log also. Hence I haven't marked any review flags.
Comment 2 jochen 2012-05-30 03:56:26 PDT
Chromium doesn't use the files in loader/appcache (with a few exceptions).

Maybe Michael (added) can advise how to mimic this for chromium?
Comment 3 Alexey Proskuryakov 2012-05-30 10:02:23 PDT
Hackathon notes about this function appear wrong - this function is certainly implemented at least on Mac, so it's not just Qt.

Perhaps we should institute a policy that any time WebKit test coverage through LayoutTestContoller is removes, similar coverage should be added in TestWebKitAPI?
Comment 4 Michael Nordman 2012-05-30 10:41:18 PDT
Comment on attachment 144773 [details]
Initial patch. 

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

> Source/WebCore/testing/Internals.cpp:980
> +    cacheStorage().storeUpdatedQuotaForOrigin(document->securityOrigin(), quota);

This won't build in the chromium port because it doesn't use the ApplicationCacheStorage class, that file isn't compiled or linked into the project. Please just conditionally compile this method body out #if PLATFORM(CHROMIUM).
Comment 5 Ravi Phaneendra Kasibhatla 2012-06-02 16:08:25 PDT
Created attachment 145463 [details]
Moving of setApplicationCacheOriginQuota from LayoutTestController to Internals
Comment 6 Ravi Phaneendra Kasibhatla 2012-06-02 16:17:36 PDT
(In reply to comment #4)
> (From update of attachment 144773 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=144773&action=review
> 
> > Source/WebCore/testing/Internals.cpp:980
> > +    cacheStorage().storeUpdatedQuotaForOrigin(document->securityOrigin(), quota);
> 
> This won't build in the chromium port because it doesn't use the ApplicationCacheStorage class, that file isn't compiled or linked into the project. Please just conditionally compile this method body out #if PLATFORM(CHROMIUM).

Done.
Comment 7 Ravi Phaneendra Kasibhatla 2012-06-02 16:20:27 PDT
(In reply to comment #3)
> Hackathon notes about this function appear wrong - this function is certainly implemented at least on Mac, so it's not just Qt.
Yes I cross verified that it is only implemented for Qt and Mac, but the movement to internals still looks correct and it doesn't effect test behavior.
> 
> Perhaps we should institute a policy that any time WebKit test coverage through LayoutTestContoller is removes, similar coverage should be added in TestWebKitAPI?
Are you suggesting that I should add new test for TestWebKitAPI for this? I will check on this and try to update.
Comment 8 Alexey Proskuryakov 2012-06-02 23:01:34 PDT
Please also note the new blocking bug. Perhaps it was just a bad idea to move any functions that change settings to window.internals.
Comment 9 Ojan Vafai 2012-06-04 10:16:33 PDT
(In reply to comment #8)
> Please also note the new blocking bug. Perhaps it was just a bad idea to move any functions that change settings to window.internals.

That would be a shame. It avoids so much code duplication to have them on internals. We should try to see if we can resolve the issues with settings on internals if possible.
Comment 10 Afonso Costa 2013-10-17 14:19:46 PDT
Hi,

I'd like to work on this issue. Could it be assigned to me?
Comment 11 Afonso Costa 2013-10-17 14:26:18 PDT
Created attachment 214511 [details]
WIP patch for EWS testing
Comment 12 Build Bot 2013-10-17 15:10:05 PDT
Comment on attachment 214511 [details]
WIP patch for EWS testing

Attachment 214511 [details] did not pass win-ews (win):
Output: http://webkit-queues.appspot.com/results/4108516
Comment 13 Afonso Costa 2013-10-17 15:27:07 PDT
Created attachment 214522 [details]
WIP patch (v2)
Comment 14 Afonso Costa 2013-10-17 17:28:08 PDT
Created attachment 214534 [details]
Proposed patch
Comment 15 Joseph Pecoraro 2013-10-29 13:14:35 PDT
Comment on attachment 214534 [details]
Proposed patch

Looks good! r=me
Comment 16 Alexey Proskuryakov 2013-10-29 13:48:19 PDT
Comment on attachment 214534 [details]
Proposed patch

What is going to undo the change after the current test finishes?
Comment 17 Afonso Costa 2013-10-29 14:03:02 PDT
Created attachment 215424 [details]
Proposed patch (v2)

Patch was rebased with branch master.
Comment 18 Afonso Costa 2013-10-29 15:18:13 PDT
(In reply to comment #16)
> (From update of attachment 214534 [details])
> What is going to undo the change after the current test finishes?

Hi Alexey, the function clearAllApplicationCaches() is called before to set the new cache quota in all startTest().
Comment 19 Alexey Proskuryakov 2013-10-29 16:27:38 PDT
clearAllApplicationCaches() is a TestRunner feature, so it has to be a responsibility of the test to do this?

Ideally, any settings that are changed duting a test should be reset automatically.
Comment 20 Afonso Costa 2013-10-30 07:07:06 PDT
(In reply to comment #19)
> clearAllApplicationCaches() is a TestRunner feature, so it has to be a responsibility of the test to do this?
> 
> Ideally, any settings that are changed duting a test should be reset automatically.

Maybe the test should: reset -> set -> test -> reset (at the end), just to keep the initial state of any configuration that is being tested.

@Joseph, what do you think?
Comment 21 Joseph Pecoraro 2013-10-30 11:46:54 PDT
(In reply to comment #20)
> (In reply to comment #19)
> > clearAllApplicationCaches() is a TestRunner feature, so it has to be a responsibility of the test to do this?
> > 
> > Ideally, any settings that are changed duting a test should be reset automatically.
> 
> Maybe the test should: reset -> set -> test -> reset (at the end), just to keep the initial state of any configuration that is being tested.
> 
> @Joseph, what do you think?

What Alexey means, is that the test driver should reset to a consistent state before every test. We cannot rely on the test reseting state at the end, because the test might crash or produce an error half way through, and then affect later tests. E.g. putting something in DumpRenderTree.mm resetWebViewToConsistentStateBeforeTesting(), and likewise for other ports.

Your change doesn't change the existing behavior, so I'm still okay with it. But it would be nice to improve this even further and have DumpRenderTree reset the state between tests.
Comment 22 Alexey Proskuryakov 2013-10-30 11:51:03 PDT
Logically, the code to reset should be in Internals, because that's what changes the setting.

There is a "Backup" in InternalSettings, but I'm not sure if Internals methods have an established pattern for doing the right thing.
Comment 23 Tony Chang 2013-10-30 12:13:15 PDT
(In reply to comment #22)
> Logically, the code to reset should be in Internals, because that's what changes the setting.
> 
> There is a "Backup" in InternalSettings, but I'm not sure if Internals methods have an established pattern for doing the right thing.

This is what Internals::resetToConsistentState is for.
Comment 24 Afonso Costa 2013-10-30 15:04:52 PDT
So, do I need to update my patch or is it ok to be integrated?
Comment 25 Afonso Costa 2013-10-31 14:51:01 PDT
Created attachment 215679 [details]
Proposed patch (v3)

Patch was updated: 
- reset the origin quota to default value (in Internals::resetToConsistentState)
- rebased with branch master
Comment 26 Joseph Pecoraro 2013-10-31 15:29:10 PDT
(In reply to comment #25)
> Created an attachment (id=215679) [details]
> Proposed patch (v3)
> 
> Patch was updated: 
> - reset the origin quota to default value (in Internals::resetToConsistentState)
> - rebased with branch master

Should this patch be r? ?
Comment 27 Build Bot 2013-10-31 15:37:58 PDT
Comment on attachment 215679 [details]
Proposed patch (v3)

Attachment 215679 [details] did not pass win-ews (win):
Output: http://webkit-queues.appspot.com/results/19358002
Comment 28 Afonso Costa 2013-10-31 15:47:34 PDT
Created attachment 215685 [details]
Patch

Updated patch with missing symbols (according to Win build)
Comment 29 Afonso Costa 2013-10-31 15:57:13 PDT
(In reply to comment #26)
> (In reply to comment #25)
> > Created an attachment (id=215679) [details] [details]
> > Proposed patch (v3)
> > 
> > Patch was updated: 
> > - reset the origin quota to default value (in Internals::resetToConsistentState)
> > - rebased with branch master
> 
> Should this patch be r? ?

Hi Joseph,

I'll set this flag after the patch is ok on EWS. Sorry, but I don't have a win environment to test it.
Comment 30 WebKit Commit Bot 2013-11-01 13:13:41 PDT
Comment on attachment 215685 [details]
Patch

Clearing flags on attachment: 215685

Committed r158450: <http://trac.webkit.org/changeset/158450>
Comment 31 Csaba Osztrogonác 2014-02-13 04:03:02 PST
Comment on attachment 214534 [details]
Proposed patch

Cleared Joseph Pecoraro's review+ from obsolete attachment 214534 [details] so that this bug does not appear in http://webkit.org/pending-commit.
Comment 32 Alexey Proskuryakov 2014-02-13 09:30:33 PST
Looks like this was landed, but commit-queue couldn't resolve the bug.