fix(webkit): support utf-8 characters in postData, bump to 1407 (#4744)
This commit is contained in:
Родитель
5a1c9f1fe1
Коммит
3219057ab0
|
@ -13,7 +13,7 @@
|
|||
},
|
||||
{
|
||||
"name": "webkit",
|
||||
"revision": "1402",
|
||||
"revision": "1407",
|
||||
"download": true
|
||||
}
|
||||
]
|
||||
|
|
|
@ -865,6 +865,44 @@ export module Protocol {
|
|||
*/
|
||||
sourceURL?: string;
|
||||
}
|
||||
/**
|
||||
* A representation of WebCore::Font. Conceptually this is backed by either a font file on disk or from the network.
|
||||
*/
|
||||
export interface Font {
|
||||
/**
|
||||
* The display name defined by the font.
|
||||
*/
|
||||
displayName: string;
|
||||
/**
|
||||
* The variation axes defined by the font.
|
||||
*/
|
||||
variationAxes: FontVariationAxis[];
|
||||
}
|
||||
/**
|
||||
* A single variation axis associated with a Font.
|
||||
*/
|
||||
export interface FontVariationAxis {
|
||||
/**
|
||||
* The name, generally human-readable, of the variation axis. Some axes may not provide a human-readable name distiguishable from the tag. This field is ommited when there is no name, or the name matches the tag exactly.
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* The four character tag for the variation axis.
|
||||
*/
|
||||
tag: string;
|
||||
/**
|
||||
* The minimum value that will affect the axis.
|
||||
*/
|
||||
minimumValue: number;
|
||||
/**
|
||||
* The maximum value that will affect the axis.
|
||||
*/
|
||||
maximumValue: number;
|
||||
/**
|
||||
* The value that is used for the axis when it is not otherwise controlled.
|
||||
*/
|
||||
defaultValue: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires whenever a MediaQuery result changes (for example, after a browser window has been resized.) The current implementation considers only viewport-dependent media features.
|
||||
|
@ -965,6 +1003,18 @@ export module Protocol {
|
|||
*/
|
||||
computedStyle: CSSComputedStyleProperty[];
|
||||
}
|
||||
/**
|
||||
* Returns the primary font of the computed font cascade for a DOM node identified by <code>nodeId</code>.
|
||||
*/
|
||||
export type getFontDataForNodeParameters = {
|
||||
nodeId: DOM.NodeId;
|
||||
}
|
||||
export type getFontDataForNodeReturnValue = {
|
||||
/**
|
||||
* Computed primary font for the specified DOM node.
|
||||
*/
|
||||
primaryFont: Font;
|
||||
}
|
||||
/**
|
||||
* Returns metainfo entries for all known stylesheets.
|
||||
*/
|
||||
|
@ -8492,6 +8542,7 @@ the top of the viewport and Y increases as it proceeds towards the bottom of the
|
|||
"CSS.getMatchedStylesForNode": CSS.getMatchedStylesForNodeParameters;
|
||||
"CSS.getInlineStylesForNode": CSS.getInlineStylesForNodeParameters;
|
||||
"CSS.getComputedStyleForNode": CSS.getComputedStyleForNodeParameters;
|
||||
"CSS.getFontDataForNode": CSS.getFontDataForNodeParameters;
|
||||
"CSS.getAllStyleSheets": CSS.getAllStyleSheetsParameters;
|
||||
"CSS.getStyleSheet": CSS.getStyleSheetParameters;
|
||||
"CSS.getStyleSheetText": CSS.getStyleSheetTextParameters;
|
||||
|
@ -8776,6 +8827,7 @@ the top of the viewport and Y increases as it proceeds towards the bottom of the
|
|||
"CSS.getMatchedStylesForNode": CSS.getMatchedStylesForNodeReturnValue;
|
||||
"CSS.getInlineStylesForNode": CSS.getInlineStylesForNodeReturnValue;
|
||||
"CSS.getComputedStyleForNode": CSS.getComputedStyleForNodeReturnValue;
|
||||
"CSS.getFontDataForNode": CSS.getFontDataForNodeReturnValue;
|
||||
"CSS.getAllStyleSheets": CSS.getAllStyleSheetsReturnValue;
|
||||
"CSS.getStyleSheet": CSS.getStyleSheetReturnValue;
|
||||
"CSS.getStyleSheetText": CSS.getStyleSheetTextReturnValue;
|
||||
|
|
|
@ -58,7 +58,7 @@ export class WKInterceptableRequest implements network.RouteDelegate {
|
|||
this._timestamp = event.timestamp;
|
||||
this._wallTime = event.walltime * 1000;
|
||||
if (event.request.postData)
|
||||
postDataBuffer = Buffer.from(event.request.postData, 'binary');
|
||||
postDataBuffer = Buffer.from(event.request.postData, 'base64');
|
||||
this.request = new network.Request(allowInterception ? this : null, frame, redirectedFrom, documentId, event.request.url,
|
||||
resourceType, event.request.method, postDataBuffer, headersObjectToArray(event.request.headers));
|
||||
this._interceptedPromise = new Promise(f => this._interceptedCallback = f);
|
||||
|
|
|
@ -95,3 +95,21 @@ it('should work with url match regular expression from a different context', asy
|
|||
]);
|
||||
expect(request.url()).toBe(server.PREFIX + '/digits/1.png');
|
||||
});
|
||||
|
||||
it('should return correct postData buffer for utf-8 body', async ({page, server}) => {
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
const value = 'baẞ';
|
||||
const [request] = await Promise.all([
|
||||
page.waitForRequest('**'),
|
||||
page.evaluate(({url, value}) => {
|
||||
const request = new Request(url, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(value),
|
||||
});
|
||||
request.headers.set('content-type', 'application/json;charset=UTF-8');
|
||||
return fetch(request);
|
||||
}, {url: server.PREFIX + '/title.html', value})
|
||||
]);
|
||||
expect(request.postDataBuffer().equals(Buffer.from(JSON.stringify(value), 'utf-8'))).toBe(true);
|
||||
expect(request.postDataJSON()).toBe(value);
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче