mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix(webkit): improve orientation detection (#11481)
This commit is contained in:
parent
82c8baf9f6
commit
a65f7066d5
@ -732,6 +732,11 @@ export class WKPage implements PageDelegate {
|
||||
|
||||
private _calculateBootstrapScript(): string {
|
||||
const scripts: string[] = [];
|
||||
if (!this._page.context()._options.isMobile) {
|
||||
scripts.push('delete window.orientation');
|
||||
scripts.push('delete window.ondevicemotion');
|
||||
scripts.push('delete window.ondeviceorientation');
|
||||
}
|
||||
for (const binding of this._page.allBindings())
|
||||
scripts.push(this._bindingToScript(binding));
|
||||
scripts.push(...this._browserContext._evaluateOnNewDocumentSources);
|
||||
|
||||
@ -10,6 +10,11 @@ for (const name in Modernizr) {
|
||||
let value = Modernizr[name];
|
||||
report[name] = value;
|
||||
}
|
||||
|
||||
report['devicemotion2'] = 'ondevicemotion' in window;
|
||||
report['deviceorientation2'] = 'orientation' in window;
|
||||
report['deviceorientation3'] = 'ondeviceorientation' in window;
|
||||
|
||||
document.body.style.whiteSpace = 'pre';
|
||||
document.body.textContent = JSON.stringify(report, undefined, 4);
|
||||
window.report = JSON.parse(document.body.textContent);
|
||||
|
||||
@ -90,7 +90,10 @@
|
||||
"promises": true,
|
||||
"es6string": true,
|
||||
"devicemotion": true,
|
||||
"devicemotion2": true,
|
||||
"deviceorientation": true,
|
||||
"deviceorientation2": true,
|
||||
"deviceorientation3": true,
|
||||
"filereader": true,
|
||||
"urlparser": true,
|
||||
"urlsearchparams": true,
|
||||
|
||||
@ -90,7 +90,10 @@
|
||||
"promises": true,
|
||||
"es6string": true,
|
||||
"devicemotion": false,
|
||||
"devicemotion2": false,
|
||||
"deviceorientation": false,
|
||||
"deviceorientation2": false,
|
||||
"deviceorientation3": false,
|
||||
"filereader": true,
|
||||
"urlparser": true,
|
||||
"urlsearchparams": true,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user