Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: chrome/renderer/module_system.cc

Issue 10208001: Make functions being routed by NativeHandlers throw an exception if there is no ModuleSystem in the… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: respond to comments Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/module_system.h ('k') | chrome/renderer/native_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/module_system.cc
diff --git a/chrome/renderer/module_system.cc b/chrome/renderer/module_system.cc
index 53f12673e86894f117b1f970498f507dd2651158..7c246e41596344b70ee9ca3de9777a52efb8f98f 100644
--- a/chrome/renderer/module_system.cc
+++ b/chrome/renderer/module_system.cc
@@ -59,6 +59,12 @@ ModuleSystem::NativesEnabledScope::~NativesEnabledScope() {
CHECK_GE(module_system_->natives_enabled_, 0);
}
+// static
+bool ModuleSystem::IsPresentInCurrentContext() {
+ v8::Handle<v8::Object> global(v8::Context::GetCurrent()->Global());
+ return !global->GetHiddenValue(v8::String::New(kModuleSystem))->IsUndefined();
+}
+
void ModuleSystem::Require(const std::string& module_name) {
v8::HandleScope handle_scope;
RequireForJsInner(v8::String::New(module_name.c_str()));
« no previous file with comments | « chrome/renderer/module_system.h ('k') | chrome/renderer/native_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698