Declarative Net Request: Collapse DOM elements for which network request is blocked. |
||||
Issue descriptionDOM elements for which a network request is blocked through the declarative net request API should be automatically removed from the DOM. This is necessary since there is no easy way for extensions to do this when using DNR. This should probably be applicable to: - <img>, <iframe>, <object>, <embed> DOM elements.
,
Jun 2 2018
+mmenke@ and +jam@: Context: We block network requests when requested by extensions in the browser process. For example, this can happen for image and iframe sources. We'd like to provide the ability for these DOM elements to be automatically collapsed (think display:none). Can you advise regarding what would be a good way to plumb this info. to the renderer? The most simple way would be to just add another network error code (say net::ERR_CONTENT_BLOCKED or net::ERR_BLOCK_AND_COLLAPSE, currently extensions use net::ERR_BLOCKED_BY_CLIENT), but I am not sure if that's "clean" enough. Alternatively, we might be able to plumb this info. through URLLoaderCompletionStatus. Thoughts?
,
Jun 2 2018
How extensions hook up is being completely changed, with the advent of the network service - not familiar with the new way at all. That having been said, there's an extended error field now, and (I think) there's an enum in blink somewhere used to populate it, when the main error is ERR_BLOCKED_BY_CLIENT.
,
Jun 19 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/87b9031e7435b3422369e0b01d47f5e56e89d444 commit 87b9031e7435b3422369e0b01d47f5e56e89d444 Author: Karan Bhatia <karandeepb@chromium.org> Date: Tue Jun 19 03:54:24 2018 Declarative Net Request: Collapse blocked <img> elements. With Declarative Net Request, there is no easy way for extensions to collapse the DOM elements corresponding to the resources they blocked. This CL implements the ability for the blocked <img> elements to be automatically collapsed in the DOM. In subsequent CLs, similar function will be implemented for other DOM elements. To do this, following changes are made: - A new field called kCollapsedByClient is added to blink::ResourceRequestBlockedReason. Whenever an extension ruleset wants to collapse the DOM element corresponding to a network request, the extended_error_code is set to kCollapsedByClient, which is then used as a signal by the renderer to perform the collapsing. - Changes to blink::ResourceRequestBlockedReason also necessiate changes to the Devtools protocol. As a good side-effect, resources collapsed by extensions would be marked as "collapsed-by-client" by Devtools. - Changes are made to allow content embedders to set a blink::ResourceRequestBlockedReason for a request. BUG=848842 Cq-Include-Trybots: luci.chromium.try:linux_mojo Change-Id: I0bfd1a60bee79ef651741b7655fade6be4a7d419 Reviewed-on: https://chromium-review.googlesource.com/1088189 Commit-Queue: Matt Menke <mmenke@chromium.org> Reviewed-by: Istiaque Ahmed <lazyboy@chromium.org> Reviewed-by: Nasko Oskov <nasko@chromium.org> Reviewed-by: Nate Chapin <japhet@chromium.org> Reviewed-by: Andrey Kosyakov <caseq@chromium.org> Reviewed-by: Dmitry Gozman <dgozman@chromium.org> Reviewed-by: Matt Menke <mmenke@chromium.org> Cr-Commit-Position: refs/heads/master@{#568332} [modify] https://crrev.com/87b9031e7435b3422369e0b01d47f5e56e89d444/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc [modify] https://crrev.com/87b9031e7435b3422369e0b01d47f5e56e89d444/chrome/browser/net/chrome_extensions_network_delegate.cc [add] https://crrev.com/87b9031e7435b3422369e0b01d47f5e56e89d444/chrome/test/data/extensions/declarative_net_request/image.html [modify] https://crrev.com/87b9031e7435b3422369e0b01d47f5e56e89d444/content/browser/devtools/devtools_url_interceptor_request_job.cc [modify] https://crrev.com/87b9031e7435b3422369e0b01d47f5e56e89d444/content/browser/devtools/protocol/network_handler.cc [modify] https://crrev.com/87b9031e7435b3422369e0b01d47f5e56e89d444/content/browser/loader/resource_request_info_impl.cc [modify] https://crrev.com/87b9031e7435b3422369e0b01d47f5e56e89d444/content/browser/loader/resource_request_info_impl.h [modify] https://crrev.com/87b9031e7435b3422369e0b01d47f5e56e89d444/content/public/browser/resource_request_info.h [modify] https://crrev.com/87b9031e7435b3422369e0b01d47f5e56e89d444/extensions/browser/api/declarative_net_request/ruleset_manager.cc [modify] https://crrev.com/87b9031e7435b3422369e0b01d47f5e56e89d444/extensions/browser/api/declarative_net_request/ruleset_manager.h [modify] https://crrev.com/87b9031e7435b3422369e0b01d47f5e56e89d444/extensions/browser/api/web_request/web_request_api.cc [modify] https://crrev.com/87b9031e7435b3422369e0b01d47f5e56e89d444/extensions/browser/api/web_request/web_request_api.h [modify] https://crrev.com/87b9031e7435b3422369e0b01d47f5e56e89d444/extensions/browser/api/web_request/web_request_proxying_url_loader_factory.cc [modify] https://crrev.com/87b9031e7435b3422369e0b01d47f5e56e89d444/extensions/browser/api/web_request/web_request_proxying_websocket.cc [modify] https://crrev.com/87b9031e7435b3422369e0b01d47f5e56e89d444/extensions/shell/browser/shell_network_delegate.cc [modify] https://crrev.com/87b9031e7435b3422369e0b01d47f5e56e89d444/third_party/blink/public/platform/resource_request_blocked_reason.h [modify] https://crrev.com/87b9031e7435b3422369e0b01d47f5e56e89d444/third_party/blink/renderer/core/inspector/browser_protocol.pdl [modify] https://crrev.com/87b9031e7435b3422369e0b01d47f5e56e89d444/third_party/blink/renderer/core/inspector/inspector_network_agent.cc [modify] https://crrev.com/87b9031e7435b3422369e0b01d47f5e56e89d444/third_party/blink/renderer/devtools/front_end/network/NetworkDataGridNode.js [modify] https://crrev.com/87b9031e7435b3422369e0b01d47f5e56e89d444/third_party/blink/renderer/platform/loader/fetch/resource_error.cc [modify] https://crrev.com/87b9031e7435b3422369e0b01d47f5e56e89d444/third_party/blink/renderer/platform/loader/fetch/resource_error.h
,
Jun 26 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/6753ffc106c4c48af4eb250e08a9aa1ee8a86ade commit 6753ffc106c4c48af4eb250e08a9aa1ee8a86ade Author: Karan Bhatia <karandeepb@chromium.org> Date: Tue Jun 26 04:04:35 2018 Declarative Net Request: Collapse blocked <iframe> elements. With Declarative Net Request, there is no easy way for extensions to collapse the DOM elements corresponding to the resources they blocked. This CL implements the ability for the blocked <iframe> elements to be automatically collapsed in the DOM. BUG=848842 Change-Id: Iaf9ce75b5dc1a978a09e1ae698f2ed180351c288 Reviewed-on: https://chromium-review.googlesource.com/1111341 Commit-Queue: Karan Bhatia <karandeepb@chromium.org> Reviewed-by: Camille Lamy <clamy@chromium.org> Reviewed-by: Istiaque Ahmed <lazyboy@chromium.org> Cr-Commit-Position: refs/heads/master@{#570327} [modify] https://crrev.com/6753ffc106c4c48af4eb250e08a9aa1ee8a86ade/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc [modify] https://crrev.com/6753ffc106c4c48af4eb250e08a9aa1ee8a86ade/chrome/test/data/extensions/declarative_net_request/page_with_two_frames.html [modify] https://crrev.com/6753ffc106c4c48af4eb250e08a9aa1ee8a86ade/content/browser/frame_host/navigation_handle_impl.cc [modify] https://crrev.com/6753ffc106c4c48af4eb250e08a9aa1ee8a86ade/content/browser/frame_host/navigation_request.cc [modify] https://crrev.com/6753ffc106c4c48af4eb250e08a9aa1ee8a86ade/content/browser/frame_host/navigation_request.h [modify] https://crrev.com/6753ffc106c4c48af4eb250e08a9aa1ee8a86ade/extensions/browser/api/declarative_net_request/ruleset_manager.cc
,
Jun 27 2018
Follow-up work is to also collapse <embed> and <object> tags. But this shouldn't be blocking issue 696822 anymore.
,
Jun 27 2018
,
Aug 24
|
||||
►
Sign in to add a comment |
||||
Comment 1 by karandeepb@chromium.org
, Jun 1 2018Cc: rdevlin....@chromium.org lazyboy@chromium.org
Components: Platform>Extensions