| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 return frame()->script().executeScriptInMainWorldAndReturnValue( | 747 return frame()->script().executeScriptInMainWorldAndReturnValue( |
| 748 ScriptSourceCode(source.code, source.url, position)); | 748 ScriptSourceCode(source.code, source.url, position)); |
| 749 } | 749 } |
| 750 | 750 |
| 751 void WebLocalFrameImpl::requestExecuteScriptAndReturnValue( | 751 void WebLocalFrameImpl::requestExecuteScriptAndReturnValue( |
| 752 const WebScriptSource& source, | 752 const WebScriptSource& source, |
| 753 bool userGesture, | 753 bool userGesture, |
| 754 WebScriptExecutionCallback* callback) { | 754 WebScriptExecutionCallback* callback) { |
| 755 DCHECK(frame()); | 755 DCHECK(frame()); |
| 756 | 756 |
| 757 RefPtr<DOMWrapperWorld> mainWorld = &DOMWrapperWorld::mainWorld(); |
| 757 SuspendableScriptExecutor* executor = SuspendableScriptExecutor::create( | 758 SuspendableScriptExecutor* executor = SuspendableScriptExecutor::create( |
| 758 frame(), 0, createSourcesVector(&source, 1), userGesture, callback); | 759 frame(), std::move(mainWorld), createSourcesVector(&source, 1), |
| 760 userGesture, callback); |
| 759 executor->run(); | 761 executor->run(); |
| 760 } | 762 } |
| 761 | 763 |
| 762 void WebLocalFrameImpl::requestExecuteV8Function( | 764 void WebLocalFrameImpl::requestExecuteV8Function( |
| 763 v8::Local<v8::Context> context, | 765 v8::Local<v8::Context> context, |
| 764 v8::Local<v8::Function> function, | 766 v8::Local<v8::Function> function, |
| 765 v8::Local<v8::Value> receiver, | 767 v8::Local<v8::Value> receiver, |
| 766 int argc, | 768 int argc, |
| 767 v8::Local<v8::Value> argv[], | 769 v8::Local<v8::Value> argv[], |
| 768 WebScriptExecutionCallback* callback) { | 770 WebScriptExecutionCallback* callback) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 int worldID, | 805 int worldID, |
| 804 const WebScriptSource* sourcesIn, | 806 const WebScriptSource* sourcesIn, |
| 805 unsigned numSources, | 807 unsigned numSources, |
| 806 bool userGesture, | 808 bool userGesture, |
| 807 ScriptExecutionType option, | 809 ScriptExecutionType option, |
| 808 WebScriptExecutionCallback* callback) { | 810 WebScriptExecutionCallback* callback) { |
| 809 DCHECK(frame()); | 811 DCHECK(frame()); |
| 810 CHECK_GT(worldID, 0); | 812 CHECK_GT(worldID, 0); |
| 811 CHECK_LT(worldID, DOMWrapperWorld::EmbedderWorldIdLimit); | 813 CHECK_LT(worldID, DOMWrapperWorld::EmbedderWorldIdLimit); |
| 812 | 814 |
| 815 RefPtr<DOMWrapperWorld> isolatedWorld = |
| 816 DOMWrapperWorld::ensureIsolatedWorld(toIsolate(frame()), worldID); |
| 813 SuspendableScriptExecutor* executor = SuspendableScriptExecutor::create( | 817 SuspendableScriptExecutor* executor = SuspendableScriptExecutor::create( |
| 814 frame(), worldID, createSourcesVector(sourcesIn, numSources), userGesture, | 818 frame(), std::move(isolatedWorld), |
| 815 callback); | 819 createSourcesVector(sourcesIn, numSources), userGesture, callback); |
| 816 switch (option) { | 820 switch (option) { |
| 817 case AsynchronousBlockingOnload: | 821 case AsynchronousBlockingOnload: |
| 818 executor->runAsync(SuspendableScriptExecutor::OnloadBlocking); | 822 executor->runAsync(SuspendableScriptExecutor::OnloadBlocking); |
| 819 break; | 823 break; |
| 820 case Asynchronous: | 824 case Asynchronous: |
| 821 executor->runAsync(SuspendableScriptExecutor::NonBlocking); | 825 executor->runAsync(SuspendableScriptExecutor::NonBlocking); |
| 822 break; | 826 break; |
| 823 case Synchronous: | 827 case Synchronous: |
| 824 executor->run(); | 828 executor->run(); |
| 825 break; | 829 break; |
| (...skipping 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2476 createMarkup(startPosition, endPosition, AnnotateForInterchange, | 2480 createMarkup(startPosition, endPosition, AnnotateForInterchange, |
| 2477 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | 2481 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
| 2478 } else { | 2482 } else { |
| 2479 clipHtml = | 2483 clipHtml = |
| 2480 createMarkup(endPosition, startPosition, AnnotateForInterchange, | 2484 createMarkup(endPosition, startPosition, AnnotateForInterchange, |
| 2481 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | 2485 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
| 2482 } | 2486 } |
| 2483 } | 2487 } |
| 2484 | 2488 |
| 2485 } // namespace blink | 2489 } // namespace blink |
| OLD | NEW |