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

Side by Side Diff: third_party/WebKit/Source/core/events/ErrorEvent.h

Issue 2804533002: Update Error Event inside a worker to provide the exact exception value (Closed)
Patch Set: Created 3 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 /* 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 30 matching lines...) Expand all
41 41
42 namespace blink { 42 namespace blink {
43 43
44 class ErrorEvent final : public Event { 44 class ErrorEvent final : public Event {
45 DEFINE_WRAPPERTYPEINFO(); 45 DEFINE_WRAPPERTYPEINFO();
46 46
47 public: 47 public:
48 static ErrorEvent* create() { return new ErrorEvent; } 48 static ErrorEvent* create() { return new ErrorEvent; }
49 static ErrorEvent* create(const String& message, 49 static ErrorEvent* create(const String& message,
50 std::unique_ptr<SourceLocation> location, 50 std::unique_ptr<SourceLocation> location,
51 DOMWrapperWorld* world) { 51 DOMWrapperWorld* world) {
shimazu 2017/04/05 07:23:22 Just confirmation; do we still keep the old factor
yiyix 2017/04/05 09:02:56 I can add a default value to |error|, where error
shimazu 2017/04/05 09:29:40 Yes, as you mentioned default values are not prefe
52 return new ErrorEvent(message, std::move(location), world); 52 return new ErrorEvent(message, std::move(location), world);
53 } 53 }
54
55 static ErrorEvent* create(const String& message,
56 std::unique_ptr<SourceLocation> location,
57 DOMWrapperWorld* world,
58 ScriptValue error) {
59 ErrorEvent* event = new ErrorEvent(message, std::move(location), world);
60 event->m_error = error;
61 return event;
62 }
63
54 static ErrorEvent* create(const AtomicString& type, 64 static ErrorEvent* create(const AtomicString& type,
55 const ErrorEventInit& initializer) { 65 const ErrorEventInit& initializer) {
56 return new ErrorEvent(type, initializer); 66 return new ErrorEvent(type, initializer);
57 } 67 }
58 static ErrorEvent* createSanitizedError(DOMWrapperWorld* world) { 68 static ErrorEvent* createSanitizedError(DOMWrapperWorld* world) {
59 return new ErrorEvent("Script error.", 69 return new ErrorEvent("Script error.",
60 SourceLocation::create(String(), 0, 0, nullptr), 70 SourceLocation::create(String(), 0, 0, nullptr),
61 world); 71 world);
62 } 72 }
63 ~ErrorEvent() override; 73 ~ErrorEvent() override;
(...skipping 18 matching lines...) Expand all
82 DOMWrapperWorld* world() const { return m_world.get(); } 92 DOMWrapperWorld* world() const { return m_world.get(); }
83 93
84 void setUnsanitizedMessage(const String&); 94 void setUnsanitizedMessage(const String&);
85 95
86 DECLARE_VIRTUAL_TRACE(); 96 DECLARE_VIRTUAL_TRACE();
87 97
88 private: 98 private:
89 ErrorEvent(); 99 ErrorEvent();
90 ErrorEvent(const String& message, 100 ErrorEvent(const String& message,
91 std::unique_ptr<SourceLocation>, 101 std::unique_ptr<SourceLocation>,
92 DOMWrapperWorld*); 102 DOMWrapperWorld*);
nhiroki 2017/04/05 07:38:38 How about changing this ctor as follows and then c
yiyix 2017/04/05 09:02:56 Done.
93 ErrorEvent(const AtomicString&, const ErrorEventInit&); 103 ErrorEvent(const AtomicString&, const ErrorEventInit&);
94 104
95 String m_unsanitizedMessage; 105 String m_unsanitizedMessage;
96 String m_sanitizedMessage; 106 String m_sanitizedMessage;
97 std::unique_ptr<SourceLocation> m_location; 107 std::unique_ptr<SourceLocation> m_location;
98 ScriptValue m_error; 108 ScriptValue m_error;
99 109
100 RefPtr<DOMWrapperWorld> m_world; 110 RefPtr<DOMWrapperWorld> m_world;
101 }; 111 };
102 112
103 } // namespace blink 113 } // namespace blink
104 114
105 #endif // ErrorEvent_h 115 #endif // ErrorEvent_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698