Commit 22d82751 authored by wang's avatar wang

test

parent a55a4649
...@@ -395,7 +395,7 @@ function Window(options) { ...@@ -395,7 +395,7 @@ function Window(options) {
const statusbar = BarProp.create(window); const statusbar = BarProp.create(window);
const toolbar = BarProp.create(window); const toolbar = BarProp.create(window);
const external = External.create(window); const external = External.create(window);
const navigator = Navigator.create(window, [], { userAgent: this._resourceLoader._userAgent }); let navigator = Navigator.create(window, [], { userAgent: this._resourceLoader._userAgent });
const performance = Performance.create(window, [], { rawPerformance }); const performance = Performance.create(window, [], { rawPerformance });
const screen = Screen.create(window); const screen = Screen.create(window);
const customElementRegistry = CustomElementRegistry.create(window); const customElementRegistry = CustomElementRegistry.create(window);
...@@ -440,6 +440,89 @@ function Window(options) { ...@@ -440,6 +440,89 @@ function Window(options) {
return idlUtils.wrapperForImpl(idlUtils.implForWrapper(window._document)._history); return idlUtils.wrapperForImpl(idlUtils.implForWrapper(window._document)._history);
}, },
get navigator() { get navigator() {
navigator = new Proxy(navigator, {
ownKeys(t){
return [
"vendorSub",
"productSub",
"vendor",
"maxTouchPoints",
"scheduling",
"userActivation",
"doNotTrack",
"geolocation",
"connection",
"plugins",
"mimeTypes",
"pdfViewerEnabled",
"webkitTemporaryStorage",
"webkitPersistentStorage",
"hardwareConcurrency",
"cookieEnabled",
"appCodeName",
"appName",
"appVersion",
"platform",
"product",
"userAgent",
"language",
"languages",
"onLine",
"webdriver",
"getGamepads",
"javaEnabled",
"sendBeacon",
"vibrate",
"deprecatedRunAdAuctionEnforcesKAnonymity",
"bluetooth",
"clipboard",
"credentials",
"keyboard",
"managed",
"mediaDevices",
"storage",
"serviceWorker",
"virtualKeyboard",
"wakeLock",
"deviceMemory",
"login",
"ink",
"hid",
"locks",
"gpu",
"mediaCapabilities",
"mediaSession",
"permissions",
"presentation",
"usb",
"xr",
"serial",
"windowControlsOverlay",
"userAgentData",
"adAuctionComponents",
"runAdAuction",
"canLoadAdAuctionFencedFrame",
"clearAppBadge",
"getBattery",
"getUserMedia",
"requestMIDIAccess",
"requestMediaKeySystemAccess",
"setAppBadge",
"webkitGetUserMedia",
"clearOriginJoinedAdInterestGroups",
"createAuctionNonce",
"deprecatedReplaceInURN",
"deprecatedURNToURL",
"getInstalledRelatedApps",
"joinAdInterestGroup",
"leaveAdInterestGroup",
"updateAdInterestGroups",
"registerProtocolHandler",
"unregisterProtocolHandler"
]
}
})
return navigator; return navigator;
}, },
get locationbar() { get locationbar() {
......
...@@ -102,7 +102,7 @@ exports.install = (globalObject, globalNames) => { ...@@ -102,7 +102,7 @@ exports.install = (globalObject, globalNames) => {
"video/mp4; codecs=\"avc1.42E01E\"": "probably", "video/mp4; codecs=\"avc1.42E01E\"": "probably",
"video/webm; codecs=\"vp8, vorbis\"": "probably", "video/webm; codecs=\"vp8, vorbis\"": "probably",
"video/ogg; codecs=\"theora\"": "probably", "video/ogg; codecs=\"theora\"": undefined,
"audio/x-m4a;": "maybe", "audio/x-m4a;": "maybe",
......
...@@ -147,9 +147,9 @@ exports.install = (globalObject, globalNames) => { ...@@ -147,9 +147,9 @@ exports.install = (globalObject, globalNames) => {
// }) // })
class Navigator { class Navigator {
constructor() { // constructor() {
throw new TypeError("Illegal constructor"); // throw new TypeError("Illegal constructor");
} // }
javaEnabled() { javaEnabled() {
...@@ -363,7 +363,7 @@ exports.install = (globalObject, globalNames) => { ...@@ -363,7 +363,7 @@ exports.install = (globalObject, globalNames) => {
} }
return Promise((resolve, reject) => { return new Promise((resolve, reject) => {
resolve(r) resolve(r)
}); });
...@@ -371,6 +371,9 @@ exports.install = (globalObject, globalNames) => { ...@@ -371,6 +371,9 @@ exports.install = (globalObject, globalNames) => {
} }
} }
adAuctionComponents(){}
runAdAuction(){}
canLoadAdAuctionFencedFrame(){}
get userAgent() { get userAgent() {
// return 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36'; // return 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36';
return window.ENV.navigatorparams.useragent return window.ENV.navigatorparams.useragent
...@@ -424,8 +427,9 @@ exports.install = (globalObject, globalNames) => { ...@@ -424,8 +427,9 @@ exports.install = (globalObject, globalNames) => {
get languages() { get languages() {
return window.ENV.navigatorparams.languages || [ return window.ENV.navigatorparams.languages || [
"en-US",
"en", "en",
"en-US",
"zh-CN", "zh-CN",
"ru"] "ru"]
...@@ -508,7 +512,7 @@ exports.install = (globalObject, globalNames) => { ...@@ -508,7 +512,7 @@ exports.install = (globalObject, globalNames) => {
get connection() { get connection() {
console.log('navigator.connection.object') console.log('navigator.connection.object')
return proxy({ return proxy({
rtt : 100 rtt : 300
}, 'connection') }, 'connection')
} }
...@@ -541,7 +545,9 @@ exports.install = (globalObject, globalNames) => { ...@@ -541,7 +545,9 @@ exports.install = (globalObject, globalNames) => {
vibrate() { vibrate() {
console.log('navigator.vibrate') console.log('navigator.vibrate')
} }
get deprecatedRunAdAuctionEnforcesKAnonymity(){
return false
}
bluetooth() { bluetooth() {
console.log('navigator.bluetooth.object') console.log('navigator.bluetooth.object')
return proxy({}, 'bluetooth') return proxy({}, 'bluetooth')
...@@ -595,7 +601,9 @@ exports.install = (globalObject, globalNames) => { ...@@ -595,7 +601,9 @@ exports.install = (globalObject, globalNames) => {
get deviceMemory() { get deviceMemory() {
console.log('navigator.deviceMemory.get') console.log('navigator.deviceMemory.get')
} }
get login(){
return proxy({}, 'login')
}
ink() { ink() {
console.log('navigator.ink.object') console.log('navigator.ink.object')
return proxy({}, 'ink') return proxy({}, 'ink')
...@@ -656,10 +664,7 @@ exports.install = (globalObject, globalNames) => { ...@@ -656,10 +664,7 @@ exports.install = (globalObject, globalNames) => {
return proxy({}, 'xr') return proxy({}, 'xr')
} }
userAgentData() {
console.log('navigator.userAgentData.object')
return proxy({}, 'userAgentData')
}
clearAppBadge() { clearAppBadge() {
console.log('navigator.clearAppBadge') console.log('navigator.clearAppBadge')
...@@ -684,14 +689,21 @@ exports.install = (globalObject, globalNames) => { ...@@ -684,14 +689,21 @@ exports.install = (globalObject, globalNames) => {
webkitGetUserMedia() { webkitGetUserMedia() {
console.log('navigator.webkitGetUserMedia') console.log('navigator.webkitGetUserMedia')
} }
clearOriginJoinedAdInterestGroups(){}
createAuctionNonce(){}
deprecatedReplaceInURN(){}
deprecatedURNToURL(){}
joinAdInterestGroup(){}
leaveAdInterestGroup(){}
updateAdInterestGroups(){}
getInstalledRelatedApps() { getInstalledRelatedApps() {
console.log('navigator.getInstalledRelatedApps') console.log('navigator.getInstalledRelatedApps')
} }
registerProtocolHandler() { // registerProtocolHandler() {
console.log('navigator.registerProtocolHandler') // console.log('navigator.registerProtocolHandler')
} // }
unregisterProtocolHandler() { unregisterProtocolHandler() {
console.log('navigator.unregisterProtocolHandler') console.log('navigator.unregisterProtocolHandler')
...@@ -757,7 +769,7 @@ exports.install = (globalObject, globalNames) => { ...@@ -757,7 +769,7 @@ exports.install = (globalObject, globalNames) => {
r[e]['enumerable'] = true r[e]['enumerable'] = true
}) })
Object.defineProperties(Navigator.prototype, r) Object.defineProperties(Navigator.prototype, r)
delete Navigator.prototype.constructor
Object.defineProperties(Navigator.prototype, { Object.defineProperties(Navigator.prototype, {
javaEnabled: {enumerable: true}, javaEnabled: {enumerable: true},
appCodeName: {enumerable: true}, appCodeName: {enumerable: true},
......
...@@ -24,7 +24,7 @@ exports.implementation = class HistoryImpl { ...@@ -24,7 +24,7 @@ exports.implementation = class HistoryImpl {
get length() { get length() {
this._guardAgainstInactiveDocuments(); this._guardAgainstInactiveDocuments();
return 2
return this._window._sessionHistory.length; return this._window._sessionHistory.length;
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment