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

Side by Side Diff: Source/bindings/v8/ScriptController.cpp

Issue 13575004: Apply script preprocessor to Web page scripts only. (Closed) Base URL: https://chromium.googlesource.com/external/WebKit_trimmed.git@master
Patch Set: Re-implment based on review Created 7 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2009 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 v8::Local<v8::Value> object = compileAndRunScript(sourceCode); 292 v8::Local<v8::Value> object = compileAndRunScript(sourceCode);
293 293
294 m_sourceURL = savedSourceURL; 294 m_sourceURL = savedSourceURL;
295 295
296 if (object.IsEmpty()) 296 if (object.IsEmpty())
297 return ScriptValue(); 297 return ScriptValue();
298 298
299 return ScriptValue(object); 299 return ScriptValue(object);
300 } 300 }
301 301
302 ScriptValue ScriptController::evaluateFromWebPage(const ScriptSourceCode& source Code)
303 {
304 v8::HandleScope handleScope;
305 v8::Handle<v8::Context> v8Context = ScriptController::mainWorldContext(m_fra me);
306 if (v8Context.IsEmpty())
307 return ScriptValue();
308
309 V8PerContextDebugData::ScopedWebCompilation compileFromWeb(v8Context);
310 return evaluate(sourceCode);
311 }
312
302 bool ScriptController::initializeMainWorld() 313 bool ScriptController::initializeMainWorld()
303 { 314 {
304 if (m_windowShell->isContextInitialized()) 315 if (m_windowShell->isContextInitialized())
305 return false; 316 return false;
306 return windowShell(mainThreadNormalWorld())->isContextInitialized(); 317 return windowShell(mainThreadNormalWorld())->isContextInitialized();
307 } 318 }
308 319
309 V8DOMWindowShell* ScriptController::existingWindowShell(DOMWrapperWorld* world) 320 V8DOMWindowShell* ScriptController::existingWindowShell(DOMWrapperWorld* world)
310 { 321 {
311 ASSERT(world); 322 ASSERT(world);
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 759
749 // DocumentWriter::replaceDocument can cause the DocumentLoader to get d eref'ed and possible destroyed, 760 // DocumentWriter::replaceDocument can cause the DocumentLoader to get d eref'ed and possible destroyed,
750 // so protect it with a RefPtr. 761 // so protect it with a RefPtr.
751 if (RefPtr<DocumentLoader> loader = m_frame->document()->loader()) 762 if (RefPtr<DocumentLoader> loader = m_frame->document()->loader())
752 loader->writer()->replaceDocument(scriptResult, ownerDocument.get()) ; 763 loader->writer()->replaceDocument(scriptResult, ownerDocument.get()) ;
753 } 764 }
754 return true; 765 return true;
755 } 766 }
756 767
757 } // namespace WebCore 768 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698