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

Side by Side Diff: Source/bindings/v8/custom/V8InjectedScriptManager.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: Rebase, simplify Created 7 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // Call custom code to create InjectedScripHost wrapper specific for the con text 83 // Call custom code to create InjectedScripHost wrapper specific for the con text
84 // instead of calling toV8() that would create the 84 // instead of calling toV8() that would create the
85 // wrapper in the current context. 85 // wrapper in the current context.
86 // FIXME: make it possible to use generic bindings factory for InjectedScrip tHost. 86 // FIXME: make it possible to use generic bindings factory for InjectedScrip tHost.
87 v8::Local<v8::Object> scriptHostWrapper = createInjectedScriptHostV8Wrapper( m_injectedScriptHost.get(), inspectedContext->GetIsolate()); 87 v8::Local<v8::Object> scriptHostWrapper = createInjectedScriptHostV8Wrapper( m_injectedScriptHost.get(), inspectedContext->GetIsolate());
88 if (scriptHostWrapper.IsEmpty()) 88 if (scriptHostWrapper.IsEmpty())
89 return ScriptObject(); 89 return ScriptObject();
90 90
91 v8::Local<v8::Object> windowGlobal = inspectedContext->Global(); 91 v8::Local<v8::Object> windowGlobal = inspectedContext->Global();
92 92
93 // Mark the context as temporarily used by debugger.
94 V8PerContextDebugData::SystemScope systemScope(inspectedContext);
95
93 // Inject javascript into the context. The compiled script is supposed to ev aluate into 96 // Inject javascript into the context. The compiled script is supposed to ev aluate into
94 // a single anonymous function(it's anonymous to avoid cluttering the global object with 97 // a single anonymous function(it's anonymous to avoid cluttering the global object with
95 // inspector's stuff) the function is called a few lines below with Injected ScriptHost wrapper, 98 // inspector's stuff) the function is called a few lines below with Injected ScriptHost wrapper,
96 // injected script id and explicit reference to the inspected global object. The function is expected 99 // injected script id and explicit reference to the inspected global object. The function is expected
97 // to create and configure InjectedScript instance that is going to be used by the inspector. 100 // to create and configure InjectedScript instance that is going to be used by the inspector.
98 v8::Local<v8::Script> script = v8::Script::Compile(v8String(scriptSource, in spectedContext->GetIsolate())); 101 v8::Local<v8::Script> script = v8::Script::Compile(v8String(scriptSource, in spectedContext->GetIsolate()));
99 V8RecursionScope::MicrotaskSuppression recursionScope; 102 V8RecursionScope::MicrotaskSuppression recursionScope;
100 v8::Local<v8::Value> v = script->Run(); 103 v8::Local<v8::Value> v = script->Run();
101 ASSERT(!v.IsEmpty()); 104 ASSERT(!v.IsEmpty());
102 ASSERT(v->IsFunction()); 105 ASSERT(v->IsFunction());
(...skipping 20 matching lines...) Expand all
123 if (holder.IsEmpty()) 126 if (holder.IsEmpty())
124 return false; 127 return false;
125 Frame* frame = V8DOMWindow::toNative(holder)->frame(); 128 Frame* frame = V8DOMWindow::toNative(holder)->frame();
126 129
127 v8::Context::Scope contextScope(context); 130 v8::Context::Scope contextScope(context);
128 return BindingSecurity::shouldAllowAccessToFrame(BindingState::instance(), f rame, DoNotReportSecurityError); 131 return BindingSecurity::shouldAllowAccessToFrame(BindingState::instance(), f rame, DoNotReportSecurityError);
129 } 132 }
130 133
131 } // namespace WebCore 134 } // namespace WebCore
132 135
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698