WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
182363
WebAppManifest scope should default to the containing directory of start_url if 'scope' is not specified
https://bugs.webkit.org/show_bug.cgi?id=182363
Summary
WebAppManifest scope should default to the containing directory of start_url ...
David Quesada
Reported
2018-01-31 16:47:53 PST
See
https://github.com/w3c/manifest/issues/550#issuecomment-361129547
The spec is likely going to be updated to match Chrome's behavior, which some web apps rely on.
Attachments
Patch
(8.50 KB, patch)
2018-02-01 14:17 PST
,
David Quesada
no flags
Details
Formatted Diff
Diff
Patch v2
(7.92 KB, patch)
2018-02-02 08:41 PST
,
David Quesada
rniwa
: review+
Details
Formatted Diff
Diff
Patch for landing
(8.03 KB, patch)
2018-02-02 15:47 PST
,
David Quesada
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2018-01-31 16:50:08 PST
<
rdar://problem/37093498
>
David Quesada
Comment 2
2018-02-01 14:17:17 PST
Created
attachment 332910
[details]
Patch
Ryosuke Niwa
Comment 3
2018-02-01 15:38:17 PST
Comment on
attachment 332910
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=332910&action=review
> Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.cpp:211 > + URL result { url }; > + > + result.removeQueryAndFragmentIdentifier(); > + > + auto path = result.path(); > + if (path.endsWith('/')) > + return result; > + > + auto lastSlash = path.reverseFind('/'); > + if (lastSlash == WTF::notFound) { > + result.setPath({ }); > + return result; > + } > + > + result.setPath(path.substring(0, lastSlash + 1)); > + return result;
Just do: URL(url, "./"). What's what service worker code does. Also, we should this help function scopeURL or computeScopeURL or something. "containing URL" is not really a nominal terminology.
David Quesada
Comment 4
2018-02-02 08:36:29 PST
(In reply to Ryosuke Niwa from
comment #3
)
> Comment on
attachment 332910
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=332910&action=review
> > > Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.cpp:211 > > + URL result { url }; > > + > > + result.removeQueryAndFragmentIdentifier(); > > + > > + auto path = result.path(); > > + if (path.endsWith('/')) > > + return result; > > + > > + auto lastSlash = path.reverseFind('/'); > > + if (lastSlash == WTF::notFound) { > > + result.setPath({ }); > > + return result; > > + } > > + > > + result.setPath(path.substring(0, lastSlash + 1)); > > + return result; > > Just do: URL(url, "./"). What's what service worker code does.
That's a lot cleaner. I'll use that instead.
> Also, we should this help function scopeURL or computeScopeURL or something. > "containing URL" is not really a nominal terminology.
David Quesada
Comment 5
2018-02-02 08:41:26 PST
Created
attachment 332973
[details]
Patch v2
Ryosuke Niwa
Comment 6
2018-02-02 14:30:03 PST
Comment on
attachment 332973
[details]
Patch v2 View in context:
https://bugs.webkit.org/attachment.cgi?id=332973&action=review
> Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.cpp:198 > - return { }; > + return { startURL, "./" };
Hm... I would have preferred to have a helper function like you did earlier.
David Quesada
Comment 7
2018-02-02 14:39:24 PST
(In reply to Ryosuke Niwa from
comment #6
)
> Comment on
attachment 332973
[details]
> Patch v2 > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=332973&action=review
> > > Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.cpp:198 > > - return { }; > > + return { startURL, "./" }; > > Hm... I would have preferred to have a helper function like you did earlier.
I'm open to adding back a helper function. How does `void defaultScopeURL(const URL& startURL)` sound?
Ryosuke Niwa
Comment 8
2018-02-02 15:02:36 PST
Comment on
attachment 332973
[details]
Patch v2 View in context:
https://bugs.webkit.org/attachment.cgi?id=332973&action=review
>>> Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.cpp:198 >>> + return { startURL, "./" }; >> >> Hm... I would have preferred to have a helper function like you did earlier. > > I'm open to adding back a helper function. How does `void defaultScopeURL(const URL& startURL)` sound?
Sure that sounds good. Alternatively, you could just compute it once at the top of the function as defaultScopeURL local variable since this isn't a perf sensitive code.
David Quesada
Comment 9
2018-02-02 15:47:48 PST
Created
attachment 333011
[details]
Patch for landing
WebKit Commit Bot
Comment 10
2018-02-02 16:50:00 PST
Comment on
attachment 333011
[details]
Patch for landing Clearing flags on attachment: 333011 Committed
r228036
: <
https://trac.webkit.org/changeset/228036
>
WebKit Commit Bot
Comment 11
2018-02-02 16:50:02 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug