Commit d5db4145 authored by wangmingming's avatar wangmingming

333

parent 52882e94
This diff is collapsed.
...@@ -265,13 +265,13 @@ function Window(options) { ...@@ -265,13 +265,13 @@ function Window(options) {
// debugger; // debugger;
// } // }
let res = Reflect.get(target, p, receiver); let res = Reflect.get(target, p, receiver);
if (p !== 'debug'){ if (p !== 'debug' && p !== 'Object'){
console.log('window get', p, typeof res) console.log('window get', p, typeof res)
} }
if (p === 'offsetHeight'){ // if (p === 'offsetHeight'){
debugger; // debugger;
} // }
// console.log(Reflect.get(target, '_cf_chl_ctx', receiver)) // console.log(Reflect.get(target, '_cf_chl_ctx', receiver))
if (!['_registeredHandlers', 'window', '_currentEvent', 'performance','debug','_eventListenerss','top'].includes(p) && res && typeof res === 'object' && typeof p !== 'symbol') { if (!['_registeredHandlers', 'window', '_currentEvent', 'performance','debug','_eventListenerss','top'].includes(p) && res && typeof res === 'object' && typeof p !== 'symbol') {
......
...@@ -306,7 +306,7 @@ function innerInvokeEventListeners(eventImpl, listeners, phase, itemInShadowTree ...@@ -306,7 +306,7 @@ function innerInvokeEventListeners(eventImpl, listeners, phase, itemInShadowTree
return found; return found;
} }
if (type === 'mousemove'){ if (type === 'mousemove'){
debugger // debugger
} }
// Copy event listeners before iterating since the list can be modified during the iteration. // Copy event listeners before iterating since the list can be modified during the iteration.
const handlers = listeners[type].slice(); const handlers = listeners[type].slice();
......
...@@ -185,7 +185,7 @@ exports.install = (globalObject, globalNames) => { ...@@ -185,7 +185,7 @@ exports.install = (globalObject, globalNames) => {
getHighEntropyValues: function (e) { getHighEntropyValues: function (e) {
console.log('getHighEntropyValues', e) console.log('getHighEntropyValues', e)
let r; let r;
switch (e) { switch (e[0]) {
case 'architecture': case 'architecture':
r = { r = {
"architecture": "arm", "architecture": "arm",
...@@ -227,20 +227,10 @@ exports.install = (globalObject, globalNames) => { ...@@ -227,20 +227,10 @@ exports.install = (globalObject, globalNames) => {
} }
break; break;
case 'mobile': case 'mobile':
r = { r = {"brands":[{"brand":"Not.A/Brand","version":"8"},{"brand":"Chromium","version":"114"},{"brand":"Google Chrome","version":"114"}],"mobile":false,"platform":"macOS"}
"brands": [{"brand": "Not/A)Brand", "version": "99"}, {
"brand": "Google Chrome",
"version": "115"
}, {"brand": "Chromium", "version": "115"}], "mobile": false, "platform": "macOS"
}
break; break;
case 'model': case 'model':
r = { r = {"brands":[{"brand":"Not.A/Brand","version":"8"},{"brand":"Chromium","version":"114"},{"brand":"Google Chrome","version":"114"}],"mobile":false,"model":"","platform":"macOS"}
"brands": [{"brand": "Not/A)Brand", "version": "99"}, {
"brand": "Google Chrome",
"version": "115"
}, {"brand": "Chromium", "version": "115"}], "mobile": false, "platform": "macOS"
}
break; break;
case 'platform': case 'platform':
r = { r = {
...@@ -273,6 +263,12 @@ exports.install = (globalObject, globalNames) => { ...@@ -273,6 +263,12 @@ exports.install = (globalObject, globalNames) => {
} }
return {
then: function (){
return r
}
}
} }
} }
} }
......
...@@ -51,6 +51,7 @@ class HTMLCanvasElementImpl extends HTMLElementImpl { ...@@ -51,6 +51,7 @@ class HTMLCanvasElementImpl extends HTMLElementImpl {
} }
getContext(contextId) { getContext(contextId) {
// console.log('contextId', contextId)
const canvas = this._getCanvas(); const canvas = this._getCanvas();
if (canvas) { if (canvas) {
if (!this._context) { if (!this._context) {
...@@ -66,7 +67,7 @@ class HTMLCanvasElementImpl extends HTMLElementImpl { ...@@ -66,7 +67,7 @@ class HTMLCanvasElementImpl extends HTMLElementImpl {
wrapNodeCanvasMethod(this._context, "drawImage"); wrapNodeCanvasMethod(this._context, "drawImage");
} }
} }
if (contextId === 'webgl') { if (contextId === 'webgl' || contextId === 'webgl2') {
var v_new_toggle = true var v_new_toggle = true
var v_new = function (v) { var v_new = function (v) {
var temp = v_new_toggle; var temp = v_new_toggle;
...@@ -91,7 +92,6 @@ class HTMLCanvasElementImpl extends HTMLElementImpl { ...@@ -91,7 +92,6 @@ class HTMLCanvasElementImpl extends HTMLElementImpl {
function WebGLShader() { function WebGLShader() {
} }
this._toggle = {}
this.createBuffer = function () { this.createBuffer = function () {
v_console_log(' [*] WebGLRenderingContext -> createBuffer[func]'); v_console_log(' [*] WebGLRenderingContext -> createBuffer[func]');
return v_new(WebGLBuffer) return v_new(WebGLBuffer)
...@@ -191,12 +191,10 @@ class HTMLCanvasElementImpl extends HTMLElementImpl { ...@@ -191,12 +191,10 @@ class HTMLCanvasElementImpl extends HTMLElementImpl {
class WebGLDebugRendererInfo { class WebGLDebugRendererInfo {
get UNMASKED_VENDOR_WEBGL() { get UNMASKED_VENDOR_WEBGL() {
self._toggle[37445] = 1;
return 37445 return 37445
} }
get UNMASKED_RENDERER_WEBGL() { get UNMASKED_RENDERER_WEBGL() {
self._toggle[37446] = 1;
return 37446 return 37446
} }
} }
...@@ -227,7 +225,7 @@ class HTMLCanvasElementImpl extends HTMLElementImpl { ...@@ -227,7 +225,7 @@ class HTMLCanvasElementImpl extends HTMLElementImpl {
} }
this.getParameter = function (key) { this.getParameter = function (key) {
v_console_log(' [*] WebGLRenderingContext -> getParameter[func]:', key) v_console_log(' [*] WebGLRenderingContext -> getParameter[func]:', key)
this._toggle = { let _toggle = {
3413: 8, 3413: 8,
3412: 8, 3412: 8,
3411: 8, 3411: 8,
...@@ -252,8 +250,8 @@ class HTMLCanvasElementImpl extends HTMLElementImpl { ...@@ -252,8 +250,8 @@ class HTMLCanvasElementImpl extends HTMLElementImpl {
37446: null, 37446: null,
34047: null 34047: null
} }
if (this._toggle[key]) { if (_toggle[key]) {
return this._toggle[key] return _toggle[key]
} else { } else {
if (key == 33902) { if (key == 33902) {
...@@ -401,13 +399,14 @@ class HTMLCanvasElementImpl extends HTMLElementImpl { ...@@ -401,13 +399,14 @@ class HTMLCanvasElementImpl extends HTMLElementImpl {
v_saf(this.createBuffer, 'createBuffer') v_saf(this.createBuffer, 'createBuffer')
v_saf(this.createProgram, 'createProgram') v_saf(this.createProgram, 'createProgram')
v_saf(this.createShader, 'createShader') v_saf(this.createShader, 'createShader')
v_saf(this.getSupportedExtensions, 'getSupportedExtensions') // v_saf(this.getSupportedExtensions, 'getSupportedExtensions')
v_saf(this.getExtension, 'getExtension') v_saf(this.getExtension, 'getExtension')
v_saf(this.getParameter, 'getParameter') v_saf(this.getParameter, 'getParameter')
v_saf(this.getContextAttributes, 'getContextAttributes') v_saf(this.getContextAttributes, 'getContextAttributes')
v_saf(this.getShaderPrecisionFormat, 'getShaderPrecisionFormat') v_saf(this.getShaderPrecisionFormat, 'getShaderPrecisionFormat')
}) })
Object.defineProperties(WebGLRenderingContext.prototype, { Object.defineProperties(WebGLRenderingContext.prototype, {
getSupportedExtensions: {value: WebGLRenderingContext.getSupportedExtensions, writable:true, configurable:true, enumerable: true},
DEPTH_BUFFER_BIT: {"value": 256, "writable": false, "enumerable": true, "configurable": false}, DEPTH_BUFFER_BIT: {"value": 256, "writable": false, "enumerable": true, "configurable": false},
STENCIL_BUFFER_BIT: {"value": 1024, "writable": false, "enumerable": true, "configurable": false}, STENCIL_BUFFER_BIT: {"value": 1024, "writable": false, "enumerable": true, "configurable": false},
COLOR_BUFFER_BIT: {"value": 16384, "writable": false, "enumerable": true, "configurable": false}, COLOR_BUFFER_BIT: {"value": 16384, "writable": false, "enumerable": true, "configurable": false},
...@@ -1086,10 +1085,12 @@ class HTMLCanvasElementImpl extends HTMLElementImpl { ...@@ -1086,10 +1085,12 @@ class HTMLCanvasElementImpl extends HTMLElementImpl {
configurable: true configurable: true
}, },
}) })
// let t = proxy(new WebGLRenderingContext, 'WebGLRenderingContext11') let t = proxy(new WebGLRenderingContext(), 'WebGLRenderingContext11')
let t = new WebGLRenderingContext() // let t = new WebGLRenderingContext()
return t this._context = t;
} }
// console.log('contextId res', this._context)
return this._context; return this._context;
} }
...@@ -1113,7 +1114,7 @@ class HTMLCanvasElementImpl extends HTMLElementImpl { ...@@ -1113,7 +1114,7 @@ class HTMLCanvasElementImpl extends HTMLElementImpl {
let color = Math.floor(Math.random() * 150); let color = Math.floor(Math.random() * 150);
ctx.fillStyle = "rgba(" + color + "," + color + "," + color + ",1)"; ctx.fillStyle = "rgba(" + color + "," + color + "," + color + ",1)";
ctx.fillRect(randInt(0, this.width), randInt(0, this.height), 3, 3) ctx.fillRect(randInt(0, this.width), randInt(0, this.height), 1, 1)
} }
} }
......
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