fix sublime plugin issue with ui mode, object prototype pollution, try for ui api

This commit is contained in:
hyb1996
2017-05-14 23:34:38 +08:00
parent 36ef8c8396
commit 6102f6e8fe
13 changed files with 50 additions and 43 deletions

View File

@@ -13,12 +13,13 @@ if(__engine_name__ == "rhino"){
}
}
var __that__ = this;
var __asGlobal__ = function(obj, functions){
var len = functions.length;
for(var i = 0; i < len; i++) {
var funcName = functions[i];
this[funcName] = obj[funcName].bind(obj);
__that__[funcName] = obj[funcName].bind(obj);
}
}
@@ -32,4 +33,4 @@ require("__general__")(__runtime__, this);
var m = modules[i];
scope[m] = require('__' + m + '__')(scope.__runtime__, scope);
}
})(this);
})(__that__);

View File

@@ -1,6 +1,6 @@
module.exports = function(__runtime__, scope){
var app = new Object(__runtime__.app);
var app = Object.create(__runtime__.app);
var context = scope.context;
app.intent = function(i) {

View File

@@ -1,6 +1,6 @@
module.exports = function(__runtime__, scope){
var console = new Object(__runtime__.console);
var console = Object.create(__runtime__.console);
console.assert = function(value, message){
message = message || "";

View File

@@ -1,7 +1,7 @@
module.exports = function(__runtime__, scope){
var ui = Object(__runtime__.ui);
ui.layout = function(xml){
view = ui.inflate(xml);
view = ui.inflate(activity, xml);
ui.setView(view);
}