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

Unified Diff: Source/core/dom/DOMException.h

Issue 22985006: Throw an exception when denying access to 'Frame's 'location' setter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/v8/custom/V8HTMLFrameElementCustom.cpp ('k') | Source/core/dom/DOMException.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/DOMException.h
diff --git a/Source/core/dom/DOMException.h b/Source/core/dom/DOMException.h
index ca96483b507e852dc1697effc8f3ae8dfea6a799..825cf50338c735f4bad643e3242bcaa330c35d02 100644
--- a/Source/core/dom/DOMException.h
+++ b/Source/core/dom/DOMException.h
@@ -40,24 +40,30 @@ typedef int ExceptionCode;
class DOMException : public RefCounted<DOMException>, public ScriptWrappable {
public:
- static PassRefPtr<DOMException> create(ExceptionCode, const String& message = String());
+ static PassRefPtr<DOMException> create(ExceptionCode, const String& sanitizedMessage = String(), const String& unsanitizedMessage = String());
unsigned short code() const { return m_code; }
String name() const { return m_name; }
- String message() const { return m_message; }
+ // This is the message that's exposed to JavaScript: never return unsanitized data.
+ String message() const { return m_sanitizedMessage; }
String toString() const;
+ // This is the message that's exposed to the console: if an unsanitized message is present, we prefer it.
+ String messageForConsole() const { return !m_unsanitizedMessage.isEmpty() ? m_unsanitizedMessage : m_sanitizedMessage; }
+ String toStringForConsole() const;
+
static String getErrorName(ExceptionCode);
static String getErrorMessage(ExceptionCode);
static unsigned short getLegacyErrorCode(ExceptionCode);
private:
- DOMException(unsigned short m_code, const String& name, const String& message);
+ DOMException(unsigned short m_code, const String& name, const String& sanitizedMessage, const String& unsanitizedMessage);
unsigned short m_code;
String m_name;
- String m_message;
+ String m_sanitizedMessage;
+ String m_unsanitizedMessage;
};
} // namespace WebCore
« no previous file with comments | « Source/bindings/v8/custom/V8HTMLFrameElementCustom.cpp ('k') | Source/core/dom/DOMException.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698