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

Unified Diff: Source/bindings/v8/V8Initializer.cpp

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/ExceptionStatePlaceholder.cpp ('k') | Source/bindings/v8/V8ThrowException.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/V8Initializer.cpp
diff --git a/Source/bindings/v8/V8Initializer.cpp b/Source/bindings/v8/V8Initializer.cpp
index d2e2d9c26a1e2b149bc5fc1e486d06d518e791fe..3da868f2307fb9947d03f2a907d0aead5c6d2607 100644
--- a/Source/bindings/v8/V8Initializer.cpp
+++ b/Source/bindings/v8/V8Initializer.cpp
@@ -26,6 +26,7 @@
#include "config.h"
#include "bindings/v8/V8Initializer.h"
+#include "V8DOMException.h"
#include "V8ErrorEvent.h"
#include "V8History.h"
#include "V8Location.h"
@@ -99,9 +100,19 @@ static void messageHandlerInMainThread(v8::Handle<v8::Message> message, v8::Hand
v8::Handle<v8::Value> resourceName = message->GetScriptResourceName();
bool shouldUseDocumentURL = resourceName.IsEmpty() || !resourceName->IsString();
String resource = shouldUseDocumentURL ? firstWindow->document()->url() : toWebCoreString(resourceName);
- RefPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, resource, message->GetLineNumber(), message->GetStartColumn());
AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? SharableCrossOrigin : NotSharableCrossOrigin;
+ RefPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, resource, message->GetLineNumber(), message->GetStartColumn());
+ if (V8DOMWrapper::isDOMWrapper(data)) {
+ v8::Handle<v8::Object> obj = v8::Handle<v8::Object>::Cast(data);
+ WrapperTypeInfo* type = toWrapperTypeInfo(obj);
+ if (V8DOMException::info.isSubclass(type)) {
+ DOMException* exception = V8DOMException::toNative(obj);
+ if (exception && !exception->messageForConsole().isEmpty())
+ event->setUnsanitizedMessage("Uncaught " + exception->toStringForConsole());
+ }
+ }
+
// This method might be called while we're creating a new context. In this case, we
// avoid storing the exception object, as we can't create a wrapper during context creation.
DOMWrapperWorld* world = DOMWrapperWorld::current();
« no previous file with comments | « Source/bindings/v8/ExceptionStatePlaceholder.cpp ('k') | Source/bindings/v8/V8ThrowException.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698