Commit 76f67d10 authored by wangmingming's avatar wangmingming

7777

parent b1dd4adf
This diff is collapsed.
...@@ -274,7 +274,9 @@ function Window(options) { ...@@ -274,7 +274,9 @@ function Window(options) {
// } // }
// console.log(Reflect.get(target, '_cf_chl_ctx', receiver)) // console.log(Reflect.get(target, '_cf_chl_ctx', receiver))
if (!['_registeredHandlers', 'window', '_currentEvent','debug','_eventListenerss','top','JSON', 'Math'].includes(p) && res && typeof res === 'object' && typeof p !== 'symbol') { if (
!['_registeredHandlers', 'window', '_currentEvent','debug','_eventListenerss','JSON', 'Math'].includes(p) &&
res && typeof res === 'object' && typeof p !== 'symbol') {
return proxy(res, p) return proxy(res, p)
} }
return res; return res;
......
"use strict"; "use strict";
const conversions = require("webidl-conversions"); const conversions = require("webidl-conversions");
const utils = require("./utils.js"); const utils = require("./utils.js");
const {proxy} = require("./utils");
const implSymbol = utils.implSymbol; const implSymbol = utils.implSymbol;
const ctorRegistrySymbol = utils.ctorRegistrySymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol;
...@@ -101,7 +103,28 @@ exports.install = (globalObject, globalNames) => { ...@@ -101,7 +103,28 @@ exports.install = (globalObject, globalNames) => {
if (!globalNames.some(globalName => exposed.has(globalName))) { if (!globalNames.some(globalName => exposed.has(globalName))) {
return; return;
} }
class MimeTypeArray {
get length() {
return 2;
}
item() {
return mims[arguments[0]]
return null;
}
namedItem() {
return null;
}
get [idlUtils.supportedPropertyIndices]() {
return [];
}
};
Object.defineProperties(MimeTypeArray.prototype, {
[Symbol.toStringTag]: {value:"MimeTypeArray",writable:false,enumerable:false,configurable:true},
})
class Navigator { class Navigator {
constructor() { constructor() {
throw new TypeError("Illegal constructor"); throw new TypeError("Illegal constructor");
...@@ -652,9 +675,11 @@ exports.install = (globalObject, globalNames) => { ...@@ -652,9 +675,11 @@ exports.install = (globalObject, globalNames) => {
throw new TypeError("'get mimeTypes' called on an object that is not a valid instance of Navigator."); throw new TypeError("'get mimeTypes' called on an object that is not a valid instance of Navigator.");
} }
return utils.getSameObject(this, "mimeTypes", () => { let res = utils.getSameObject(this, "mimeTypes", () => {
return utils.tryWrapperForImpl(esValue[implSymbol]["mimeTypes"]); return utils.tryWrapperForImpl(esValue[implSymbol]["mimeTypes"]);
}); });
res = new MimeTypeArray();
return proxy(res, 'mimeTypes')
} }
} }
...@@ -665,7 +690,7 @@ exports.install = (globalObject, globalNames) => { ...@@ -665,7 +690,7 @@ exports.install = (globalObject, globalNames) => {
var n = Function.toString, t = [], i = [], o = [].indexOf.bind(t), e = [].push.bind(t), r = [].push.bind(i); var n = Function.toString, t = [], i = [], o = [].indexOf.bind(t), e = [].push.bind(t), r = [].push.bind(i);
function u(n, t, tag) { function u(n, t, tag) {
return -1 == o(n) && (e(n), r(`function ${tag ? tag : ""}${t || n.name || ""}() { [native code] }`.replaceAll('get get', 'get'))), n return -1 == o(n) && (e(n), r(`function ${tag ? tag : ""}${t || n.name || ""}() { [native code] }`.replaceAll('get get', 'get').replaceAll('set set', 'set'))), n
} }
Object.defineProperty(Function.prototype, "toString", { Object.defineProperty(Function.prototype, "toString", {
...@@ -687,6 +712,9 @@ exports.install = (globalObject, globalNames) => { ...@@ -687,6 +712,9 @@ exports.install = (globalObject, globalNames) => {
if (Object.getOwnPropertyDescriptor(Navigator.prototype, e)['get']) { if (Object.getOwnPropertyDescriptor(Navigator.prototype, e)['get']) {
r[e]['get'] = v_saf(Object.getOwnPropertyDescriptor(Navigator.prototype, e)['get'], undefined, 'get ') r[e]['get'] = v_saf(Object.getOwnPropertyDescriptor(Navigator.prototype, e)['get'], undefined, 'get ')
} }
if (Object.getOwnPropertyDescriptor(Navigator.prototype, e)['set']) {
r[e]['set'] = v_saf(Object.getOwnPropertyDescriptor(Navigator.prototype, e)['set'], undefined, 'set ')
}
r[e]['enumerable'] = true r[e]['enumerable'] = true
}) })
Object.defineProperties(Navigator.prototype, r) Object.defineProperties(Navigator.prototype, r)
...@@ -786,3 +814,4 @@ exports.install = (globalObject, globalNames) => { ...@@ -786,3 +814,4 @@ exports.install = (globalObject, globalNames) => {
}; };
const Impl = require("../navigator/Navigator-impl.js"); const Impl = require("../navigator/Navigator-impl.js");
const idlUtils = require("./utils");
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
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