OLD | NEW |
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 ExceptionCode code() { return m_code; } | 58 ExceptionCode code() { return m_code; } |
59 | 59 |
60 bool throwIfNeeded() | 60 bool throwIfNeeded() |
61 { | 61 { |
62 if (m_exception.isEmpty()) { | 62 if (m_exception.isEmpty()) { |
63 if (!m_code) | 63 if (!m_code) |
64 return false; | 64 return false; |
65 throwDOMException(m_code); | 65 throwDOMException(m_code); |
66 } | 66 } |
67 | 67 |
68 V8ThrowException::throwError(m_exception.newLocal(m_isolate)); | 68 V8ThrowException::throwError(m_exception.newLocal(m_isolate), m_isolate)
; |
69 return true; | 69 return true; |
70 } | 70 } |
71 | 71 |
72 protected: | 72 protected: |
73 ExceptionCode m_code; | 73 ExceptionCode m_code; |
74 | 74 |
75 private: | 75 private: |
76 void setException(v8::Handle<v8::Value>); | 76 void setException(v8::Handle<v8::Value>); |
77 | 77 |
78 ScopedPersistent<v8::Value> m_exception; | 78 ScopedPersistent<v8::Value> m_exception; |
79 v8::Isolate* m_isolate; | 79 v8::Isolate* m_isolate; |
80 }; | 80 }; |
81 | 81 |
82 class TrackExceptionState : public ExceptionState { | 82 class TrackExceptionState : public ExceptionState { |
83 public: | 83 public: |
84 TrackExceptionState(): ExceptionState(0) { } | 84 TrackExceptionState(): ExceptionState(0) { } |
85 virtual void throwDOMException(const ExceptionCode&, const String& message =
String()) OVERRIDE FINAL; | 85 virtual void throwDOMException(const ExceptionCode&, const String& message =
String()) OVERRIDE FINAL; |
86 virtual void throwTypeError(const String& message = String()) OVERRIDE FINAL
; | 86 virtual void throwTypeError(const String& message = String()) OVERRIDE FINAL
; |
87 virtual void throwSecurityError(const String& sanitizedMessage, const String
& unsanitizedMessage = String()) OVERRIDE FINAL; | 87 virtual void throwSecurityError(const String& sanitizedMessage, const String
& unsanitizedMessage = String()) OVERRIDE FINAL; |
88 }; | 88 }; |
89 | 89 |
90 } // namespace WebCore | 90 } // namespace WebCore |
91 | 91 |
92 #endif // ExceptionState_h | 92 #endif // ExceptionState_h |
OLD | NEW |