From 5dfcad23d2f1009987337ff5e09e2882b528a3af Mon Sep 17 00:00:00 2001 From: aiyingfeng Date: Wed, 16 Aug 2023 15:25:16 +0800 Subject: [PATCH] =?UTF-8?q?zy-=E8=A1=A5=E7=8E=AF=E5=A2=83=E6=A1=86?= =?UTF-8?q?=E6=9E=B6-=E5=AE=9E=E7=8E=B0-window=E8=A1=A5=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CatVm2/browser/plugin.js | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/志远js逆向学习/zy-补环境框架-实现-window补环境/CatVm2/browser/plugin.js b/志远js逆向学习/zy-补环境框架-实现-window补环境/CatVm2/browser/plugin.js index 622587a..c3a4d96 100644 --- a/志远js逆向学习/zy-补环境框架-实现-window补环境/CatVm2/browser/plugin.js +++ b/志远js逆向学习/zy-补环境框架-实现-window补环境/CatVm2/browser/plugin.js @@ -7,7 +7,7 @@ catvm.safefunction(Plugin); // catvm.memory.Plugin.iterator = function values() { - debugger + debugger; return { next: function () { if (this.index_ == undefined) { @@ -45,12 +45,12 @@ Plugin.prototype.name = '' Plugin.prototype.length = 0 Plugin.prototype.item = function item(index) { - debugger + debugger; return this[index] } catvm.safefunction(Plugin.prototype.item); Plugin.prototype.namedItem = function namedItem(key) { - debugger + debugger; return this[key] } catvm.safefunction(Plugin.prototype.namedItem); @@ -67,28 +67,30 @@ for (let pr in Plugin.prototype) { ////////////////原型-补环境-end////////////////// // 保存到内存 因为navigator.plugins存在多个,后期添加直接new一个就可以了 -catvm.memory.Plugin.new = function (data) { +// {description:'Portable Document Format',filename:'internal-pdf-viewer',name:'PDF Viewer',MimeType:[]} +catvm.memory.Plugin.new = function(data){ let plugin = {} - if (data != undefined) { + if(data != undefined){ plugin.description = data.description plugin.filename = data.filename plugin.name = data.name - if (data.MimeTypes != undefined) { + if(data.MimeTypes != undefined){ for (let mtindex = 0; mtindex < data.MimeTypes.length; mtindex++) { - let mtindex = data.MimeTypes[mtindex] - let mimeType = catvm.memory.MimeType.new(mtindex, plugin) - + var mimeTypedata = data.MimeTypes[mtindex]; + var mimeType = catvm.memory.MimeType.new(mimeTypedata,plugin) plugin[mtindex] = mimeType - /* plugin[mimeType.type] = mimeType */ - Object.defineProperty(plugin, mimeType.type, { - value: mimeType - }) - } - } + // plugin[mimeType.type] = mimeType + Object.defineProperty(plugin,mimeType.type,{ + value:mimeType, + configurable: true + }); + + }} plugin.length = data.MimeTypes.length } plugin.__proto__ = Plugin.prototype + return plugin } \ No newline at end of file