Bug 159912 - webbookmarksd needs to use the same AppCache directory as MobileSafari
Summary: webbookmarksd needs to use the same AppCache directory as MobileSafari
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-18 17:49 PDT by Alex Christensen
Modified: 2016-07-19 16:08 PDT (History)
2 users (show)

See Also:


Attachments
Patch (3.80 KB, patch)
2016-07-18 17:50 PDT, Alex Christensen
ap: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Christensen 2016-07-18 17:49:29 PDT
webbookmarksd needs to use the same AppCache directory as MobileSafari
Comment 1 Alex Christensen 2016-07-18 17:50:31 PDT
Created attachment 283967 [details]
Patch
Comment 2 WebKit Commit Bot 2016-07-18 17:51:57 PDT
Attachment 283967 [details] did not pass style-queue:


ERROR: Source/WebCore/ChangeLog:8:  You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible.  [changelog/nonewtests] [5]
Total errors found: 1 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 mitz 2016-07-18 18:52:38 PDT
Comment on attachment 283967 [details]
Patch

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

> Source/WebKit2/UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:43
>      // FIXME: Ideally we should just have Safari and WebApp create a data store with

You should add webbookmarksd to the comment. It would be good to also have a reference to the Apple bug tracking fixing this.
Comment 4 Brady Eidson 2016-07-18 18:56:17 PDT
(In reply to comment #2)
> Attachment 283967 [details] did not pass style-queue:
> 
> 
> ERROR: Source/WebCore/ChangeLog:8:  You should remove the 'No new tests' and
> either add and list tests, or explain why no new tests were possible. 
> [changelog/nonewtests] [5]
> Total errors found: 1 in 5 files

This is actually testable - We've recently started adding API tests where we manually put SQLite and data files in place, then do something with WK API to remove them, then manually check that they were removed.
Comment 5 Alex Christensen 2016-07-18 19:03:46 PDT
https://trac.webkit.org/changeset/203392
Comment 6 Alex Christensen 2016-07-18 19:04:36 PDT
(In reply to comment #4)
> (In reply to comment #2)
> > Attachment 283967 [details] did not pass style-queue:
> > 
> > 
> > ERROR: Source/WebCore/ChangeLog:8:  You should remove the 'No new tests' and
> > either add and list tests, or explain why no new tests were possible. 
> > [changelog/nonewtests] [5]
> > Total errors found: 1 in 5 files
> 
> This is actually testable - We've recently started adding API tests where we
> manually put SQLite and data files in place, then do something with WK API
> to remove them, then manually check that they were removed.
Can we change the main bundle identifier to com.apple.webbookmarksd in the tests?
Comment 7 Brady Eidson 2016-07-18 20:28:40 PDT
(In reply to comment #6)
> (In reply to comment #4)
> > (In reply to comment #2)
> > > Attachment 283967 [details] did not pass style-queue:
> > > 
> > > 
> > > ERROR: Source/WebCore/ChangeLog:8:  You should remove the 'No new tests' and
> > > either add and list tests, or explain why no new tests were possible. 
> > > [changelog/nonewtests] [5]
> > > Total errors found: 1 in 5 files
> > 
> > This is actually testable - We've recently started adding API tests where we
> > manually put SQLite and data files in place, then do something with WK API
> > to remove them, then manually check that they were removed.
> Can we change the main bundle identifier to com.apple.webbookmarksd in the
> tests?

Alexey - Is there a way too spoof bundle IDs in API tests? Or do you have an alternate idea here?
Comment 8 Alexey Proskuryakov 2016-07-18 20:35:40 PDT
Swizzling should work I guess.

We need to do something to make API tests scalable, I'm skeptical of adding more when they run sequentially and each one is so slow.
Comment 9 Brady Eidson 2016-07-18 20:49:12 PDT
(In reply to comment #8)
> Swizzling should work I guess.
> 
> We need to do something to make API tests scalable, I'm skeptical of adding
> more when they run sequentially and each one is so slow.

This *almost* sounds like you're messaging "We shouldn't add any more API tests until we find a way to make them run in parallel", but I'm sure that's not your actual point ;)

I don't see why run-api-tests couldn't run multiple parallel instances of TestWebKitAPI just like run-webkit-tests does, but that's clearly out of scope for this bug.
Comment 10 Alex Christensen 2016-07-18 21:30:16 PDT
cmake ports make multiple api test executables.  We could even make one per test.

I would like to add a test for this, but I wasn't aware of this "Swizzling".  If someone could point me in the right direction, I'll add a test.
Comment 11 Brady Eidson 2016-07-18 22:22:04 PDT
(In reply to comment #10)
> cmake ports make multiple api test executables.  We could even make one per
> test.
> 
> I would like to add a test for this, but I wasn't aware of this "Swizzling".
> If someone could point me in the right direction, I'll add a test.

http://darkdust.net/index.php/writings/objective-c/method-swizzling

So, what we want to change is this:
static String applicationBundleIdentifier()
{
    // The override only gets set in WebKit2's WebProcess and NetworkProcess. If unset, we use the main bundle identifier.
    const auto& identifier = applicationBundleIdentifierOverride();
    ASSERT(identifier.isNull() || RunLoop::isMain());
    return identifier.isNull() ? String([[NSBundle mainBundle] bundleIdentifier]) : identifier;
}

So you'd swizzle the -[NSBundle bundleIdentifier] method to be the fake one, run the test, then swizzle it back.
Comment 13 Alex Christensen 2016-07-18 23:57:04 PDT
Oh, THAT swizzling.  I verified this fix manually.  I'm not sure how much value it would add to have a test that uses swizzling to verify the existence of an iOS-specific hack that we want to get rid of.  My complete lack of testing isn't the best, either...
Comment 14 Brady Eidson 2016-07-19 09:47:36 PDT
(In reply to comment #13)
> Oh, THAT swizzling.  I verified this fix manually.  I'm not sure how much
> value it would add to have a test that uses swizzling to verify the
> existence of an iOS-specific hack that we want to get rid of.  

The value is that we don't regress again in the meantime.

"Regression tests" <--- It's right there in the name.
Comment 15 Alex Christensen 2016-07-19 16:08:19 PDT
Regression tests added in https://bugs.webkit.org/show_bug.cgi?id=159949