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

Side by Side Diff: Source/bindings/tests/results/V8TestObjectPython.cpp

Issue 68563003: Create DOM exceptions in the correct context. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 static void callWithExecutionContextAnyAttributeAttributeSetterCallback(v8::Loca l<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void >& info) 1547 static void callWithExecutionContextAnyAttributeAttributeSetterCallback(v8::Loca l<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void >& info)
1548 { 1548 {
1549 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1549 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
1550 TestObjectPythonV8Internal::callWithExecutionContextAnyAttributeAttributeSet ter(jsValue, info); 1550 TestObjectPythonV8Internal::callWithExecutionContextAnyAttributeAttributeSet ter(jsValue, info);
1551 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1551 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
1552 } 1552 }
1553 1553
1554 static void checkSecurityForNodeReadonlyDocumentAttributeAttributeGetter(const v 8::PropertyCallbackInfo<v8::Value>& info) 1554 static void checkSecurityForNodeReadonlyDocumentAttributeAttributeGetter(const v 8::PropertyCallbackInfo<v8::Value>& info)
1555 { 1555 {
1556 TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); 1556 TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder());
1557 ExceptionState es(info.GetIsolate()); 1557 ExceptionState es(info.Holder(), info.GetIsolate());
1558 if (!BindingSecurity::shouldAllowAccessToNode(imp->checkSecurityForNodeReado nlyDocumentAttribute(), es)) { 1558 if (!BindingSecurity::shouldAllowAccessToNode(imp->checkSecurityForNodeReado nlyDocumentAttribute(), es)) {
1559 v8SetReturnValueNull(info); 1559 v8SetReturnValueNull(info);
1560 es.throwIfNeeded(); 1560 es.throwIfNeeded();
1561 return; 1561 return;
1562 } 1562 }
1563 v8SetReturnValueFast(info, imp->checkSecurityForNodeReadonlyDocumentAttribut e(), imp); 1563 v8SetReturnValueFast(info, imp->checkSecurityForNodeReadonlyDocumentAttribut e(), imp);
1564 } 1564 }
1565 1565
1566 static void checkSecurityForNodeReadonlyDocumentAttributeAttributeGetterCallback (v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 1566 static void checkSecurityForNodeReadonlyDocumentAttributeAttributeGetterCallback (v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
1567 { 1567 {
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1907 static void enforceRangeLongAttributeAttributeSetterCallback(v8::Local<v8::Strin g>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 1907 static void enforceRangeLongAttributeAttributeSetterCallback(v8::Local<v8::Strin g>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
1908 { 1908 {
1909 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1909 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
1910 TestObjectPythonV8Internal::enforceRangeLongAttributeAttributeSetter(jsValue , info); 1910 TestObjectPythonV8Internal::enforceRangeLongAttributeAttributeSetter(jsValue , info);
1911 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1911 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
1912 } 1912 }
1913 1913
1914 static void getterRaisesExceptionLongAttributeAttributeGetter(const v8::Property CallbackInfo<v8::Value>& info) 1914 static void getterRaisesExceptionLongAttributeAttributeGetter(const v8::Property CallbackInfo<v8::Value>& info)
1915 { 1915 {
1916 TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); 1916 TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder());
1917 ExceptionState es(info.GetIsolate()); 1917 ExceptionState es(info.Holder(), info.GetIsolate());
1918 int jsValue = imp->getterRaisesExceptionLongAttribute(es); 1918 int jsValue = imp->getterRaisesExceptionLongAttribute(es);
1919 if (UNLIKELY(es.throwIfNeeded())) 1919 if (UNLIKELY(es.throwIfNeeded()))
1920 return; 1920 return;
1921 v8SetReturnValueInt(info, jsValue); 1921 v8SetReturnValueInt(info, jsValue);
1922 } 1922 }
1923 1923
1924 static void getterRaisesExceptionLongAttributeAttributeGetterCallback(v8::Local< v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 1924 static void getterRaisesExceptionLongAttributeAttributeGetterCallback(v8::Local< v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
1925 { 1925 {
1926 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1926 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
1927 TestObjectPythonV8Internal::getterRaisesExceptionLongAttributeAttributeGette r(info); 1927 TestObjectPythonV8Internal::getterRaisesExceptionLongAttributeAttributeGette r(info);
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
2432 static void activityLoggingGetterForIsolatedWorldsPerWorldBindingsLongAttributeA ttributeSetterCallbackForMainWorld(v8::Local<v8::String>, v8::Local<v8::Value> j sValue, const v8::PropertyCallbackInfo<void>& info) 2432 static void activityLoggingGetterForIsolatedWorldsPerWorldBindingsLongAttributeA ttributeSetterCallbackForMainWorld(v8::Local<v8::String>, v8::Local<v8::Value> j sValue, const v8::PropertyCallbackInfo<void>& info)
2433 { 2433 {
2434 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2434 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
2435 TestObjectPythonV8Internal::activityLoggingGetterForIsolatedWorldsPerWorldBi ndingsLongAttributeAttributeSetterForMainWorld(jsValue, info); 2435 TestObjectPythonV8Internal::activityLoggingGetterForIsolatedWorldsPerWorldBi ndingsLongAttributeAttributeSetterForMainWorld(jsValue, info);
2436 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2436 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
2437 } 2437 }
2438 2438
2439 static void raisesExceptionLongAttributeAttributeGetter(const v8::PropertyCallba ckInfo<v8::Value>& info) 2439 static void raisesExceptionLongAttributeAttributeGetter(const v8::PropertyCallba ckInfo<v8::Value>& info)
2440 { 2440 {
2441 TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); 2441 TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder());
2442 ExceptionState es(info.GetIsolate()); 2442 ExceptionState es(info.Holder(), info.GetIsolate());
2443 int jsValue = imp->raisesExceptionLongAttribute(es); 2443 int jsValue = imp->raisesExceptionLongAttribute(es);
2444 if (UNLIKELY(es.throwIfNeeded())) 2444 if (UNLIKELY(es.throwIfNeeded()))
2445 return; 2445 return;
2446 v8SetReturnValueInt(info, jsValue); 2446 v8SetReturnValueInt(info, jsValue);
2447 } 2447 }
2448 2448
2449 static void raisesExceptionLongAttributeAttributeGetterCallback(v8::Local<v8::St ring>, const v8::PropertyCallbackInfo<v8::Value>& info) 2449 static void raisesExceptionLongAttributeAttributeGetterCallback(v8::Local<v8::St ring>, const v8::PropertyCallbackInfo<v8::Value>& info)
2450 { 2450 {
2451 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2451 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
2452 TestObjectPythonV8Internal::raisesExceptionLongAttributeAttributeGetter(info ); 2452 TestObjectPythonV8Internal::raisesExceptionLongAttributeAttributeGetter(info );
2453 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2453 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
2454 } 2454 }
2455 2455
2456 static void raisesExceptionLongAttributeAttributeSetter(v8::Local<v8::Value> jsV alue, const v8::PropertyCallbackInfo<void>& info) 2456 static void raisesExceptionLongAttributeAttributeSetter(v8::Local<v8::Value> jsV alue, const v8::PropertyCallbackInfo<void>& info)
2457 { 2457 {
2458 TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); 2458 TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder());
2459 V8TRYCATCH_VOID(int, cppValue, toInt32(jsValue)); 2459 V8TRYCATCH_VOID(int, cppValue, toInt32(jsValue));
2460 ExceptionState es(info.GetIsolate()); 2460 ExceptionState es(info.Holder(), info.GetIsolate());
2461 imp->setRaisesExceptionLongAttribute(cppValue, es); 2461 imp->setRaisesExceptionLongAttribute(cppValue, es);
2462 es.throwIfNeeded(); 2462 es.throwIfNeeded();
2463 } 2463 }
2464 2464
2465 static void raisesExceptionLongAttributeAttributeSetterCallback(v8::Local<v8::St ring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 2465 static void raisesExceptionLongAttributeAttributeSetterCallback(v8::Local<v8::St ring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
2466 { 2466 {
2467 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2467 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
2468 TestObjectPythonV8Internal::raisesExceptionLongAttributeAttributeSetter(jsVa lue, info); 2468 TestObjectPythonV8Internal::raisesExceptionLongAttributeAttributeSetter(jsVa lue, info);
2469 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2469 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
2470 } 2470 }
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
2929 { 2929 {
2930 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2930 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
2931 TestObjectPythonV8Internal::setterRaisesExceptionLongAttributeAttributeGette r(info); 2931 TestObjectPythonV8Internal::setterRaisesExceptionLongAttributeAttributeGette r(info);
2932 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2932 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
2933 } 2933 }
2934 2934
2935 static void setterRaisesExceptionLongAttributeAttributeSetter(v8::Local<v8::Valu e> jsValue, const v8::PropertyCallbackInfo<void>& info) 2935 static void setterRaisesExceptionLongAttributeAttributeSetter(v8::Local<v8::Valu e> jsValue, const v8::PropertyCallbackInfo<void>& info)
2936 { 2936 {
2937 TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); 2937 TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder());
2938 V8TRYCATCH_VOID(int, cppValue, toInt32(jsValue)); 2938 V8TRYCATCH_VOID(int, cppValue, toInt32(jsValue));
2939 ExceptionState es(info.GetIsolate()); 2939 ExceptionState es(info.Holder(), info.GetIsolate());
2940 imp->setSetterRaisesExceptionLongAttribute(cppValue, es); 2940 imp->setSetterRaisesExceptionLongAttribute(cppValue, es);
2941 es.throwIfNeeded(); 2941 es.throwIfNeeded();
2942 } 2942 }
2943 2943
2944 static void setterRaisesExceptionLongAttributeAttributeSetterCallback(v8::Local< v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 2944 static void setterRaisesExceptionLongAttributeAttributeSetterCallback(v8::Local< v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
2945 { 2945 {
2946 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2946 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
2947 TestObjectPythonV8Internal::setterRaisesExceptionLongAttributeAttributeSette r(jsValue, info); 2947 TestObjectPythonV8Internal::setterRaisesExceptionLongAttributeAttributeSette r(jsValue, info);
2948 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2948 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
2949 } 2949 }
(...skipping 2450 matching lines...) Expand 10 before | Expand all | Expand 10 after
5400 static void perWorldBindingsVoidMethodTestInterfaceEmptyArgMethodCallbackForMain World(const v8::FunctionCallbackInfo<v8::Value>& info) 5400 static void perWorldBindingsVoidMethodTestInterfaceEmptyArgMethodCallbackForMain World(const v8::FunctionCallbackInfo<v8::Value>& info)
5401 { 5401 {
5402 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 5402 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
5403 TestObjectPythonV8Internal::perWorldBindingsVoidMethodTestInterfaceEmptyArgM ethodForMainWorld(info); 5403 TestObjectPythonV8Internal::perWorldBindingsVoidMethodTestInterfaceEmptyArgM ethodForMainWorld(info);
5404 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 5404 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
5405 } 5405 }
5406 5406
5407 static void raisesExceptionVoidMethodMethod(const v8::FunctionCallbackInfo<v8::V alue>& info) 5407 static void raisesExceptionVoidMethodMethod(const v8::FunctionCallbackInfo<v8::V alue>& info)
5408 { 5408 {
5409 TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); 5409 TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder());
5410 ExceptionState es(info.GetIsolate()); 5410 ExceptionState es(info.Holder(), info.GetIsolate());
5411 imp->raisesExceptionVoidMethod(es); 5411 imp->raisesExceptionVoidMethod(es);
5412 if (es.throwIfNeeded()) 5412 if (es.throwIfNeeded())
5413 return; 5413 return;
5414 } 5414 }
5415 5415
5416 static void raisesExceptionVoidMethodMethodCallback(const v8::FunctionCallbackIn fo<v8::Value>& info) 5416 static void raisesExceptionVoidMethodMethodCallback(const v8::FunctionCallbackIn fo<v8::Value>& info)
5417 { 5417 {
5418 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 5418 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
5419 TestObjectPythonV8Internal::raisesExceptionVoidMethodMethod(info); 5419 TestObjectPythonV8Internal::raisesExceptionVoidMethodMethod(info);
5420 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 5420 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
5421 } 5421 }
5422 5422
5423 static void raisesExceptionVoidMethodOptionalLongArgMethod(const v8::FunctionCal lbackInfo<v8::Value>& info) 5423 static void raisesExceptionVoidMethodOptionalLongArgMethod(const v8::FunctionCal lbackInfo<v8::Value>& info)
5424 { 5424 {
5425 TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); 5425 TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder());
5426 ExceptionState es(info.GetIsolate()); 5426 ExceptionState es(info.Holder(), info.GetIsolate());
5427 if (UNLIKELY(info.Length() <= 0)) { 5427 if (UNLIKELY(info.Length() <= 0)) {
5428 imp->raisesExceptionVoidMethodOptionalLongArg(es); 5428 imp->raisesExceptionVoidMethodOptionalLongArg(es);
5429 if (es.throwIfNeeded()) 5429 if (es.throwIfNeeded())
5430 return; 5430 return;
5431 return; 5431 return;
5432 } 5432 }
5433 V8TRYCATCH_VOID(int, optionalLongArg, toInt32(info[0])); 5433 V8TRYCATCH_VOID(int, optionalLongArg, toInt32(info[0]));
5434 imp->raisesExceptionVoidMethodOptionalLongArg(optionalLongArg, es); 5434 imp->raisesExceptionVoidMethodOptionalLongArg(optionalLongArg, es);
5435 if (es.throwIfNeeded()) 5435 if (es.throwIfNeeded())
5436 return; 5436 return;
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
6038 V8DOMWrapper::associateObjectWithWrapper<V8TestObjectPython>(impl, &wrapperT ypeInfo, wrapper, isolate, WrapperConfiguration::Independent); 6038 V8DOMWrapper::associateObjectWithWrapper<V8TestObjectPython>(impl, &wrapperT ypeInfo, wrapper, isolate, WrapperConfiguration::Independent);
6039 return wrapper; 6039 return wrapper;
6040 } 6040 }
6041 6041
6042 void V8TestObjectPython::derefObject(void* object) 6042 void V8TestObjectPython::derefObject(void* object)
6043 { 6043 {
6044 fromInternalPointer(object)->deref(); 6044 fromInternalPointer(object)->deref();
6045 } 6045 }
6046 6046
6047 } // namespace WebCore 6047 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698