 Chromium Code Reviews
 Chromium Code Reviews Issue 26397003:
  Disable spawnFunction from dom enabled isolates  (Closed) 
  Base URL: svn://svn.chromium.org/multivm/trunk/webkit
    
  
    Issue 26397003:
  Disable spawnFunction from dom enabled isolates  (Closed) 
  Base URL: svn://svn.chromium.org/multivm/trunk/webkit| Index: Source/bindings/dart/DartController.cpp | 
| diff --git a/Source/bindings/dart/DartController.cpp b/Source/bindings/dart/DartController.cpp | 
| index 116e9890bfe80de7c3f1f805ea3aaf50407fe161..7a024139b73b78377f55ba480a17e704e28f2baf 100644 | 
| --- a/Source/bindings/dart/DartController.cpp | 
| +++ b/Source/bindings/dart/DartController.cpp | 
| @@ -350,10 +350,11 @@ private: | 
| Dart_Isolate DartController::createPureIsolateCallback(const char* scriptURL, const char* entryPoint, void* data, char** errorMsg) | 
| { | 
| - bool needAsyncLoader = false; | 
| + bool isSpawnUri = false; | 
| { | 
| DartApiScope apiScope; | 
| + // FIXME: http://dartbug.com/13920 | 
| // Hacky way to find out if it's spawnFunction or spawnUri. | 
| Dart_Handle parentIsolateRootLibrary = Dart_RootLibrary(); | 
| if (Dart_IsError(parentIsolateRootLibrary)) { | 
| @@ -372,11 +373,17 @@ Dart_Isolate DartController::createPureIsolateCallback(const char* scriptURL, co | 
| return 0; | 
| } | 
| - needAsyncLoader = strcmp(scriptURL, parentIsolateURL); | 
| + isSpawnUri = strcmp(scriptURL, parentIsolateURL); | 
| } | 
| DartDOMData* parentDOMData = static_cast<DartDOMData*>(data); | 
| ScriptExecutionContext* context = parentDOMData->scriptExecutionContext(); | 
| + | 
| + if (parentDOMData->isDOMEnabled() && !isSpawnUri) { | 
| + // spawnFunction is not allowed from a DOM enabled isolate | 
| + DartUtilities::reportProblem(context, "spawnFunction is not supported from a dom-enabled isolate. Please use spawnUri instead."); | 
| 
ricow1
2013/10/11 11:08:37
Why don't we throw an exception here? This is mess
 | 
| + } | 
| + | 
| ASSERT(context->isDocument()); | 
| Document* document = static_cast<Document*>(context); | 
| @@ -384,7 +391,7 @@ Dart_Isolate DartController::createPureIsolateCallback(const char* scriptURL, co | 
| if (!isolate) | 
| return 0; | 
| - if (needAsyncLoader) { | 
| + if (isSpawnUri) { | 
| // We need to request the sources asynchronously. | 
| RefPtr<DartSpawnLoadCallback> callback = adoptRef(new DartSpawnLoadCallback(isolate, scriptURL, document)); | 
| // A DartAsyncLoader will delete itself once all resources are fetched. |