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

Side by Side Diff: Source/bindings/tests/results/core/V8TestObject.cpp

Issue 1100223003: bindings: Add empty checks for toV8() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
6 6
7 #include "config.h" 7 #include "config.h"
8 #include "V8TestObject.h" 8 #include "V8TestObject.h"
9 9
10 #include "bindings/core/v8/BindingSecurity.h" 10 #include "bindings/core/v8/BindingSecurity.h"
(...skipping 12745 matching lines...) Expand 10 before | Expand all | Expand 10 after
12756 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld()); 12756 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld());
12757 if (contextInPrivateScript.IsEmpty()) 12757 if (contextInPrivateScript.IsEmpty())
12758 return false; 12758 return false;
12759 ScriptState* scriptState = ScriptState::from(contextInPrivateScript); 12759 ScriptState* scriptState = ScriptState::from(contextInPrivateScript);
12760 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); 12760 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
12761 if (!scriptState->executionContext()) 12761 if (!scriptState->executionContext())
12762 return false; 12762 return false;
12763 12763
12764 ScriptState::Scope scope(scriptState); 12764 ScriptState::Scope scope(scriptState);
12765 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate()); 12765 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate());
12766 if (holder.IsEmpty())
12767 return false;
12766 12768
12767 v8::Local<v8::Value> *argv = 0; 12769 v8::Local<v8::Value> *argv = 0;
12768 ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodI mplementedInPrivateScript", "TestObject", scriptState->context()->Global(), scri ptState->isolate()); 12770 ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodI mplementedInPrivateScript", "TestObject", scriptState->context()->Global(), scri ptState->isolate());
12769 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptState , scriptStateInUserScript, "TestObject", "voidMethodImplementedInPrivateScript", holder, 0, argv); 12771 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptState , scriptStateInUserScript, "TestObject", "voidMethodImplementedInPrivateScript", holder, 0, argv);
12770 if (v8Value.IsEmpty()) 12772 if (v8Value.IsEmpty())
12771 return false; 12773 return false;
12772 RELEASE_ASSERT(!exceptionState.hadException()); 12774 RELEASE_ASSERT(!exceptionState.hadException());
12773 return true; 12775 return true;
12774 } 12776 }
12775 12777
12776 bool V8TestObject::PrivateScript::shortMethodImplementedInPrivateScriptMethod(Lo calFrame* frame, TestObject* holderImpl, int* result) 12778 bool V8TestObject::PrivateScript::shortMethodImplementedInPrivateScriptMethod(Lo calFrame* frame, TestObject* holderImpl, int* result)
12777 { 12779 {
12778 if (!frame) 12780 if (!frame)
12779 return false; 12781 return false;
12780 v8::HandleScope handleScope(toIsolate(frame)); 12782 v8::HandleScope handleScope(toIsolate(frame));
12781 ScriptForbiddenScope::AllowUserAgentScript script; 12783 ScriptForbiddenScope::AllowUserAgentScript script;
12782 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld()); 12784 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld());
12783 if (contextInPrivateScript.IsEmpty()) 12785 if (contextInPrivateScript.IsEmpty())
12784 return false; 12786 return false;
12785 ScriptState* scriptState = ScriptState::from(contextInPrivateScript); 12787 ScriptState* scriptState = ScriptState::from(contextInPrivateScript);
12786 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); 12788 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
12787 if (!scriptState->executionContext()) 12789 if (!scriptState->executionContext())
12788 return false; 12790 return false;
12789 12791
12790 ScriptState::Scope scope(scriptState); 12792 ScriptState::Scope scope(scriptState);
12791 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate()); 12793 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate());
12794 if (holder.IsEmpty())
12795 return false;
12792 12796
12793 v8::Local<v8::Value> *argv = 0; 12797 v8::Local<v8::Value> *argv = 0;
12794 ExceptionState exceptionState(ExceptionState::ExecutionContext, "shortMethod ImplementedInPrivateScript", "TestObject", scriptState->context()->Global(), scr iptState->isolate()); 12798 ExceptionState exceptionState(ExceptionState::ExecutionContext, "shortMethod ImplementedInPrivateScript", "TestObject", scriptState->context()->Global(), scr iptState->isolate());
12795 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptState , scriptStateInUserScript, "TestObject", "shortMethodImplementedInPrivateScript" , holder, 0, argv); 12799 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptState , scriptStateInUserScript, "TestObject", "shortMethodImplementedInPrivateScript" , holder, 0, argv);
12796 if (v8Value.IsEmpty()) 12800 if (v8Value.IsEmpty())
12797 return false; 12801 return false;
12798 int cppValue = toInt16(scriptState->isolate(), v8Value, NormalConversion, ex ceptionState); 12802 int cppValue = toInt16(scriptState->isolate(), v8Value, NormalConversion, ex ceptionState);
12799 if (exceptionState.throwIfNeeded()) 12803 if (exceptionState.throwIfNeeded())
12800 return false; 12804 return false;
12801 *result = cppValue; 12805 *result = cppValue;
(...skipping 10 matching lines...) Expand all
12812 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld()); 12816 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld());
12813 if (contextInPrivateScript.IsEmpty()) 12817 if (contextInPrivateScript.IsEmpty())
12814 return false; 12818 return false;
12815 ScriptState* scriptState = ScriptState::from(contextInPrivateScript); 12819 ScriptState* scriptState = ScriptState::from(contextInPrivateScript);
12816 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); 12820 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
12817 if (!scriptState->executionContext()) 12821 if (!scriptState->executionContext())
12818 return false; 12822 return false;
12819 12823
12820 ScriptState::Scope scope(scriptState); 12824 ScriptState::Scope scope(scriptState);
12821 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate()); 12825 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate());
12826 if (holder.IsEmpty())
12827 return false;
12822 12828
12823 v8::Local<v8::Value> valueHandle = v8::Integer::New(scriptState->isolate(), value); 12829 v8::Local<v8::Value> valueHandle = v8::Integer::New(scriptState->isolate(), value);
12824 v8::Local<v8::Value> argv[] = { valueHandle }; 12830 v8::Local<v8::Value> argv[] = { valueHandle };
12825 ExceptionState exceptionState(ExceptionState::ExecutionContext, "shortMethod WithShortArgumentImplementedInPrivateScript", "TestObject", scriptState->context ()->Global(), scriptState->isolate()); 12831 ExceptionState exceptionState(ExceptionState::ExecutionContext, "shortMethod WithShortArgumentImplementedInPrivateScript", "TestObject", scriptState->context ()->Global(), scriptState->isolate());
12826 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptState , scriptStateInUserScript, "TestObject", "shortMethodWithShortArgumentImplemente dInPrivateScript", holder, 1, argv); 12832 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptState , scriptStateInUserScript, "TestObject", "shortMethodWithShortArgumentImplemente dInPrivateScript", holder, 1, argv);
12827 if (v8Value.IsEmpty()) 12833 if (v8Value.IsEmpty())
12828 return false; 12834 return false;
12829 int cppValue = toInt16(scriptState->isolate(), v8Value, NormalConversion, ex ceptionState); 12835 int cppValue = toInt16(scriptState->isolate(), v8Value, NormalConversion, ex ceptionState);
12830 if (exceptionState.throwIfNeeded()) 12836 if (exceptionState.throwIfNeeded())
12831 return false; 12837 return false;
(...skipping 11 matching lines...) Expand all
12843 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld()); 12849 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld());
12844 if (contextInPrivateScript.IsEmpty()) 12850 if (contextInPrivateScript.IsEmpty())
12845 return false; 12851 return false;
12846 ScriptState* scriptState = ScriptState::from(contextInPrivateScript); 12852 ScriptState* scriptState = ScriptState::from(contextInPrivateScript);
12847 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); 12853 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
12848 if (!scriptState->executionContext()) 12854 if (!scriptState->executionContext())
12849 return false; 12855 return false;
12850 12856
12851 ScriptState::Scope scope(scriptState); 12857 ScriptState::Scope scope(scriptState);
12852 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate()); 12858 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate());
12859 if (holder.IsEmpty())
12860 return false;
12853 12861
12854 v8::Local<v8::Value> valueHandle = v8String(scriptState->isolate(), value); 12862 v8::Local<v8::Value> valueHandle = v8String(scriptState->isolate(), value);
12855 v8::Local<v8::Value> argv[] = { valueHandle }; 12863 v8::Local<v8::Value> argv[] = { valueHandle };
12856 ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringMetho dWithStringArgumentImplementedInPrivateScript", "TestObject", scriptState->conte xt()->Global(), scriptState->isolate()); 12864 ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringMetho dWithStringArgumentImplementedInPrivateScript", "TestObject", scriptState->conte xt()->Global(), scriptState->isolate());
12857 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptState , scriptStateInUserScript, "TestObject", "stringMethodWithStringArgumentImplemen tedInPrivateScript", holder, 1, argv); 12865 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptState , scriptStateInUserScript, "TestObject", "stringMethodWithStringArgumentImplemen tedInPrivateScript", holder, 1, argv);
12858 if (v8Value.IsEmpty()) 12866 if (v8Value.IsEmpty())
12859 return false; 12867 return false;
12860 V8StringResource<> cppValue = v8Value; 12868 V8StringResource<> cppValue = v8Value;
12861 if (!cppValue.prepare()) 12869 if (!cppValue.prepare())
12862 return false; 12870 return false;
(...skipping 11 matching lines...) Expand all
12874 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld()); 12882 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld());
12875 if (contextInPrivateScript.IsEmpty()) 12883 if (contextInPrivateScript.IsEmpty())
12876 return false; 12884 return false;
12877 ScriptState* scriptState = ScriptState::from(contextInPrivateScript); 12885 ScriptState* scriptState = ScriptState::from(contextInPrivateScript);
12878 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); 12886 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
12879 if (!scriptState->executionContext()) 12887 if (!scriptState->executionContext())
12880 return false; 12888 return false;
12881 12889
12882 ScriptState::Scope scope(scriptState); 12890 ScriptState::Scope scope(scriptState);
12883 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate()); 12891 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate());
12892 if (holder.IsEmpty())
12893 return false;
12884 12894
12885 v8::Local<v8::Value> valueHandle = toV8(value, scriptState->context()->Globa l(), scriptState->isolate()); 12895 v8::Local<v8::Value> valueHandle = toV8(value, scriptState->context()->Globa l(), scriptState->isolate());
12886 v8::Local<v8::Value> argv[] = { valueHandle }; 12896 v8::Local<v8::Value> argv[] = { valueHandle };
12887 ExceptionState exceptionState(ExceptionState::ExecutionContext, "nodeMethodW ithNodeArgumentImplementedInPrivateScript", "TestObject", scriptState->context() ->Global(), scriptState->isolate()); 12897 ExceptionState exceptionState(ExceptionState::ExecutionContext, "nodeMethodW ithNodeArgumentImplementedInPrivateScript", "TestObject", scriptState->context() ->Global(), scriptState->isolate());
12888 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptState , scriptStateInUserScript, "TestObject", "nodeMethodWithNodeArgumentImplementedI nPrivateScript", holder, 1, argv); 12898 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptState , scriptStateInUserScript, "TestObject", "nodeMethodWithNodeArgumentImplementedI nPrivateScript", holder, 1, argv);
12889 if (v8Value.IsEmpty()) 12899 if (v8Value.IsEmpty())
12890 return false; 12900 return false;
12891 Node* cppValue = V8Node::toImplWithTypeCheck(scriptState->isolate(), v8Value ); 12901 Node* cppValue = V8Node::toImplWithTypeCheck(scriptState->isolate(), v8Value );
12892 *result = cppValue; 12902 *result = cppValue;
12893 RELEASE_ASSERT(!exceptionState.hadException()); 12903 RELEASE_ASSERT(!exceptionState.hadException());
12894 return true; 12904 return true;
12895 } 12905 }
12896 12906
12897 bool V8TestObject::PrivateScript::nodeMethodWithVariousArgumentsImplementedInPri vateScriptMethod(LocalFrame* frame, TestObject* holderImpl, PassRefPtrWillBeRawP tr<Document> document, PassRefPtrWillBeRawPtr<Node> node, int value1, double val ue2, String string, RefPtrWillBeRawPtr<Node>* result) 12907 bool V8TestObject::PrivateScript::nodeMethodWithVariousArgumentsImplementedInPri vateScriptMethod(LocalFrame* frame, TestObject* holderImpl, PassRefPtrWillBeRawP tr<Document> document, PassRefPtrWillBeRawPtr<Node> node, int value1, double val ue2, String string, RefPtrWillBeRawPtr<Node>* result)
12898 { 12908 {
12899 if (!frame) 12909 if (!frame)
12900 return false; 12910 return false;
12901 v8::HandleScope handleScope(toIsolate(frame)); 12911 v8::HandleScope handleScope(toIsolate(frame));
12902 ScriptForbiddenScope::AllowUserAgentScript script; 12912 ScriptForbiddenScope::AllowUserAgentScript script;
12903 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld()); 12913 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld());
12904 if (contextInPrivateScript.IsEmpty()) 12914 if (contextInPrivateScript.IsEmpty())
12905 return false; 12915 return false;
12906 ScriptState* scriptState = ScriptState::from(contextInPrivateScript); 12916 ScriptState* scriptState = ScriptState::from(contextInPrivateScript);
12907 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); 12917 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
12908 if (!scriptState->executionContext()) 12918 if (!scriptState->executionContext())
12909 return false; 12919 return false;
12910 12920
12911 ScriptState::Scope scope(scriptState); 12921 ScriptState::Scope scope(scriptState);
12912 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate()); 12922 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate());
12923 if (holder.IsEmpty())
12924 return false;
12913 12925
12914 v8::Local<v8::Value> documentHandle = toV8(document, scriptState->context()- >Global(), scriptState->isolate()); 12926 v8::Local<v8::Value> documentHandle = toV8(document, scriptState->context()- >Global(), scriptState->isolate());
12915 v8::Local<v8::Value> nodeHandle = toV8(node, scriptState->context()->Global( ), scriptState->isolate()); 12927 v8::Local<v8::Value> nodeHandle = toV8(node, scriptState->context()->Global( ), scriptState->isolate());
12916 v8::Local<v8::Value> value1Handle = v8::Integer::New(scriptState->isolate(), value1); 12928 v8::Local<v8::Value> value1Handle = v8::Integer::New(scriptState->isolate(), value1);
12917 v8::Local<v8::Value> value2Handle = v8::Number::New(scriptState->isolate(), value2); 12929 v8::Local<v8::Value> value2Handle = v8::Number::New(scriptState->isolate(), value2);
12918 v8::Local<v8::Value> stringHandle = v8String(scriptState->isolate(), string) ; 12930 v8::Local<v8::Value> stringHandle = v8String(scriptState->isolate(), string) ;
12919 v8::Local<v8::Value> argv[] = { documentHandle, nodeHandle, value1Handle, va lue2Handle, stringHandle }; 12931 v8::Local<v8::Value> argv[] = { documentHandle, nodeHandle, value1Handle, va lue2Handle, stringHandle };
12920 ExceptionState exceptionState(ExceptionState::ExecutionContext, "nodeMethodW ithVariousArgumentsImplementedInPrivateScript", "TestObject", scriptState->conte xt()->Global(), scriptState->isolate()); 12932 ExceptionState exceptionState(ExceptionState::ExecutionContext, "nodeMethodW ithVariousArgumentsImplementedInPrivateScript", "TestObject", scriptState->conte xt()->Global(), scriptState->isolate());
12921 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptState , scriptStateInUserScript, "TestObject", "nodeMethodWithVariousArgumentsImplemen tedInPrivateScript", holder, 5, argv); 12933 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptState , scriptStateInUserScript, "TestObject", "nodeMethodWithVariousArgumentsImplemen tedInPrivateScript", holder, 5, argv);
12922 if (v8Value.IsEmpty()) 12934 if (v8Value.IsEmpty())
(...skipping 13 matching lines...) Expand all
12936 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld()); 12948 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld());
12937 if (contextInPrivateScript.IsEmpty()) 12949 if (contextInPrivateScript.IsEmpty())
12938 return false; 12950 return false;
12939 ScriptState* scriptState = ScriptState::from(contextInPrivateScript); 12951 ScriptState* scriptState = ScriptState::from(contextInPrivateScript);
12940 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); 12952 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
12941 if (!scriptState->executionContext()) 12953 if (!scriptState->executionContext())
12942 return false; 12954 return false;
12943 12955
12944 ScriptState::Scope scope(scriptState); 12956 ScriptState::Scope scope(scriptState);
12945 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate()); 12957 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate());
12958 if (holder.IsEmpty())
12959 return false;
12946 12960
12947 v8::Local<v8::Value> value1Handle = v8::Integer::New(scriptState->isolate(), value1); 12961 v8::Local<v8::Value> value1Handle = v8::Integer::New(scriptState->isolate(), value1);
12948 v8::Local<v8::Value> value2Handle = v8::Integer::New(scriptState->isolate(), value2); 12962 v8::Local<v8::Value> value2Handle = v8::Integer::New(scriptState->isolate(), value2);
12949 v8::Local<v8::Value> argv[] = { value1Handle, value2Handle }; 12963 v8::Local<v8::Value> argv[] = { value1Handle, value2Handle };
12950 ExceptionState exceptionState(ExceptionState::ExecutionContext, "methodForPr ivateScriptOnly", "TestObject", scriptState->context()->Global(), scriptState->i solate()); 12964 ExceptionState exceptionState(ExceptionState::ExecutionContext, "methodForPr ivateScriptOnly", "TestObject", scriptState->context()->Global(), scriptState->i solate());
12951 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptState , scriptStateInUserScript, "TestObject", "methodForPrivateScriptOnly", holder, 2 , argv); 12965 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptState , scriptStateInUserScript, "TestObject", "methodForPrivateScriptOnly", holder, 2 , argv);
12952 if (v8Value.IsEmpty()) 12966 if (v8Value.IsEmpty())
12953 return false; 12967 return false;
12954 int cppValue = toInt16(scriptState->isolate(), v8Value, NormalConversion, ex ceptionState); 12968 int cppValue = toInt16(scriptState->isolate(), v8Value, NormalConversion, ex ceptionState);
12955 if (exceptionState.throwIfNeeded()) 12969 if (exceptionState.throwIfNeeded())
(...skipping 12 matching lines...) Expand all
12968 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld()); 12982 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld());
12969 if (contextInPrivateScript.IsEmpty()) 12983 if (contextInPrivateScript.IsEmpty())
12970 return false; 12984 return false;
12971 ScriptState* scriptState = ScriptState::from(contextInPrivateScript); 12985 ScriptState* scriptState = ScriptState::from(contextInPrivateScript);
12972 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); 12986 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
12973 if (!scriptState->executionContext()) 12987 if (!scriptState->executionContext())
12974 return false; 12988 return false;
12975 12989
12976 ScriptState::Scope scope(scriptState); 12990 ScriptState::Scope scope(scriptState);
12977 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate()); 12991 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate());
12992 if (holder.IsEmpty())
12993 return false;
12978 12994
12979 ExceptionState exceptionState(ExceptionState::GetterContext, "readonlyShortA ttribute", "TestObject", scriptState->context()->Global(), scriptState->isolate( )); 12995 ExceptionState exceptionState(ExceptionState::GetterContext, "readonlyShortA ttribute", "TestObject", scriptState->context()->Global(), scriptState->isolate( ));
12980 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(sc riptState, scriptStateInUserScript, "TestObject", "readonlyShortAttribute", hold er); 12996 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(sc riptState, scriptStateInUserScript, "TestObject", "readonlyShortAttribute", hold er);
12981 if (v8Value.IsEmpty()) 12997 if (v8Value.IsEmpty())
12982 return false; 12998 return false;
12983 int cppValue = toInt16(scriptState->isolate(), v8Value, NormalConversion, ex ceptionState); 12999 int cppValue = toInt16(scriptState->isolate(), v8Value, NormalConversion, ex ceptionState);
12984 if (exceptionState.throwIfNeeded()) 13000 if (exceptionState.throwIfNeeded())
12985 return false; 13001 return false;
12986 RELEASE_ASSERT(!exceptionState.hadException()); 13002 RELEASE_ASSERT(!exceptionState.hadException());
12987 *result = cppValue; 13003 *result = cppValue;
12988 return true; 13004 return true;
12989 } 13005 }
12990 13006
12991 bool V8TestObject::PrivateScript::shortAttributeAttributeGetter(LocalFrame* fram e, TestObject* holderImpl, int* result) 13007 bool V8TestObject::PrivateScript::shortAttributeAttributeGetter(LocalFrame* fram e, TestObject* holderImpl, int* result)
12992 { 13008 {
12993 if (!frame) 13009 if (!frame)
12994 return false; 13010 return false;
12995 v8::HandleScope handleScope(toIsolate(frame)); 13011 v8::HandleScope handleScope(toIsolate(frame));
12996 ScriptForbiddenScope::AllowUserAgentScript script; 13012 ScriptForbiddenScope::AllowUserAgentScript script;
12997 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld()); 13013 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld());
12998 if (contextInPrivateScript.IsEmpty()) 13014 if (contextInPrivateScript.IsEmpty())
12999 return false; 13015 return false;
13000 ScriptState* scriptState = ScriptState::from(contextInPrivateScript); 13016 ScriptState* scriptState = ScriptState::from(contextInPrivateScript);
13001 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); 13017 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
13002 if (!scriptState->executionContext()) 13018 if (!scriptState->executionContext())
13003 return false; 13019 return false;
13004 13020
13005 ScriptState::Scope scope(scriptState); 13021 ScriptState::Scope scope(scriptState);
13006 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate()); 13022 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate());
13023 if (holder.IsEmpty())
13024 return false;
13007 13025
13008 ExceptionState exceptionState(ExceptionState::GetterContext, "shortAttribute ", "TestObject", scriptState->context()->Global(), scriptState->isolate()); 13026 ExceptionState exceptionState(ExceptionState::GetterContext, "shortAttribute ", "TestObject", scriptState->context()->Global(), scriptState->isolate());
13009 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(sc riptState, scriptStateInUserScript, "TestObject", "shortAttribute", holder); 13027 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(sc riptState, scriptStateInUserScript, "TestObject", "shortAttribute", holder);
13010 if (v8Value.IsEmpty()) 13028 if (v8Value.IsEmpty())
13011 return false; 13029 return false;
13012 int cppValue = toInt16(scriptState->isolate(), v8Value, NormalConversion, ex ceptionState); 13030 int cppValue = toInt16(scriptState->isolate(), v8Value, NormalConversion, ex ceptionState);
13013 if (exceptionState.throwIfNeeded()) 13031 if (exceptionState.throwIfNeeded())
13014 return false; 13032 return false;
13015 RELEASE_ASSERT(!exceptionState.hadException()); 13033 RELEASE_ASSERT(!exceptionState.hadException());
13016 *result = cppValue; 13034 *result = cppValue;
13017 return true; 13035 return true;
13018 } 13036 }
13019 13037
13020 bool V8TestObject::PrivateScript::shortAttributeAttributeSetter(LocalFrame* fram e, TestObject* holderImpl, int cppValue) 13038 bool V8TestObject::PrivateScript::shortAttributeAttributeSetter(LocalFrame* fram e, TestObject* holderImpl, int cppValue)
13021 { 13039 {
13022 if (!frame) 13040 if (!frame)
13023 return false; 13041 return false;
13024 v8::HandleScope handleScope(toIsolate(frame)); 13042 v8::HandleScope handleScope(toIsolate(frame));
13025 ScriptForbiddenScope::AllowUserAgentScript script; 13043 ScriptForbiddenScope::AllowUserAgentScript script;
13026 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld()); 13044 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld());
13027 if (contextInPrivateScript.IsEmpty()) 13045 if (contextInPrivateScript.IsEmpty())
13028 return false; 13046 return false;
13029 ScriptState* scriptState = ScriptState::from(contextInPrivateScript); 13047 ScriptState* scriptState = ScriptState::from(contextInPrivateScript);
13030 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); 13048 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
13031 if (!scriptState->executionContext()) 13049 if (!scriptState->executionContext())
13032 return false; 13050 return false;
13033 13051
13034 ScriptState::Scope scope(scriptState); 13052 ScriptState::Scope scope(scriptState);
13035 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate()); 13053 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate());
13054 if (holder.IsEmpty())
13055 return false;
13036 13056
13037 ExceptionState exceptionState(ExceptionState::SetterContext, "shortAttribute ", "TestObject", scriptState->context()->Global(), scriptState->isolate()); 13057 ExceptionState exceptionState(ExceptionState::SetterContext, "shortAttribute ", "TestObject", scriptState->context()->Global(), scriptState->isolate());
13038 return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateIn UserScript, "TestObject", "shortAttribute", holder, v8::Integer::New(scriptState ->isolate(), cppValue)); 13058 return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateIn UserScript, "TestObject", "shortAttribute", holder, v8::Integer::New(scriptState ->isolate(), cppValue));
13039 } 13059 }
13040 13060
13041 bool V8TestObject::PrivateScript::stringAttributeAttributeGetter(LocalFrame* fra me, TestObject* holderImpl, String* result) 13061 bool V8TestObject::PrivateScript::stringAttributeAttributeGetter(LocalFrame* fra me, TestObject* holderImpl, String* result)
13042 { 13062 {
13043 if (!frame) 13063 if (!frame)
13044 return false; 13064 return false;
13045 v8::HandleScope handleScope(toIsolate(frame)); 13065 v8::HandleScope handleScope(toIsolate(frame));
13046 ScriptForbiddenScope::AllowUserAgentScript script; 13066 ScriptForbiddenScope::AllowUserAgentScript script;
13047 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld()); 13067 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld());
13048 if (contextInPrivateScript.IsEmpty()) 13068 if (contextInPrivateScript.IsEmpty())
13049 return false; 13069 return false;
13050 ScriptState* scriptState = ScriptState::from(contextInPrivateScript); 13070 ScriptState* scriptState = ScriptState::from(contextInPrivateScript);
13051 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); 13071 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
13052 if (!scriptState->executionContext()) 13072 if (!scriptState->executionContext())
13053 return false; 13073 return false;
13054 13074
13055 ScriptState::Scope scope(scriptState); 13075 ScriptState::Scope scope(scriptState);
13056 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate()); 13076 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate());
13077 if (holder.IsEmpty())
13078 return false;
13057 13079
13058 ExceptionState exceptionState(ExceptionState::GetterContext, "stringAttribut e", "TestObject", scriptState->context()->Global(), scriptState->isolate()); 13080 ExceptionState exceptionState(ExceptionState::GetterContext, "stringAttribut e", "TestObject", scriptState->context()->Global(), scriptState->isolate());
13059 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(sc riptState, scriptStateInUserScript, "TestObject", "stringAttribute", holder); 13081 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(sc riptState, scriptStateInUserScript, "TestObject", "stringAttribute", holder);
13060 if (v8Value.IsEmpty()) 13082 if (v8Value.IsEmpty())
13061 return false; 13083 return false;
13062 V8StringResource<> cppValue = v8Value; 13084 V8StringResource<> cppValue = v8Value;
13063 if (!cppValue.prepare()) 13085 if (!cppValue.prepare())
13064 return false; 13086 return false;
13065 RELEASE_ASSERT(!exceptionState.hadException()); 13087 RELEASE_ASSERT(!exceptionState.hadException());
13066 *result = cppValue; 13088 *result = cppValue;
13067 return true; 13089 return true;
13068 } 13090 }
13069 13091
13070 bool V8TestObject::PrivateScript::stringAttributeAttributeSetter(LocalFrame* fra me, TestObject* holderImpl, String cppValue) 13092 bool V8TestObject::PrivateScript::stringAttributeAttributeSetter(LocalFrame* fra me, TestObject* holderImpl, String cppValue)
13071 { 13093 {
13072 if (!frame) 13094 if (!frame)
13073 return false; 13095 return false;
13074 v8::HandleScope handleScope(toIsolate(frame)); 13096 v8::HandleScope handleScope(toIsolate(frame));
13075 ScriptForbiddenScope::AllowUserAgentScript script; 13097 ScriptForbiddenScope::AllowUserAgentScript script;
13076 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld()); 13098 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld());
13077 if (contextInPrivateScript.IsEmpty()) 13099 if (contextInPrivateScript.IsEmpty())
13078 return false; 13100 return false;
13079 ScriptState* scriptState = ScriptState::from(contextInPrivateScript); 13101 ScriptState* scriptState = ScriptState::from(contextInPrivateScript);
13080 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); 13102 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
13081 if (!scriptState->executionContext()) 13103 if (!scriptState->executionContext())
13082 return false; 13104 return false;
13083 13105
13084 ScriptState::Scope scope(scriptState); 13106 ScriptState::Scope scope(scriptState);
13085 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate()); 13107 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate());
13108 if (holder.IsEmpty())
13109 return false;
13086 13110
13087 ExceptionState exceptionState(ExceptionState::SetterContext, "stringAttribut e", "TestObject", scriptState->context()->Global(), scriptState->isolate()); 13111 ExceptionState exceptionState(ExceptionState::SetterContext, "stringAttribut e", "TestObject", scriptState->context()->Global(), scriptState->isolate());
13088 return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateIn UserScript, "TestObject", "stringAttribute", holder, v8String(scriptState->isola te(), cppValue)); 13112 return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateIn UserScript, "TestObject", "stringAttribute", holder, v8String(scriptState->isola te(), cppValue));
13089 } 13113 }
13090 13114
13091 bool V8TestObject::PrivateScript::nodeAttributeAttributeGetter(LocalFrame* frame , TestObject* holderImpl, RefPtrWillBeRawPtr<Node>* result) 13115 bool V8TestObject::PrivateScript::nodeAttributeAttributeGetter(LocalFrame* frame , TestObject* holderImpl, RefPtrWillBeRawPtr<Node>* result)
13092 { 13116 {
13093 if (!frame) 13117 if (!frame)
13094 return false; 13118 return false;
13095 v8::HandleScope handleScope(toIsolate(frame)); 13119 v8::HandleScope handleScope(toIsolate(frame));
13096 ScriptForbiddenScope::AllowUserAgentScript script; 13120 ScriptForbiddenScope::AllowUserAgentScript script;
13097 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld()); 13121 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld());
13098 if (contextInPrivateScript.IsEmpty()) 13122 if (contextInPrivateScript.IsEmpty())
13099 return false; 13123 return false;
13100 ScriptState* scriptState = ScriptState::from(contextInPrivateScript); 13124 ScriptState* scriptState = ScriptState::from(contextInPrivateScript);
13101 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); 13125 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
13102 if (!scriptState->executionContext()) 13126 if (!scriptState->executionContext())
13103 return false; 13127 return false;
13104 13128
13105 ScriptState::Scope scope(scriptState); 13129 ScriptState::Scope scope(scriptState);
13106 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate()); 13130 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate());
13131 if (holder.IsEmpty())
13132 return false;
13107 13133
13108 ExceptionState exceptionState(ExceptionState::GetterContext, "nodeAttribute" , "TestObject", scriptState->context()->Global(), scriptState->isolate()); 13134 ExceptionState exceptionState(ExceptionState::GetterContext, "nodeAttribute" , "TestObject", scriptState->context()->Global(), scriptState->isolate());
13109 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(sc riptState, scriptStateInUserScript, "TestObject", "nodeAttribute", holder); 13135 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(sc riptState, scriptStateInUserScript, "TestObject", "nodeAttribute", holder);
13110 if (v8Value.IsEmpty()) 13136 if (v8Value.IsEmpty())
13111 return false; 13137 return false;
13112 Node* cppValue = V8Node::toImplWithTypeCheck(scriptState->isolate(), v8Value ); 13138 Node* cppValue = V8Node::toImplWithTypeCheck(scriptState->isolate(), v8Value );
13113 RELEASE_ASSERT(!exceptionState.hadException()); 13139 RELEASE_ASSERT(!exceptionState.hadException());
13114 *result = cppValue; 13140 *result = cppValue;
13115 return true; 13141 return true;
13116 } 13142 }
13117 13143
13118 bool V8TestObject::PrivateScript::nodeAttributeAttributeSetter(LocalFrame* frame , TestObject* holderImpl, PassRefPtrWillBeRawPtr<Node> cppValue) 13144 bool V8TestObject::PrivateScript::nodeAttributeAttributeSetter(LocalFrame* frame , TestObject* holderImpl, PassRefPtrWillBeRawPtr<Node> cppValue)
13119 { 13145 {
13120 if (!frame) 13146 if (!frame)
13121 return false; 13147 return false;
13122 v8::HandleScope handleScope(toIsolate(frame)); 13148 v8::HandleScope handleScope(toIsolate(frame));
13123 ScriptForbiddenScope::AllowUserAgentScript script; 13149 ScriptForbiddenScope::AllowUserAgentScript script;
13124 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld()); 13150 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld());
13125 if (contextInPrivateScript.IsEmpty()) 13151 if (contextInPrivateScript.IsEmpty())
13126 return false; 13152 return false;
13127 ScriptState* scriptState = ScriptState::from(contextInPrivateScript); 13153 ScriptState* scriptState = ScriptState::from(contextInPrivateScript);
13128 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); 13154 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
13129 if (!scriptState->executionContext()) 13155 if (!scriptState->executionContext())
13130 return false; 13156 return false;
13131 13157
13132 ScriptState::Scope scope(scriptState); 13158 ScriptState::Scope scope(scriptState);
13133 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate()); 13159 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate());
13160 if (holder.IsEmpty())
13161 return false;
13134 13162
13135 ExceptionState exceptionState(ExceptionState::SetterContext, "nodeAttribute" , "TestObject", scriptState->context()->Global(), scriptState->isolate()); 13163 ExceptionState exceptionState(ExceptionState::SetterContext, "nodeAttribute" , "TestObject", scriptState->context()->Global(), scriptState->isolate());
13136 return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateIn UserScript, "TestObject", "nodeAttribute", holder, toV8(cppValue, scriptState->c ontext()->Global(), scriptState->isolate())); 13164 return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateIn UserScript, "TestObject", "nodeAttribute", holder, toV8(cppValue, scriptState->c ontext()->Global(), scriptState->isolate()));
13137 } 13165 }
13138 13166
13139 bool V8TestObject::PrivateScript::attributeForPrivateScriptOnlyAttributeGetter(L ocalFrame* frame, TestObject* holderImpl, String* result) 13167 bool V8TestObject::PrivateScript::attributeForPrivateScriptOnlyAttributeGetter(L ocalFrame* frame, TestObject* holderImpl, String* result)
13140 { 13168 {
13141 if (!frame) 13169 if (!frame)
13142 return false; 13170 return false;
13143 v8::HandleScope handleScope(toIsolate(frame)); 13171 v8::HandleScope handleScope(toIsolate(frame));
13144 ScriptForbiddenScope::AllowUserAgentScript script; 13172 ScriptForbiddenScope::AllowUserAgentScript script;
13145 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld()); 13173 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld());
13146 if (contextInPrivateScript.IsEmpty()) 13174 if (contextInPrivateScript.IsEmpty())
13147 return false; 13175 return false;
13148 ScriptState* scriptState = ScriptState::from(contextInPrivateScript); 13176 ScriptState* scriptState = ScriptState::from(contextInPrivateScript);
13149 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); 13177 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
13150 if (!scriptState->executionContext()) 13178 if (!scriptState->executionContext())
13151 return false; 13179 return false;
13152 13180
13153 ScriptState::Scope scope(scriptState); 13181 ScriptState::Scope scope(scriptState);
13154 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate()); 13182 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate());
13183 if (holder.IsEmpty())
13184 return false;
13155 13185
13156 ExceptionState exceptionState(ExceptionState::GetterContext, "attributeForPr ivateScriptOnly", "TestObject", scriptState->context()->Global(), scriptState->i solate()); 13186 ExceptionState exceptionState(ExceptionState::GetterContext, "attributeForPr ivateScriptOnly", "TestObject", scriptState->context()->Global(), scriptState->i solate());
13157 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(sc riptState, scriptStateInUserScript, "TestObject", "attributeForPrivateScriptOnly ", holder); 13187 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(sc riptState, scriptStateInUserScript, "TestObject", "attributeForPrivateScriptOnly ", holder);
13158 if (v8Value.IsEmpty()) 13188 if (v8Value.IsEmpty())
13159 return false; 13189 return false;
13160 V8StringResource<> cppValue = v8Value; 13190 V8StringResource<> cppValue = v8Value;
13161 if (!cppValue.prepare()) 13191 if (!cppValue.prepare())
13162 return false; 13192 return false;
13163 RELEASE_ASSERT(!exceptionState.hadException()); 13193 RELEASE_ASSERT(!exceptionState.hadException());
13164 *result = cppValue; 13194 *result = cppValue;
13165 return true; 13195 return true;
13166 } 13196 }
13167 13197
13168 bool V8TestObject::PrivateScript::attributeForPrivateScriptOnlyAttributeSetter(L ocalFrame* frame, TestObject* holderImpl, String cppValue) 13198 bool V8TestObject::PrivateScript::attributeForPrivateScriptOnlyAttributeSetter(L ocalFrame* frame, TestObject* holderImpl, String cppValue)
13169 { 13199 {
13170 if (!frame) 13200 if (!frame)
13171 return false; 13201 return false;
13172 v8::HandleScope handleScope(toIsolate(frame)); 13202 v8::HandleScope handleScope(toIsolate(frame));
13173 ScriptForbiddenScope::AllowUserAgentScript script; 13203 ScriptForbiddenScope::AllowUserAgentScript script;
13174 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld()); 13204 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld());
13175 if (contextInPrivateScript.IsEmpty()) 13205 if (contextInPrivateScript.IsEmpty())
13176 return false; 13206 return false;
13177 ScriptState* scriptState = ScriptState::from(contextInPrivateScript); 13207 ScriptState* scriptState = ScriptState::from(contextInPrivateScript);
13178 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); 13208 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
13179 if (!scriptState->executionContext()) 13209 if (!scriptState->executionContext())
13180 return false; 13210 return false;
13181 13211
13182 ScriptState::Scope scope(scriptState); 13212 ScriptState::Scope scope(scriptState);
13183 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate()); 13213 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate());
13214 if (holder.IsEmpty())
13215 return false;
13184 13216
13185 ExceptionState exceptionState(ExceptionState::SetterContext, "attributeForPr ivateScriptOnly", "TestObject", scriptState->context()->Global(), scriptState->i solate()); 13217 ExceptionState exceptionState(ExceptionState::SetterContext, "attributeForPr ivateScriptOnly", "TestObject", scriptState->context()->Global(), scriptState->i solate());
13186 return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateIn UserScript, "TestObject", "attributeForPrivateScriptOnly", holder, v8String(scri ptState->isolate(), cppValue)); 13218 return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateIn UserScript, "TestObject", "attributeForPrivateScriptOnly", holder, v8String(scri ptState->isolate(), cppValue));
13187 } 13219 }
13188 13220
13189 bool V8TestObject::PrivateScript::enumForPrivateScriptAttributeGetter(LocalFrame * frame, TestObject* holderImpl, String* result) 13221 bool V8TestObject::PrivateScript::enumForPrivateScriptAttributeGetter(LocalFrame * frame, TestObject* holderImpl, String* result)
13190 { 13222 {
13191 if (!frame) 13223 if (!frame)
13192 return false; 13224 return false;
13193 v8::HandleScope handleScope(toIsolate(frame)); 13225 v8::HandleScope handleScope(toIsolate(frame));
13194 ScriptForbiddenScope::AllowUserAgentScript script; 13226 ScriptForbiddenScope::AllowUserAgentScript script;
13195 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld()); 13227 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld());
13196 if (contextInPrivateScript.IsEmpty()) 13228 if (contextInPrivateScript.IsEmpty())
13197 return false; 13229 return false;
13198 ScriptState* scriptState = ScriptState::from(contextInPrivateScript); 13230 ScriptState* scriptState = ScriptState::from(contextInPrivateScript);
13199 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); 13231 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
13200 if (!scriptState->executionContext()) 13232 if (!scriptState->executionContext())
13201 return false; 13233 return false;
13202 13234
13203 ScriptState::Scope scope(scriptState); 13235 ScriptState::Scope scope(scriptState);
13204 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate()); 13236 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate());
13237 if (holder.IsEmpty())
13238 return false;
13205 13239
13206 ExceptionState exceptionState(ExceptionState::GetterContext, "enumForPrivate Script", "TestObject", scriptState->context()->Global(), scriptState->isolate()) ; 13240 ExceptionState exceptionState(ExceptionState::GetterContext, "enumForPrivate Script", "TestObject", scriptState->context()->Global(), scriptState->isolate()) ;
13207 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(sc riptState, scriptStateInUserScript, "TestObject", "enumForPrivateScript", holder ); 13241 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(sc riptState, scriptStateInUserScript, "TestObject", "enumForPrivateScript", holder );
13208 if (v8Value.IsEmpty()) 13242 if (v8Value.IsEmpty())
13209 return false; 13243 return false;
13210 V8StringResource<> cppValue = v8Value; 13244 V8StringResource<> cppValue = v8Value;
13211 if (!cppValue.prepare()) 13245 if (!cppValue.prepare())
13212 return false; 13246 return false;
13213 RELEASE_ASSERT(!exceptionState.hadException()); 13247 RELEASE_ASSERT(!exceptionState.hadException());
13214 *result = cppValue; 13248 *result = cppValue;
13215 return true; 13249 return true;
13216 } 13250 }
13217 13251
13218 bool V8TestObject::PrivateScript::enumForPrivateScriptAttributeSetter(LocalFrame * frame, TestObject* holderImpl, String cppValue) 13252 bool V8TestObject::PrivateScript::enumForPrivateScriptAttributeSetter(LocalFrame * frame, TestObject* holderImpl, String cppValue)
13219 { 13253 {
13220 if (!frame) 13254 if (!frame)
13221 return false; 13255 return false;
13222 v8::HandleScope handleScope(toIsolate(frame)); 13256 v8::HandleScope handleScope(toIsolate(frame));
13223 ScriptForbiddenScope::AllowUserAgentScript script; 13257 ScriptForbiddenScope::AllowUserAgentScript script;
13224 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld()); 13258 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe rWorld::privateScriptIsolatedWorld());
13225 if (contextInPrivateScript.IsEmpty()) 13259 if (contextInPrivateScript.IsEmpty())
13226 return false; 13260 return false;
13227 ScriptState* scriptState = ScriptState::from(contextInPrivateScript); 13261 ScriptState* scriptState = ScriptState::from(contextInPrivateScript);
13228 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); 13262 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
13229 if (!scriptState->executionContext()) 13263 if (!scriptState->executionContext())
13230 return false; 13264 return false;
13231 13265
13232 ScriptState::Scope scope(scriptState); 13266 ScriptState::Scope scope(scriptState);
13233 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate()); 13267 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate());
13268 if (holder.IsEmpty())
13269 return false;
13234 13270
13235 ExceptionState exceptionState(ExceptionState::SetterContext, "enumForPrivate Script", "TestObject", scriptState->context()->Global(), scriptState->isolate()) ; 13271 ExceptionState exceptionState(ExceptionState::SetterContext, "enumForPrivate Script", "TestObject", scriptState->context()->Global(), scriptState->isolate()) ;
13236 return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateIn UserScript, "TestObject", "enumForPrivateScript", holder, v8String(scriptState-> isolate(), cppValue)); 13272 return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateIn UserScript, "TestObject", "enumForPrivateScript", holder, v8String(scriptState-> isolate(), cppValue));
13237 } 13273 }
13238 13274
13239 } // namespace blink 13275 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698