| Index: Source/web/WebLocalFrameImpl.cpp
|
| diff --git a/Source/web/WebLocalFrameImpl.cpp b/Source/web/WebLocalFrameImpl.cpp
|
| index ed686a113434da203d499f2f862107b88cf24387..10f96be62ec361ba47d87e75f561dc3effde9aa4 100644
|
| --- a/Source/web/WebLocalFrameImpl.cpp
|
| +++ b/Source/web/WebLocalFrameImpl.cpp
|
| @@ -88,6 +88,7 @@
|
| #include "bindings/core/v8/DOMWrapperWorld.h"
|
| #include "bindings/core/v8/ExceptionState.h"
|
| #include "bindings/core/v8/ExceptionStatePlaceholder.h"
|
| +#include "bindings/core/v8/ScheduledActionWithCallback.h"
|
| #include "bindings/core/v8/ScriptController.h"
|
| #include "bindings/core/v8/ScriptSourceCode.h"
|
| #include "bindings/core/v8/ScriptValue.h"
|
| @@ -112,6 +113,7 @@
|
| #include "core/editing/markup.h"
|
| #include "core/fetch/ResourceFetcher.h"
|
| #include "core/frame/Console.h"
|
| +#include "core/frame/DOMWindowTimers.h"
|
| #include "core/frame/LocalDOMWindow.h"
|
| #include "core/frame/FrameHost.h"
|
| #include "core/frame/FrameView.h"
|
| @@ -705,12 +707,7 @@ void WebLocalFrameImpl::executeScriptInIsolatedWorld(int worldID, const WebScrip
|
| RELEASE_ASSERT(worldID > 0);
|
| RELEASE_ASSERT(worldID < EmbedderWorldIdLimit);
|
|
|
| - Vector<ScriptSourceCode> sources;
|
| - for (unsigned i = 0; i < numSources; ++i) {
|
| - TextPosition position(OrdinalNumber::fromOneBasedInt(sourcesIn[i].startLine), OrdinalNumber::first());
|
| - sources.append(ScriptSourceCode(sourcesIn[i].code, sourcesIn[i].url, position));
|
| - }
|
| -
|
| + Vector<ScriptSourceCode> sources = createSourcesVector(sourcesIn, numSources);
|
| v8::HandleScope handleScope(toIsolate(frame()));
|
| frame()->script().executeScriptInIsolatedWorld(worldID, sources, extensionGroup, 0);
|
| }
|
| @@ -782,19 +779,22 @@ v8::Handle<v8::Value> WebLocalFrameImpl::executeScriptAndReturnValue(const WebSc
|
| return frame()->script().executeScriptInMainWorldAndReturnValue(ScriptSourceCode(source.code, source.url, position));
|
| }
|
|
|
| +void WebLocalFrameImpl::executeScriptAndReturnValue(const WebScriptSource& scriptSource, WebScriptCallback* callback)
|
| +{
|
| + ASSERT(frame());
|
| +
|
| + Vector<ScriptSourceCode> sources = createSourcesVector(&scriptSource, 1);
|
| + OwnPtr<ScheduledActionBase> action = adoptPtr(new ScheduledActionWithCallback(0, sources, 0, callback));
|
| + DOMWindowTimers::setTimeout(*frame()->domWindow(), action.release(), 0);
|
| +}
|
| +
|
| void WebLocalFrameImpl::executeScriptInIsolatedWorld(int worldID, const WebScriptSource* sourcesIn, unsigned numSources, int extensionGroup, WebVector<v8::Local<v8::Value> >* results)
|
| {
|
| ASSERT(frame());
|
| RELEASE_ASSERT(worldID > 0);
|
| RELEASE_ASSERT(worldID < EmbedderWorldIdLimit);
|
|
|
| - Vector<ScriptSourceCode> sources;
|
| -
|
| - for (unsigned i = 0; i < numSources; ++i) {
|
| - TextPosition position(OrdinalNumber::fromOneBasedInt(sourcesIn[i].startLine), OrdinalNumber::first());
|
| - sources.append(ScriptSourceCode(sourcesIn[i].code, sourcesIn[i].url, position));
|
| - }
|
| -
|
| + Vector<ScriptSourceCode> sources = createSourcesVector(sourcesIn, numSources);
|
| if (results) {
|
| Vector<v8::Local<v8::Value> > scriptResults;
|
| frame()->script().executeScriptInIsolatedWorld(worldID, sources, extensionGroup, &scriptResults);
|
| @@ -808,6 +808,17 @@ void WebLocalFrameImpl::executeScriptInIsolatedWorld(int worldID, const WebScrip
|
| }
|
| }
|
|
|
| +void WebLocalFrameImpl::executeScriptInIsolatedWorld(int worldID, const WebScriptSource* sourcesIn, unsigned numSources, int extensionGroup, WebScriptCallback* callback)
|
| +{
|
| + ASSERT(frame());
|
| + RELEASE_ASSERT(worldID > 0);
|
| + RELEASE_ASSERT(worldID < EmbedderWorldIdLimit);
|
| +
|
| + Vector<ScriptSourceCode> sources = createSourcesVector(sourcesIn, numSources);
|
| + OwnPtr<ScheduledActionBase> action = adoptPtr(new ScheduledActionWithCallback(worldID, sources, extensionGroup, callback));
|
| + DOMWindowTimers::setTimeout(*frame()->domWindow(), action.release(), 0);
|
| +}
|
| +
|
| v8::Handle<v8::Value> WebLocalFrameImpl::callFunctionEvenIfScriptDisabled(v8::Handle<v8::Function> function, v8::Handle<v8::Value> receiver, int argc, v8::Handle<v8::Value> argv[])
|
| {
|
| ASSERT(frame());
|
| @@ -1238,6 +1249,16 @@ WebPlugin* WebLocalFrameImpl::focusedPluginIfInputMethodSupported()
|
| return 0;
|
| }
|
|
|
| +Vector<ScriptSourceCode> WebLocalFrameImpl::createSourcesVector(const WebScriptSource* sourcesIn, unsigned numSources)
|
| +{
|
| + Vector<ScriptSourceCode> sources;
|
| + for (unsigned i = 0; i < numSources; ++i) {
|
| + TextPosition position(OrdinalNumber::fromOneBasedInt(sourcesIn[i].startLine), OrdinalNumber::first());
|
| + sources.append(ScriptSourceCode(sourcesIn[i].code, sourcesIn[i].url, position));
|
| + }
|
| + return sources;
|
| +}
|
| +
|
| int WebLocalFrameImpl::printBegin(const WebPrintParams& printParams, const WebNode& constrainToNode)
|
| {
|
| ASSERT(!frame()->document()->isFrameSet());
|
|
|