| 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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 TextPosition position(OrdinalNumber::fromOneBasedInt(source.startLine), | 657 TextPosition position(OrdinalNumber::fromOneBasedInt(source.startLine), |
| 658 OrdinalNumber::first()); | 658 OrdinalNumber::first()); |
| 659 v8::HandleScope handleScope(toIsolate(frame())); | 659 v8::HandleScope handleScope(toIsolate(frame())); |
| 660 frame()->script().executeScriptInMainWorld( | 660 frame()->script().executeScriptInMainWorld( |
| 661 ScriptSourceCode(source.code, source.url, position)); | 661 ScriptSourceCode(source.code, source.url, position)); |
| 662 } | 662 } |
| 663 | 663 |
| 664 void WebLocalFrameImpl::executeScriptInIsolatedWorld( | 664 void WebLocalFrameImpl::executeScriptInIsolatedWorld( |
| 665 int worldID, | 665 int worldID, |
| 666 const WebScriptSource* sourcesIn, | 666 const WebScriptSource* sourcesIn, |
| 667 unsigned numSources, | 667 unsigned numSources) { |
| 668 int extensionGroup) { | |
| 669 DCHECK(frame()); | 668 DCHECK(frame()); |
| 670 CHECK_GT(worldID, 0); | 669 CHECK_GT(worldID, 0); |
| 671 CHECK_LT(worldID, EmbedderWorldIdLimit); | 670 CHECK_LT(worldID, EmbedderWorldIdLimit); |
| 672 | 671 |
| 673 HeapVector<ScriptSourceCode> sources = | 672 HeapVector<ScriptSourceCode> sources = |
| 674 createSourcesVector(sourcesIn, numSources); | 673 createSourcesVector(sourcesIn, numSources); |
| 675 v8::HandleScope handleScope(toIsolate(frame())); | 674 v8::HandleScope handleScope(toIsolate(frame())); |
| 676 frame()->script().executeScriptInIsolatedWorld(worldID, sources, | 675 frame()->script().executeScriptInIsolatedWorld(worldID, sources, 0); |
| 677 extensionGroup, 0); | |
| 678 } | 676 } |
| 679 | 677 |
| 680 void WebLocalFrameImpl::setIsolatedWorldSecurityOrigin( | 678 void WebLocalFrameImpl::setIsolatedWorldSecurityOrigin( |
| 681 int worldID, | 679 int worldID, |
| 682 const WebSecurityOrigin& securityOrigin) { | 680 const WebSecurityOrigin& securityOrigin) { |
| 683 DCHECK(frame()); | 681 DCHECK(frame()); |
| 684 DOMWrapperWorld::setIsolatedWorldSecurityOrigin(worldID, | 682 DOMWrapperWorld::setIsolatedWorldSecurityOrigin(worldID, |
| 685 securityOrigin.get()); | 683 securityOrigin.get()); |
| 686 } | 684 } |
| 687 | 685 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 ScriptSourceCode(source.code, source.url, position)); | 744 ScriptSourceCode(source.code, source.url, position)); |
| 747 } | 745 } |
| 748 | 746 |
| 749 void WebLocalFrameImpl::requestExecuteScriptAndReturnValue( | 747 void WebLocalFrameImpl::requestExecuteScriptAndReturnValue( |
| 750 const WebScriptSource& source, | 748 const WebScriptSource& source, |
| 751 bool userGesture, | 749 bool userGesture, |
| 752 WebScriptExecutionCallback* callback) { | 750 WebScriptExecutionCallback* callback) { |
| 753 DCHECK(frame()); | 751 DCHECK(frame()); |
| 754 | 752 |
| 755 SuspendableScriptExecutor::createAndRun( | 753 SuspendableScriptExecutor::createAndRun( |
| 756 frame(), 0, createSourcesVector(&source, 1), 0, userGesture, callback); | 754 frame(), 0, createSourcesVector(&source, 1), userGesture, callback); |
| 757 } | 755 } |
| 758 | 756 |
| 759 void WebLocalFrameImpl::requestExecuteV8Function( | 757 void WebLocalFrameImpl::requestExecuteV8Function( |
| 760 v8::Local<v8::Context> context, | 758 v8::Local<v8::Context> context, |
| 761 v8::Local<v8::Function> function, | 759 v8::Local<v8::Function> function, |
| 762 v8::Local<v8::Value> receiver, | 760 v8::Local<v8::Value> receiver, |
| 763 int argc, | 761 int argc, |
| 764 v8::Local<v8::Value> argv[], | 762 v8::Local<v8::Value> argv[], |
| 765 WebScriptExecutionCallback* callback) { | 763 WebScriptExecutionCallback* callback) { |
| 766 DCHECK(frame()); | 764 DCHECK(frame()); |
| 767 SuspendableScriptExecutor::createAndRun(frame(), toIsolate(frame()), context, | 765 SuspendableScriptExecutor::createAndRun(frame(), toIsolate(frame()), context, |
| 768 function, receiver, argc, argv, | 766 function, receiver, argc, argv, |
| 769 callback); | 767 callback); |
| 770 } | 768 } |
| 771 | 769 |
| 772 void WebLocalFrameImpl::executeScriptInIsolatedWorld( | 770 void WebLocalFrameImpl::executeScriptInIsolatedWorld( |
| 773 int worldID, | 771 int worldID, |
| 774 const WebScriptSource* sourcesIn, | 772 const WebScriptSource* sourcesIn, |
| 775 unsigned numSources, | 773 unsigned numSources, |
| 776 int extensionGroup, | |
| 777 WebVector<v8::Local<v8::Value>>* results) { | 774 WebVector<v8::Local<v8::Value>>* results) { |
| 778 DCHECK(frame()); | 775 DCHECK(frame()); |
| 779 CHECK_GT(worldID, 0); | 776 CHECK_GT(worldID, 0); |
| 780 CHECK_LT(worldID, EmbedderWorldIdLimit); | 777 CHECK_LT(worldID, EmbedderWorldIdLimit); |
| 781 | 778 |
| 782 HeapVector<ScriptSourceCode> sources = | 779 HeapVector<ScriptSourceCode> sources = |
| 783 createSourcesVector(sourcesIn, numSources); | 780 createSourcesVector(sourcesIn, numSources); |
| 784 | 781 |
| 785 if (results) { | 782 if (results) { |
| 786 Vector<v8::Local<v8::Value>> scriptResults; | 783 Vector<v8::Local<v8::Value>> scriptResults; |
| 787 frame()->script().executeScriptInIsolatedWorld( | 784 frame()->script().executeScriptInIsolatedWorld(worldID, sources, |
| 788 worldID, sources, extensionGroup, &scriptResults); | 785 &scriptResults); |
| 789 WebVector<v8::Local<v8::Value>> v8Results(scriptResults.size()); | 786 WebVector<v8::Local<v8::Value>> v8Results(scriptResults.size()); |
| 790 for (unsigned i = 0; i < scriptResults.size(); i++) | 787 for (unsigned i = 0; i < scriptResults.size(); i++) |
| 791 v8Results[i] = | 788 v8Results[i] = |
| 792 v8::Local<v8::Value>::New(toIsolate(frame()), scriptResults[i]); | 789 v8::Local<v8::Value>::New(toIsolate(frame()), scriptResults[i]); |
| 793 results->swap(v8Results); | 790 results->swap(v8Results); |
| 794 } else { | 791 } else { |
| 795 v8::HandleScope handleScope(toIsolate(frame())); | 792 v8::HandleScope handleScope(toIsolate(frame())); |
| 796 frame()->script().executeScriptInIsolatedWorld(worldID, sources, | 793 frame()->script().executeScriptInIsolatedWorld(worldID, sources, 0); |
| 797 extensionGroup, 0); | |
| 798 } | 794 } |
| 799 } | 795 } |
| 800 | 796 |
| 801 void WebLocalFrameImpl::requestExecuteScriptInIsolatedWorld( | 797 void WebLocalFrameImpl::requestExecuteScriptInIsolatedWorld( |
| 802 int worldID, | 798 int worldID, |
| 803 const WebScriptSource* sourcesIn, | 799 const WebScriptSource* sourcesIn, |
| 804 unsigned numSources, | 800 unsigned numSources, |
| 805 int extensionGroup, | |
| 806 bool userGesture, | 801 bool userGesture, |
| 807 WebScriptExecutionCallback* callback) { | 802 WebScriptExecutionCallback* callback) { |
| 808 DCHECK(frame()); | 803 DCHECK(frame()); |
| 809 CHECK_GT(worldID, 0); | 804 CHECK_GT(worldID, 0); |
| 810 CHECK_LT(worldID, EmbedderWorldIdLimit); | 805 CHECK_LT(worldID, EmbedderWorldIdLimit); |
| 811 | 806 |
| 812 SuspendableScriptExecutor::createAndRun( | 807 SuspendableScriptExecutor::createAndRun( |
| 813 frame(), worldID, createSourcesVector(sourcesIn, numSources), | 808 frame(), worldID, createSourcesVector(sourcesIn, numSources), userGesture, |
| 814 extensionGroup, userGesture, callback); | 809 callback); |
| 815 } | 810 } |
| 816 | 811 |
| 817 // TODO(bashi): Consider returning MaybeLocal. | 812 // TODO(bashi): Consider returning MaybeLocal. |
| 818 v8::Local<v8::Value> WebLocalFrameImpl::callFunctionEvenIfScriptDisabled( | 813 v8::Local<v8::Value> WebLocalFrameImpl::callFunctionEvenIfScriptDisabled( |
| 819 v8::Local<v8::Function> function, | 814 v8::Local<v8::Function> function, |
| 820 v8::Local<v8::Value> receiver, | 815 v8::Local<v8::Value> receiver, |
| 821 int argc, | 816 int argc, |
| 822 v8::Local<v8::Value> argv[]) { | 817 v8::Local<v8::Value> argv[]) { |
| 823 DCHECK(frame()); | 818 DCHECK(frame()); |
| 824 v8::Local<v8::Value> result; | 819 v8::Local<v8::Value> result; |
| (...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2359 ->frameScheduler() | 2354 ->frameScheduler() |
| 2360 ->unthrottledTaskRunner() | 2355 ->unthrottledTaskRunner() |
| 2361 ->toSingleThreadTaskRunner(); | 2356 ->toSingleThreadTaskRunner(); |
| 2362 } | 2357 } |
| 2363 | 2358 |
| 2364 WebInputMethodControllerImpl* WebLocalFrameImpl::inputMethodController() const { | 2359 WebInputMethodControllerImpl* WebLocalFrameImpl::inputMethodController() const { |
| 2365 return m_inputMethodController.get(); | 2360 return m_inputMethodController.get(); |
| 2366 } | 2361 } |
| 2367 | 2362 |
| 2368 } // namespace blink | 2363 } // namespace blink |
| OLD | NEW |