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

Side by Side Diff: Source/bindings/v8/custom/V8SVGLengthCustom.cpp

Issue 68563003: Create DOM exceptions in the correct context. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased onto df9a982fbe97 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) 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 26 matching lines...) Expand all
37 #include "core/dom/ExceptionCode.h" 37 #include "core/dom/ExceptionCode.h"
38 #include "core/svg/SVGLengthContext.h" 38 #include "core/svg/SVGLengthContext.h"
39 #include "core/svg/properties/SVGPropertyTearOff.h" 39 #include "core/svg/properties/SVGPropertyTearOff.h"
40 40
41 namespace WebCore { 41 namespace WebCore {
42 42
43 void V8SVGLength::valueAttributeGetterCustom(const v8::PropertyCallbackInfo<v8:: Value>& info) 43 void V8SVGLength::valueAttributeGetterCustom(const v8::PropertyCallbackInfo<v8:: Value>& info)
44 { 44 {
45 SVGPropertyTearOff<SVGLength>* wrapper = V8SVGLength::toNative(info.Holder() ); 45 SVGPropertyTearOff<SVGLength>* wrapper = V8SVGLength::toNative(info.Holder() );
46 SVGLength& imp = wrapper->propertyReference(); 46 SVGLength& imp = wrapper->propertyReference();
47 ExceptionState exceptionState(info.GetIsolate()); 47 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
48 SVGLengthContext lengthContext(wrapper->contextElement()); 48 SVGLengthContext lengthContext(wrapper->contextElement());
49 float value = imp.value(lengthContext, exceptionState); 49 float value = imp.value(lengthContext, exceptionState);
50 if (exceptionState.throwIfNeeded()) 50 if (exceptionState.throwIfNeeded())
51 return; 51 return;
52 v8SetReturnValue(info, value); 52 v8SetReturnValue(info, value);
53 } 53 }
54 54
55 void V8SVGLength::valueAttributeSetterCustom(v8::Local<v8::Value> value, const v 8::PropertyCallbackInfo<void>& info) 55 void V8SVGLength::valueAttributeSetterCustom(v8::Local<v8::Value> value, const v 8::PropertyCallbackInfo<void>& info)
56 { 56 {
57 SVGPropertyTearOff<SVGLength>* wrapper = V8SVGLength::toNative(info.Holder() ); 57 SVGPropertyTearOff<SVGLength>* wrapper = V8SVGLength::toNative(info.Holder() );
58 if (wrapper->isReadOnly()) { 58 if (wrapper->isReadOnly()) {
59 setDOMException(NoModificationAllowedError, info.GetIsolate()); 59 setDOMException(NoModificationAllowedError, info.GetIsolate());
60 return; 60 return;
61 } 61 }
62 62
63 if (!isUndefinedOrNull(value) && !value->IsNumber() && !value->IsBoolean()) { 63 if (!isUndefinedOrNull(value) && !value->IsNumber() && !value->IsBoolean()) {
64 throwUninformativeAndGenericTypeError(info.GetIsolate()); 64 throwUninformativeAndGenericTypeError(info.GetIsolate());
65 return; 65 return;
66 } 66 }
67 67
68 SVGLength& imp = wrapper->propertyReference(); 68 SVGLength& imp = wrapper->propertyReference();
69 ExceptionState exceptionState(info.GetIsolate()); 69 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
70 SVGLengthContext lengthContext(wrapper->contextElement()); 70 SVGLengthContext lengthContext(wrapper->contextElement());
71 imp.setValue(static_cast<float>(value->NumberValue()), lengthContext, except ionState); 71 imp.setValue(static_cast<float>(value->NumberValue()), lengthContext, except ionState);
72 if (exceptionState.throwIfNeeded()) 72 if (exceptionState.throwIfNeeded())
73 return; 73 return;
74 wrapper->commitChange(); 74 wrapper->commitChange();
75 } 75 }
76 76
77 void V8SVGLength::convertToSpecifiedUnitsMethodCustom(const v8::FunctionCallback Info<v8::Value>& info) 77 void V8SVGLength::convertToSpecifiedUnitsMethodCustom(const v8::FunctionCallback Info<v8::Value>& info)
78 { 78 {
79 SVGPropertyTearOff<SVGLength>* wrapper = V8SVGLength::toNative(info.Holder() ); 79 SVGPropertyTearOff<SVGLength>* wrapper = V8SVGLength::toNative(info.Holder() );
80 if (wrapper->isReadOnly()) { 80 if (wrapper->isReadOnly()) {
81 setDOMException(NoModificationAllowedError, info.GetIsolate()); 81 setDOMException(NoModificationAllowedError, info.GetIsolate());
82 return; 82 return;
83 } 83 }
84 84
85 if (info.Length() < 1) { 85 if (info.Length() < 1) {
86 throwTypeError(ExceptionMessages::failedToExecute("convertToSpecifiedUni ts", "SVGLength", ExceptionMessages::notEnoughArguments(1, info.Length())), info .GetIsolate()); 86 throwTypeError(ExceptionMessages::failedToExecute("convertToSpecifiedUni ts", "SVGLength", ExceptionMessages::notEnoughArguments(1, info.Length())), info .GetIsolate());
87 return; 87 return;
88 } 88 }
89 89
90 SVGLength& imp = wrapper->propertyReference(); 90 SVGLength& imp = wrapper->propertyReference();
91 ExceptionState exceptionState(info.GetIsolate()); 91 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
92 V8TRYCATCH_VOID(int, unitType, toUInt32(info[0])); 92 V8TRYCATCH_VOID(int, unitType, toUInt32(info[0]));
93 SVGLengthContext lengthContext(wrapper->contextElement()); 93 SVGLengthContext lengthContext(wrapper->contextElement());
94 imp.convertToSpecifiedUnits(unitType, lengthContext, exceptionState); 94 imp.convertToSpecifiedUnits(unitType, lengthContext, exceptionState);
95 if (exceptionState.throwIfNeeded()) 95 if (exceptionState.throwIfNeeded())
96 return; 96 return;
97 wrapper->commitChange(); 97 wrapper->commitChange();
98 } 98 }
99 99
100 } // namespace WebCore 100 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/custom/V8SQLTransactionSyncCustom.cpp ('k') | Source/bindings/v8/custom/V8WindowCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698