Prevent browserify from leaking the require function
Define a "require" argument in the wrapper functions that runs browserify bundles, which will prevent browserify from leaking the require function. Note that this doesn't affect the isolated renderer script, only when `-r` flag is passed to browserify command it will export a require function. It is still added to isolated renderer script to prevent future mistakes(doesn't hurt defining a "require" local).
This commit is contained in:
parent
e1aebef57c
commit
bf756e3c00
2 changed files with 2 additions and 2 deletions
|
@ -115,7 +115,7 @@ class AtomRenderFrameObserver : public content::RenderFrameObserver {
|
|||
// an argument.
|
||||
std::string bundle(node::isolated_bundle_data,
|
||||
node::isolated_bundle_data + sizeof(node::isolated_bundle_data));
|
||||
std::string wrapper = "(function (binding) {\n" + bundle + "\n})";
|
||||
std::string wrapper = "(function (binding, require) {\n" + bundle + "\n})";
|
||||
auto script = v8::Script::Compile(
|
||||
mate::ConvertToV8(isolate, wrapper)->ToString());
|
||||
auto func = v8::Handle<v8::Function>::Cast(
|
||||
|
|
|
@ -206,7 +206,7 @@ void AtomSandboxedRendererClient::DidCreateScriptContext(
|
|||
std::string preload_bundle_native(node::preload_bundle_data,
|
||||
node::preload_bundle_data + sizeof(node::preload_bundle_data));
|
||||
std::stringstream ss;
|
||||
ss << "(function(binding, preloadPath) {\n";
|
||||
ss << "(function(binding, preloadPath, require) {\n";
|
||||
ss << preload_bundle_native << "\n";
|
||||
ss << "})";
|
||||
std::string preload_wrapper = ss.str();
|
||||
|
|
Loading…
Reference in a new issue