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

Side by Side Diff: Source/bindings/core/v8/WorkerScriptController.cpp

Issue 989573002: Cleanly handle excessively long JS source strings. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: syntax error => general error Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « Source/bindings/core/v8/V8ScriptRunner.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 ScriptState::Scope scope(m_scriptState.get()); 176 ScriptState::Scope scope(m_scriptState.get());
177 177
178 if (!m_disableEvalPending.isEmpty()) { 178 if (!m_disableEvalPending.isEmpty()) {
179 m_scriptState->context()->AllowCodeGenerationFromStrings(false); 179 m_scriptState->context()->AllowCodeGenerationFromStrings(false);
180 m_scriptState->context()->SetErrorMessageForCodeGenerationFromStrings(v8 String(isolate(), m_disableEvalPending)); 180 m_scriptState->context()->SetErrorMessageForCodeGenerationFromStrings(v8 String(isolate(), m_disableEvalPending));
181 m_disableEvalPending = String(); 181 m_disableEvalPending = String();
182 } 182 }
183 183
184 v8::TryCatch block; 184 v8::TryCatch block;
185 185
186 v8::Handle<v8::String> scriptString = v8String(isolate(), script); 186 v8::Handle<v8::Script> compiledScript = V8ScriptRunner::compileScript(script , fileName, String(), scriptStartPosition, isolate(), cacheHandler, SharableCros sOrigin, v8CacheOptions);
187 v8::Handle<v8::Script> compiledScript = V8ScriptRunner::compileScript(script String, fileName, String(), scriptStartPosition, isolate(), nullptr, nullptr, ca cheHandler, SharableCrossOrigin, v8CacheOptions);
188 v8::Local<v8::Value> result = V8ScriptRunner::runCompiledScript(isolate(), c ompiledScript, &m_workerGlobalScope); 187 v8::Local<v8::Value> result = V8ScriptRunner::runCompiledScript(isolate(), c ompiledScript, &m_workerGlobalScope);
189 188
190 if (!block.CanContinue()) { 189 if (!block.CanContinue()) {
191 forbidExecution(); 190 forbidExecution();
192 return ScriptValue(); 191 return ScriptValue();
193 } 192 }
194 193
195 if (block.HasCaught()) { 194 if (block.HasCaught()) {
196 v8::Local<v8::Message> message = block.Message(); 195 v8::Local<v8::Message> message = block.Message();
197 m_globalScopeExecutionState->hadException = true; 196 m_globalScopeExecutionState->hadException = true;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 281
283 void WorkerScriptController::rethrowExceptionFromImportedScript(PassRefPtrWillBe RawPtr<ErrorEvent> errorEvent, ExceptionState& exceptionState) 282 void WorkerScriptController::rethrowExceptionFromImportedScript(PassRefPtrWillBe RawPtr<ErrorEvent> errorEvent, ExceptionState& exceptionState)
284 { 283 {
285 const String& errorMessage = errorEvent->message(); 284 const String& errorMessage = errorEvent->message();
286 if (m_globalScopeExecutionState) 285 if (m_globalScopeExecutionState)
287 m_globalScopeExecutionState->m_errorEventFromImportedScript = errorEvent ; 286 m_globalScopeExecutionState->m_errorEventFromImportedScript = errorEvent ;
288 exceptionState.rethrowV8Exception(V8ThrowException::createGeneralError(isola te(), errorMessage)); 287 exceptionState.rethrowV8Exception(V8ThrowException::createGeneralError(isola te(), errorMessage));
289 } 288 }
290 289
291 } // namespace blink 290 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8ScriptRunner.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698