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

Side by Side Diff: Source/bindings/v8/ExceptionState.h

Issue 24469004: Amusingly deprecate the generic version of 'ExceptionState::throwDOMException'. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 30 matching lines...) Expand all
41 41
42 typedef int ExceptionCode; 42 typedef int ExceptionCode;
43 43
44 class ExceptionState { 44 class ExceptionState {
45 WTF_MAKE_NONCOPYABLE(ExceptionState); 45 WTF_MAKE_NONCOPYABLE(ExceptionState);
46 public: 46 public:
47 explicit ExceptionState(v8::Isolate* isolate) 47 explicit ExceptionState(v8::Isolate* isolate)
48 : m_code(0) 48 : m_code(0)
49 , m_isolate(isolate) { } 49 , m_isolate(isolate) { }
50 50
51 virtual void throwDOMException(const ExceptionCode&, const String& message = String()); 51 virtual void throwDOMException(const ExceptionCode&, const String& message) ;
52 virtual void throwTypeError(const String& message = String()); 52 virtual void throwTypeError(const String& message = String());
53 virtual void throwSecurityError(const String& sanitizedMessage, const String & unsanitizedMessage = String()); 53 virtual void throwSecurityError(const String& sanitizedMessage, const String & unsanitizedMessage = String());
54 54
55 // Please don't use this method. Use ::throwDOMException, and pass in a usef ul exception message.
56 virtual void throwUninformativeAndGenericDOMException(const ExceptionCode& e c) { throwDOMException(ec, String()); };
57
55 bool hadException() const { return !m_exception.isEmpty() || m_code; } 58 bool hadException() const { return !m_exception.isEmpty() || m_code; }
56 void clearException(); 59 void clearException();
57 60
58 ExceptionCode code() { return m_code; } 61 ExceptionCode code() { return m_code; }
59 62
60 bool throwIfNeeded() 63 bool throwIfNeeded()
61 { 64 {
62 if (m_exception.isEmpty()) { 65 if (m_exception.isEmpty()) {
63 if (!m_code) 66 if (!m_code)
64 return false; 67 return false;
65 throwDOMException(m_code); 68 throwUninformativeAndGenericDOMException(m_code);
66 } 69 }
67 70
68 V8ThrowException::throwError(m_exception.newLocal(m_isolate), m_isolate) ; 71 V8ThrowException::throwError(m_exception.newLocal(m_isolate), m_isolate) ;
69 return true; 72 return true;
70 } 73 }
71 74
72 protected: 75 protected:
73 ExceptionCode m_code; 76 ExceptionCode m_code;
74 77
75 private: 78 private:
76 void setException(v8::Handle<v8::Value>); 79 void setException(v8::Handle<v8::Value>);
77 80
78 ScopedPersistent<v8::Value> m_exception; 81 ScopedPersistent<v8::Value> m_exception;
79 v8::Isolate* m_isolate; 82 v8::Isolate* m_isolate;
80 }; 83 };
81 84
82 class TrackExceptionState : public ExceptionState { 85 class TrackExceptionState : public ExceptionState {
83 public: 86 public:
84 TrackExceptionState(): ExceptionState(0) { } 87 TrackExceptionState(): ExceptionState(0) { }
85 virtual void throwDOMException(const ExceptionCode&, const String& message = String()) OVERRIDE FINAL; 88 virtual void throwDOMException(const ExceptionCode&, const String& message) OVERRIDE FINAL;
86 virtual void throwTypeError(const String& message = String()) OVERRIDE FINAL ; 89 virtual void throwTypeError(const String& message = String()) OVERRIDE FINAL ;
87 virtual void throwSecurityError(const String& sanitizedMessage, const String & unsanitizedMessage = String()) OVERRIDE FINAL; 90 virtual void throwSecurityError(const String& sanitizedMessage, const String & unsanitizedMessage = String()) OVERRIDE FINAL;
88 }; 91 };
89 92
90 } // namespace WebCore 93 } // namespace WebCore
91 94
92 #endif // ExceptionState_h 95 #endif // ExceptionState_h
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698