Minor improvement to protobuf isolation
This commit is contained in:
parent
fe82aebfec
commit
55b9ddd856
|
@ -2,15 +2,21 @@
|
||||||
(function(global, factory) { /* global define, require, module */
|
(function(global, factory) { /* global define, require, module */
|
||||||
|
|
||||||
/* CommonJS */if (typeof require === 'function' && typeof module === 'object' && module && module.exports)
|
/* CommonJS */if (typeof require === 'function' && typeof module === 'object' && module && module.exports)
|
||||||
module.exports = factory(require("protobufjs/minimal"), require("../utils/modules"));
|
module.exports = factory(require("../utils/modules"));
|
||||||
|
|
||||||
})(this, function($protobuf, $moduleUtil) {
|
})(this, function($moduleUtil) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// This fixes bug #91 by giving us an isolate copy of protobufjs library so any tampering with it doesn't affect us
|
// This fixes bug #91 by giving us an isolate copy of protobufjs library so any tampering with it doesn't affect us
|
||||||
var old = $moduleUtil.uncache(require.resolve('protobufjs/minimal'));
|
var $moduleName = 'protobufjs/minimal';
|
||||||
$protobuf = require('protobufjs/minimal');
|
var $id = require.resolve($moduleName);
|
||||||
$moduleUtil.recache(old);
|
var $uncached = $moduleUtil.uncache($id);
|
||||||
|
var $protobuf = require($moduleName);
|
||||||
|
if ($uncached) {
|
||||||
|
$moduleUtil.recache($uncached);
|
||||||
|
} else {
|
||||||
|
$moduleUtil.uncache($id);
|
||||||
|
}
|
||||||
|
|
||||||
// Common aliases
|
// Common aliases
|
||||||
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
|
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user