Remove did-get-response-details and did-get-redirect-request events
https://chromium-review.googlesource.com/c/chromium/src/+/805008 https://chromium-review.googlesource.com/c/chromium/src/+/786320
This commit is contained in:
parent
3da6450b0c
commit
7b47d69efe
9 changed files with 0 additions and 148 deletions
|
@ -82,7 +82,6 @@
|
||||||
#include "content/public/browser/render_view_host.h"
|
#include "content/public/browser/render_view_host.h"
|
||||||
#include "content/public/browser/render_widget_host.h"
|
#include "content/public/browser/render_widget_host.h"
|
||||||
#include "content/public/browser/render_widget_host_view.h"
|
#include "content/public/browser/render_widget_host_view.h"
|
||||||
#include "content/public/browser/resource_request_details.h"
|
|
||||||
#include "content/public/browser/service_worker_context.h"
|
#include "content/public/browser/service_worker_context.h"
|
||||||
#include "content/public/browser/site_instance.h"
|
#include "content/public/browser/site_instance.h"
|
||||||
#include "content/public/browser/storage_partition.h"
|
#include "content/public/browser/storage_partition.h"
|
||||||
|
@ -871,30 +870,6 @@ void WebContents::DidStopLoading() {
|
||||||
Emit("did-stop-loading");
|
Emit("did-stop-loading");
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::DidGetResourceResponseStart(
|
|
||||||
const content::ResourceRequestDetails& details) {
|
|
||||||
// Plznavigate is using blob URLs to deliver the body
|
|
||||||
// of the main resource to the renderer process. This
|
|
||||||
// gets better in the future with kNavigationMojoResponse
|
|
||||||
// feature, which replaces this mechanism with Mojo Datapipe.
|
|
||||||
if (details.url.SchemeIsBlob() &&
|
|
||||||
(details.resource_type == content::RESOURCE_TYPE_MAIN_FRAME ||
|
|
||||||
details.resource_type == content::RESOURCE_TYPE_SUB_FRAME))
|
|
||||||
return;
|
|
||||||
Emit("-did-get-response-details", details.socket_address.IsEmpty(),
|
|
||||||
details.url, details.original_url, details.http_response_code,
|
|
||||||
details.method, details.referrer, details.headers.get(),
|
|
||||||
ResourceTypeToString(details.resource_type));
|
|
||||||
}
|
|
||||||
|
|
||||||
void WebContents::DidGetRedirectForResourceRequest(
|
|
||||||
const content::ResourceRedirectDetails& details) {
|
|
||||||
Emit("-did-get-redirect-request", details.url, details.new_url,
|
|
||||||
(details.resource_type == content::RESOURCE_TYPE_MAIN_FRAME),
|
|
||||||
details.http_response_code, details.method, details.referrer,
|
|
||||||
details.headers.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
void WebContents::DidStartNavigation(
|
void WebContents::DidStartNavigation(
|
||||||
content::NavigationHandle* navigation_handle) {
|
content::NavigationHandle* navigation_handle) {
|
||||||
bool is_main_frame = navigation_handle->IsInMainFrame();
|
bool is_main_frame = navigation_handle->IsInMainFrame();
|
||||||
|
|
|
@ -353,10 +353,6 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||||
const base::string16& error_description) override;
|
const base::string16& error_description) override;
|
||||||
void DidStartLoading() override;
|
void DidStartLoading() override;
|
||||||
void DidStopLoading() override;
|
void DidStopLoading() override;
|
||||||
void DidGetResourceResponseStart(
|
|
||||||
const content::ResourceRequestDetails& details) override;
|
|
||||||
void DidGetRedirectForResourceRequest(
|
|
||||||
const content::ResourceRedirectDetails& details) override;
|
|
||||||
void DidStartNavigation(
|
void DidStartNavigation(
|
||||||
content::NavigationHandle* navigation_handle) override;
|
content::NavigationHandle* navigation_handle) override;
|
||||||
void DidFinishNavigation(
|
void DidFinishNavigation(
|
||||||
|
|
|
@ -93,39 +93,6 @@ Corresponds to the points in time when the spinner of the tab started spinning.
|
||||||
|
|
||||||
Corresponds to the points in time when the spinner of the tab stopped spinning.
|
Corresponds to the points in time when the spinner of the tab stopped spinning.
|
||||||
|
|
||||||
#### Event: 'did-get-response-details' *(Deprecated)*
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
* `event` Event
|
|
||||||
* `status` Boolean
|
|
||||||
* `newURL` String
|
|
||||||
* `originalURL` String
|
|
||||||
* `httpResponseCode` Integer
|
|
||||||
* `requestMethod` String
|
|
||||||
* `referrer` String
|
|
||||||
* `headers` Object
|
|
||||||
* `resourceType` String
|
|
||||||
|
|
||||||
Emitted when details regarding a requested resource are available.
|
|
||||||
`status` indicates the socket connection to download the resource.
|
|
||||||
|
|
||||||
**Deprecated**: This event has been deprecated. Use the [`webRequest`](web-request.md) module which provides similar navigation details on a subscription basis.
|
|
||||||
#### Event: 'did-get-redirect-request' *(Deprecated)*
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
* `event` Event
|
|
||||||
* `oldURL` String
|
|
||||||
* `newURL` String
|
|
||||||
* `isMainFrame` Boolean
|
|
||||||
* `httpResponseCode` Integer
|
|
||||||
* `requestMethod` String
|
|
||||||
* `referrer` String
|
|
||||||
* `headers` Object
|
|
||||||
|
|
||||||
Emitted when a redirect is received while requesting a resource.
|
|
||||||
**Deprecated**: This event has been deprecated. Use the [`webRequest`](web-request.md) module which provides similar navigation details on a subscription basis.
|
|
||||||
#### Event: 'dom-ready'
|
#### Event: 'dom-ready'
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
|
@ -663,33 +663,6 @@ Corresponds to the points in time when the spinner of the tab starts spinning.
|
||||||
|
|
||||||
Corresponds to the points in time when the spinner of the tab stops spinning.
|
Corresponds to the points in time when the spinner of the tab stops spinning.
|
||||||
|
|
||||||
### Event: 'did-get-response-details' *(Deprecated)*
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
* `status` Boolean
|
|
||||||
* `newURL` String
|
|
||||||
* `originalURL` String
|
|
||||||
* `httpResponseCode` Integer
|
|
||||||
* `requestMethod` String
|
|
||||||
* `referrer` String
|
|
||||||
* `headers` Object
|
|
||||||
* `resourceType` String
|
|
||||||
|
|
||||||
Fired when details regarding a requested resource is available.
|
|
||||||
`status` indicates socket connection to download the resource.
|
|
||||||
|
|
||||||
**Deprecated**: This event has been deprecated. Use the [`webRequest`](web-request.md) module which provides similar navigation details on a subscription basis.
|
|
||||||
### Event: 'did-get-redirect-request' *(Deprecated)*
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
* `oldURL` String
|
|
||||||
* `newURL` String
|
|
||||||
* `isMainFrame` Boolean
|
|
||||||
|
|
||||||
Fired when a redirect was received while requesting a resource.
|
|
||||||
**Deprecated**: This event has been deprecated. Use the [`webRequest`](web-request.md) module which provides similar navigation details on a subscription basis.
|
|
||||||
### Event: 'dom-ready'
|
### Event: 'dom-ready'
|
||||||
|
|
||||||
Fired when document in the given frame is loaded.
|
Fired when document in the given frame is loaded.
|
||||||
|
|
|
@ -14,8 +14,6 @@ const supportedWebViewEvents = [
|
||||||
'did-frame-finish-load',
|
'did-frame-finish-load',
|
||||||
'did-start-loading',
|
'did-start-loading',
|
||||||
'did-stop-loading',
|
'did-stop-loading',
|
||||||
'-did-get-response-details',
|
|
||||||
'-did-get-redirect-request',
|
|
||||||
'dom-ready',
|
'dom-ready',
|
||||||
'console-message',
|
'console-message',
|
||||||
'context-menu',
|
'context-menu',
|
||||||
|
|
|
@ -12,8 +12,6 @@ const WEB_VIEW_EVENTS = {
|
||||||
'did-frame-finish-load': ['isMainFrame', 'frameProcessId', 'frameRoutingId'],
|
'did-frame-finish-load': ['isMainFrame', 'frameProcessId', 'frameRoutingId'],
|
||||||
'did-start-loading': [],
|
'did-start-loading': [],
|
||||||
'did-stop-loading': [],
|
'did-stop-loading': [],
|
||||||
'-did-get-response-details': ['status', 'newURL', 'originalURL', 'httpResponseCode', 'requestMethod', 'referrer', 'headers', 'resourceType'],
|
|
||||||
'-did-get-redirect-request': ['oldURL', 'newURL', 'isMainFrame'],
|
|
||||||
'dom-ready': [],
|
'dom-ready': [],
|
||||||
'console-message': ['level', 'message', 'line', 'sourceId'],
|
'console-message': ['level', 'message', 'line', 'sourceId'],
|
||||||
'context-menu': ['params'],
|
'context-menu': ['params'],
|
||||||
|
|
|
@ -157,8 +157,6 @@ describe('BrowserWindow module', () => {
|
||||||
it('should not crash when invoked synchronously inside navigation observer', (done) => {
|
it('should not crash when invoked synchronously inside navigation observer', (done) => {
|
||||||
const events = [
|
const events = [
|
||||||
{ name: 'did-start-loading', url: `${server.url}/200` },
|
{ name: 'did-start-loading', url: `${server.url}/200` },
|
||||||
{ name: '-did-get-redirect-request', url: `${server.url}/301` },
|
|
||||||
{ name: '-did-get-response-details', url: `${server.url}/200` },
|
|
||||||
{ name: 'dom-ready', url: `${server.url}/200` },
|
{ name: 'dom-ready', url: `${server.url}/200` },
|
||||||
{ name: 'page-title-updated', url: `${server.url}/title` },
|
{ name: 'page-title-updated', url: `${server.url}/title` },
|
||||||
{ name: 'did-stop-loading', url: `${server.url}/200` },
|
{ name: 'did-stop-loading', url: `${server.url}/200` },
|
||||||
|
@ -223,30 +221,6 @@ describe('BrowserWindow module', () => {
|
||||||
w.on('ready-to-show', () => { done() })
|
w.on('ready-to-show', () => { done() })
|
||||||
w.loadURL('about:blank')
|
w.loadURL('about:blank')
|
||||||
})
|
})
|
||||||
// TODO(nitsakh): Deprecated
|
|
||||||
it('should emit did-get-response-details(deprecated) event', (done) => {
|
|
||||||
// expected {fileName: resourceType} pairs
|
|
||||||
const expectedResources = {
|
|
||||||
'did-get-response-details.html': 'mainFrame',
|
|
||||||
'logo.png': 'image'
|
|
||||||
}
|
|
||||||
let responses = 0
|
|
||||||
w.webContents.on('-did-get-response-details', (event, status, newUrl, oldUrl, responseCode, method, referrer, headers, resourceType) => {
|
|
||||||
responses += 1
|
|
||||||
const fileName = newUrl.slice(newUrl.lastIndexOf('/') + 1)
|
|
||||||
const expectedType = expectedResources[fileName]
|
|
||||||
assert(!!expectedType, `Unexpected response details for ${newUrl}`)
|
|
||||||
assert(typeof status === 'boolean', 'status should be boolean')
|
|
||||||
assert.equal(responseCode, 200)
|
|
||||||
assert.equal(method, 'GET')
|
|
||||||
assert(typeof referrer === 'string', 'referrer should be string')
|
|
||||||
assert(!!headers, 'headers should be present')
|
|
||||||
assert(typeof headers === 'object', 'headers should be object')
|
|
||||||
assert.equal(resourceType, expectedType, 'Incorrect resourceType')
|
|
||||||
if (responses === Object.keys(expectedResources).length) done()
|
|
||||||
})
|
|
||||||
w.loadURL(`file://${path.join(fixtures, 'pages', 'did-get-response-details.html')}`)
|
|
||||||
})
|
|
||||||
it('should emit did-fail-load event for files that do not exist', (done) => {
|
it('should emit did-fail-load event for files that do not exist', (done) => {
|
||||||
w.webContents.on('did-fail-load', (event, code, desc, url, isMainFrame) => {
|
w.webContents.on('did-fail-load', (event, code, desc, url, isMainFrame) => {
|
||||||
assert.equal(code, -6)
|
assert.equal(code, -6)
|
||||||
|
|
|
@ -650,8 +650,6 @@ describe('webContents module', () => {
|
||||||
it('should not crash when invoked synchronously inside navigation observer', (done) => {
|
it('should not crash when invoked synchronously inside navigation observer', (done) => {
|
||||||
const events = [
|
const events = [
|
||||||
{ name: 'did-start-loading', url: `${server.url}/200` },
|
{ name: 'did-start-loading', url: `${server.url}/200` },
|
||||||
{ name: '-did-get-redirect-request', url: `${server.url}/301` },
|
|
||||||
{ name: '-did-get-response-details', url: `${server.url}/200` },
|
|
||||||
{ name: 'dom-ready', url: `${server.url}/200` },
|
{ name: 'dom-ready', url: `${server.url}/200` },
|
||||||
{ name: 'did-stop-loading', url: `${server.url}/200` },
|
{ name: 'did-stop-loading', url: `${server.url}/200` },
|
||||||
{ name: 'did-finish-load', url: `${server.url}/200` },
|
{ name: 'did-finish-load', url: `${server.url}/200` },
|
||||||
|
|
|
@ -1121,33 +1121,6 @@ describe('<webview> tag', function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('did-get-response-details event (deprecated)', () => {
|
|
||||||
it('emits for the page and its resources', (done) => {
|
|
||||||
// expected {fileName: resourceType} pairs
|
|
||||||
const expectedResources = {
|
|
||||||
'did-get-response-details.html': 'mainFrame',
|
|
||||||
'logo.png': 'image'
|
|
||||||
}
|
|
||||||
let responses = 0
|
|
||||||
webview.addEventListener('-did-get-response-details', (event) => {
|
|
||||||
responses += 1
|
|
||||||
const fileName = event.newURL.slice(event.newURL.lastIndexOf('/') + 1)
|
|
||||||
const expectedType = expectedResources[fileName]
|
|
||||||
assert(!!expectedType, `Unexpected response details for ${event.newURL}`)
|
|
||||||
assert(typeof event.status === 'boolean', 'status should be boolean')
|
|
||||||
assert.equal(event.httpResponseCode, 200)
|
|
||||||
assert.equal(event.requestMethod, 'GET')
|
|
||||||
assert(typeof event.referrer === 'string', 'referrer should be string')
|
|
||||||
assert(!!event.headers, 'headers should be present')
|
|
||||||
assert(typeof event.headers === 'object', 'headers should be object')
|
|
||||||
assert.equal(event.resourceType, expectedType, 'Incorrect resourceType')
|
|
||||||
if (responses === Object.keys(expectedResources).length) done()
|
|
||||||
})
|
|
||||||
webview.src = `file://${path.join(fixtures, 'pages', 'did-get-response-details.html')}`
|
|
||||||
document.body.appendChild(webview)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('document.visibilityState/hidden', () => {
|
describe('document.visibilityState/hidden', () => {
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
ipcMain.removeAllListeners('pong')
|
ipcMain.removeAllListeners('pong')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue