feat: add missing resourceType conversions for webRequest listener details (#29902)
This commit is contained in:
parent
13bf2fd7ec
commit
635ed5a6e3
2 changed files with 23 additions and 21 deletions
|
@ -54,7 +54,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)
|
||||
|
@ -99,7 +99,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<string, string>
|
||||
|
@ -128,7 +128,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<string, string>
|
||||
|
@ -150,7 +150,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
|
||||
|
@ -183,7 +183,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<string, string[]> (optional)
|
||||
|
@ -209,7 +209,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
|
||||
|
@ -236,7 +236,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<string, string[]> (optional)
|
||||
|
@ -261,7 +261,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
|
||||
|
|
|
@ -29,19 +29,6 @@
|
|||
|
||||
namespace gin {
|
||||
|
||||
template <>
|
||||
struct Converter<URLPattern> {
|
||||
static bool FromV8(v8::Isolate* isolate,
|
||||
v8::Local<v8::Value> 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<extensions::WebRequestResourceType> {
|
||||
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
||||
|
@ -63,12 +50,27 @@ struct Converter<extensions::WebRequestResourceType> {
|
|||
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";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue