From 98d32536ccddcb2ee400f3fc2078c73ef5fde2aa Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Sat, 26 Jun 2021 02:27:50 +0200 Subject: [PATCH 1/2] feat: add missing resourceType conversions for webRequest listener details --- docs/api/web-request.md | 16 +++++------ shell/browser/api/electron_api_web_request.cc | 28 ++++++++++--------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/docs/api/web-request.md b/docs/api/web-request.md index 5f6be21269be0..3c69117e52a4d 100644 --- a/docs/api/web-request.md +++ b/docs/api/web-request.md @@ -53,7 +53,7 @@ The following methods are available on instances of `WebRequest`: * `webContentsId` Integer (optional) * `webContents` WebContents (optional) * `frame` WebFrameMain (optional) - * `resourceType` String + * `resourceType` String - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`. * `referrer` String * `timestamp` Double * `uploadData` [UploadData[]](structures/upload-data.md) @@ -98,7 +98,7 @@ Some examples of valid `urls`: * `webContentsId` Integer (optional) * `webContents` WebContents (optional) * `frame` WebFrameMain (optional) - * `resourceType` String + * `resourceType` String - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`. * `referrer` String * `timestamp` Double * `requestHeaders` Record @@ -127,7 +127,7 @@ The `callback` has to be called with a `response` object. * `webContentsId` Integer (optional) * `webContents` WebContents (optional) * `frame` WebFrameMain (optional) - * `resourceType` String + * `resourceType` String - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`. * `referrer` String * `timestamp` Double * `requestHeaders` Record @@ -149,7 +149,7 @@ response are visible by the time this listener is fired. * `webContentsId` Integer (optional) * `webContents` WebContents (optional) * `frame` WebFrameMain (optional) - * `resourceType` String + * `resourceType` String - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`. * `referrer` String * `timestamp` Double * `statusLine` String @@ -182,7 +182,7 @@ The `callback` has to be called with a `response` object. * `webContentsId` Integer (optional) * `webContents` WebContents (optional) * `frame` WebFrameMain (optional) - * `resourceType` String + * `resourceType` String - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`. * `referrer` String * `timestamp` Double * `responseHeaders` Record (optional) @@ -208,7 +208,7 @@ and response headers are available. * `webContentsId` Integer (optional) * `webContents` WebContents (optional) * `frame` WebFrameMain (optional) - * `resourceType` String + * `resourceType` String - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`. * `referrer` String * `timestamp` Double * `redirectURL` String @@ -235,7 +235,7 @@ redirect is about to occur. * `webContentsId` Integer (optional) * `webContents` WebContents (optional) * `frame` WebFrameMain (optional) - * `resourceType` String + * `resourceType` String - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`. * `referrer` String * `timestamp` Double * `responseHeaders` Record (optional) @@ -260,7 +260,7 @@ completed. * `webContentsId` Integer (optional) * `webContents` WebContents (optional) * `frame` WebFrameMain (optional) - * `resourceType` String + * `resourceType` String - Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`. * `referrer` String * `timestamp` Double * `fromCache` Boolean diff --git a/shell/browser/api/electron_api_web_request.cc b/shell/browser/api/electron_api_web_request.cc index 8dc4ed7a13330..621deff0cde20 100644 --- a/shell/browser/api/electron_api_web_request.cc +++ b/shell/browser/api/electron_api_web_request.cc @@ -29,19 +29,6 @@ namespace gin { -template <> -struct Converter { - static bool FromV8(v8::Isolate* isolate, - v8::Local val, - URLPattern* out) { - std::string pattern; - if (!ConvertFromV8(isolate, val, &pattern)) - return false; - *out = URLPattern(URLPattern::SCHEME_ALL); - return out->Parse(pattern) == URLPattern::ParseResult::kSuccess; - } -}; - template <> struct Converter { static v8::Local ToV8(v8::Isolate* isolate, @@ -63,12 +50,27 @@ struct Converter { case extensions::WebRequestResourceType::IMAGE: result = "image"; break; + case extensions::WebRequestResourceType::FONT: + result = "font"; + break; case extensions::WebRequestResourceType::OBJECT: result = "object"; break; case extensions::WebRequestResourceType::XHR: result = "xhr"; break; + case extensions::WebRequestResourceType::PING: + result = "ping"; + break; + case extensions::WebRequestResourceType::CSP_REPORT: + result = "cspReport"; + break; + case extensions::WebRequestResourceType::MEDIA: + result = "media"; + break; + case extensions::WebRequestResourceType::WEB_SOCKET: + result = "webSocket"; + break; default: result = "other"; } From c9c0974cba6257844b3b390ecc59d560604bee57 Mon Sep 17 00:00:00 2001 From: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Date: Thu, 8 Jul 2021 07:30:12 +0000 Subject: [PATCH 2/2] chore: update patches --- patches/chromium/webview_fullscreen.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/chromium/webview_fullscreen.patch b/patches/chromium/webview_fullscreen.patch index 44483526b7d84..e8449923d7cea 100644 --- a/patches/chromium/webview_fullscreen.patch +++ b/patches/chromium/webview_fullscreen.patch @@ -14,10 +14,10 @@ Note that we also need to manually update embedder's `api::WebContents::IsFullscreenForTabOrPending` value. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index 5c16a9ee9bbf461c24456613ff709f4f608e3441..4e4d1fdf50e2d480e099c9af71a45fc864d2cf56 100644 +index 6dfd547b9e6c4e345af79d4875be95fb6a6d8bb0..66bf5aea4d53e72e9b1f6fb0d7a64290db6c14b7 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -5520,6 +5520,15 @@ void RenderFrameHostImpl::EnterFullscreen( +@@ -5661,6 +5661,15 @@ void RenderFrameHostImpl::EnterFullscreen( notified_instances.insert(parent_site_instance); }