Attention is currently required from: Dmitry Gozman, Dominick Ng, Mike West.
Javier Fernandez would like Dominick Ng, Dmitry Gozman and Mike West to review this change.
Move the Protocol Handler URL's syntax to blink
The Custom Handlers spec defines some URL's syntax checks [1] that
must be passed in order to accept registerProtocolHandler requests.
These checks are implemented in blink's navigatorcontentutils module
and intended to be executed by the renderer process only.
The idea of this CL is to move the URL's syntax check logic to the
blink's common folder, specifically the protocol_handler_utils.cc
file, where there are several static functions executed by both, the
renderer and browser processes.
Thanks to this refactoring, this CL also adds the URL's syntax checks
in the WebContentsImpl class, so that they are executed in by the
browser process.
Change-Id: I56fafa1d3392d5b79aab28c799e51d4b40f6a1b4
---
M components/custom_handlers/protocol_handler.cc
M content/browser/web_contents/web_contents_impl.cc
M content/browser/web_contents/web_contents_impl_unittest.cc
M third_party/blink/common/custom_handlers/protocol_handler_utils.cc
M third_party/blink/public/common/custom_handlers/protocol_handler_utils.h
M third_party/blink/renderer/modules/navigatorcontentutils/navigator_content_utils.cc
6 files changed, 109 insertions(+), 10 deletions(-)
To view, visit change 3692750. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Dmitry Gozman, Dominick Ng, Mike West.
Attention is currently required from: Dmitry Gozman, Dominick Ng, Fabio Rocha, Mike West, Samuel Tang.
Javier Fernandez would like Fabio Rocha and Samuel Tang to review this change.
Move the Protocol Handler URL's syntax to blink
The Custom Handlers spec defines some URL's syntax checks [1] that
must be passed in order to accept registerProtocolHandler requests.
These checks are implemented in blink's navigatorcontentutils module
and intended to be executed by the renderer process only.
The idea of this CL is to move the URL's syntax check logic to the
blink's common folder, specifically the protocol_handler_utils.cc
file, where there are several static functions executed by both, the
renderer and browser processes.
Thanks to this refactoring, this CL also adds the URL's syntax checks
in the WebContentsImpl class, so that they are executed in by the
browser process.
Change-Id: I56fafa1d3392d5b79aab28c799e51d4b40f6a1b4
---
M components/custom_handlers/protocol_handler.cc
M content/browser/web_contents/web_contents_impl.cc
M content/browser/web_contents/web_contents_impl_unittest.cc
M third_party/blink/common/custom_handlers/protocol_handler_utils.cc
M third_party/blink/public/common/custom_handlers/protocol_handler_utils.h
M third_party/blink/renderer/modules/navigatorcontentutils/navigator_content_utils.cc
6 files changed, 109 insertions(+), 10 deletions(-)
To view, visit change 3692750. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Dmitry Gozman, Dominick Ng, Fabio Rocha, Mike West, Samuel Tang.
1 comment:
Patchset:
Adding Fabio and Samuel in Cc, since this change may affect the PWA as Custom Handler feature.
To view, visit change 3692750. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Dmitry Gozman, Fabio Rocha, Javier Fernandez, Mike West, Samuel Tang.
Patch set 5:Code-Review +1
6 comments:
Patchset:
LGTM % nits
File content/browser/web_contents/web_contents_impl.cc:
// TODO(jfernandez): Should we include syntax checks (step 3) as we do in the
// renderer process ?
Remove?
File third_party/blink/common/custom_handlers/protocol_handler_utils.cc:
if (full_url.is_empty() || !full_url.is_valid()) {
return URLSyntaxErrorCode::kInvalidURL;
}
Here and above: be consistent with the use of braces. This file seems to consistently omit them for 1-line conditionals.
File third_party/blink/public/common/custom_handlers/protocol_handler_utils.h:
Patch Set #5, Line 23: kInvalidURL
Nit: kInvalidUrl (style guide says to only capitalise the first letter of acronyms)
File third_party/blink/renderer/modules/navigatorcontentutils/navigator_content_utils.cc:
Patch Set #5, Line 153: DCHECK
Nit: DCHECK_EQ
if (code == URLSyntaxErrorCode::kMissingToken) {
error_message =
"The url provided ('" + user_url + "') does not contain '%s'.";
return false;
}
if (code == URLSyntaxErrorCode::kInvalidURL) {
error_message =
"The custom handler URL created by removing '%s' and prepending '" +
base_url.GetString() + "' is invalid.";
return false;
}
DCHECK(code == URLSyntaxErrorCode::kNoError);
Consider using a switch statement on the enum value - then you don't need the DCHECK since the switch will guarantee it
To view, visit change 3692750. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Dmitry Gozman, Fabio Rocha, Mike West, Samuel Tang.
3 comments:
Patchset:
Thanks for the reviews.
I'll submit ASAP a new patch with the suggested changes.
File content/browser/web_contents/web_contents_impl.cc:
// TODO(jfernandez): Should we include syntax checks (step 3) as we do in the
// renderer process ?
Remove?
Ack
File third_party/blink/common/custom_handlers/protocol_handler_utils.cc:
if (full_url.is_empty() || !full_url.is_valid()) {
return URLSyntaxErrorCode::kInvalidURL;
}
Here and above: be consistent with the use of braces. […]
Ack
To view, visit change 3692750. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Dmitry Gozman, Fabio Rocha, Javier Fernandez, Samuel Tang.
Patch set 7:Code-Review +1
1 comment:
Patchset:
LGTM.
To view, visit change 3692750. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Fabio Rocha, Javier Fernandez, Samuel Tang.
To view, visit change 3692750. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Fabio Rocha, Javier Fernandez, Samuel Tang.
Patch set 7:Commit-Queue +2
Chromium LUCI CQ submitted this change.
Move the Protocol Handler URL's syntax to blink
The Custom Handlers spec defines some URL's syntax checks [1] that
must be passed in order to accept registerProtocolHandler requests.
These checks are implemented in blink's navigatorcontentutils module
and intended to be executed by the renderer process only.
The idea of this CL is to move the URL's syntax check logic to the
blink's common folder, specifically the protocol_handler_utils.cc
file, where there are several static functions executed by both, the
renderer and browser processes.
Thanks to this refactoring, this CL also adds the URL's syntax checks
in the WebContentsImpl class, so that they are executed in by the
browser process.
Change-Id: I56fafa1d3392d5b79aab28c799e51d4b40f6a1b4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3692750
Reviewed-by: Dominick Ng <domi...@chromium.org>
Reviewed-by: Mike West <mk...@chromium.org>
Reviewed-by: Dmitry Gozman <dgo...@chromium.org>
Commit-Queue: Javier Fernandez <jfern...@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1019393}
---
M components/custom_handlers/protocol_handler.cc
M content/browser/web_contents/web_contents_impl.cc
M content/browser/web_contents/web_contents_impl_unittest.cc
M third_party/blink/common/custom_handlers/protocol_handler_utils.cc
M third_party/blink/public/common/custom_handlers/protocol_handler_utils.h
M third_party/blink/renderer/modules/navigatorcontentutils/navigator_content_utils.cc
6 files changed, 124 insertions(+), 21 deletions(-)