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

Side by Side Diff: Source/bindings/v8/V8Initializer.cpp

Issue 19596004: Allow sites to enable 'window.onerror' handlers for cross-domain scripts. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rework. 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 unified diff | Download patch | Annotate | Revision Log
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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace(); 88 v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace();
89 RefPtr<ScriptCallStack> callStack; 89 RefPtr<ScriptCallStack> callStack;
90 // Currently stack trace is only collected when inspector is open. 90 // Currently stack trace is only collected when inspector is open.
91 if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) 91 if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0)
92 callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallSt ackSizeToCapture); 92 callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallSt ackSizeToCapture);
93 93
94 v8::Handle<v8::Value> resourceName = message->GetScriptResourceName(); 94 v8::Handle<v8::Value> resourceName = message->GetScriptResourceName();
95 bool shouldUseDocumentURL = resourceName.IsEmpty() || !resourceName->IsStrin g(); 95 bool shouldUseDocumentURL = resourceName.IsEmpty() || !resourceName->IsStrin g();
96 String resource = shouldUseDocumentURL ? firstWindow->document()->url() : to WebCoreString(resourceName); 96 String resource = shouldUseDocumentURL ? firstWindow->document()->url() : to WebCoreString(resourceName);
97 firstWindow->document()->reportException(errorMessage, message->GetLineNumbe r(), message->GetStartColumn(), resource, callStack); 97 ScriptAccessControlCheckStatus corsStatus = message->IsSharedCrossOrigin() ? ScriptIsSharedCrossOrigin : ScriptIsNotSharedCrossOrigin;
98 firstWindow->document()->reportException(errorMessage, message->GetLineNumbe r(), message->GetStartColumn(), resource, callStack, corsStatus);
98 } 99 }
99 100
100 static void failedAccessCheckCallbackInMainThread(v8::Local<v8::Object> host, v8 ::AccessType type, v8::Local<v8::Value> data) 101 static void failedAccessCheckCallbackInMainThread(v8::Local<v8::Object> host, v8 ::AccessType type, v8::Local<v8::Value> data)
101 { 102 {
102 Frame* target = findFrame(host, data, v8::Isolate::GetCurrent()); 103 Frame* target = findFrame(host, data, v8::Isolate::GetCurrent());
103 if (!target) 104 if (!target)
104 return; 105 return;
105 DOMWindow* targetWindow = target->domWindow(); 106 DOMWindow* targetWindow = target->domWindow();
106 107
107 setDOMException(SecurityError, targetWindow->crossDomainAccessErrorMessage(a ctiveDOMWindow()), v8::Isolate::GetCurrent()); 108 setDOMException(SecurityError, targetWindow->crossDomainAccessErrorMessage(a ctiveDOMWindow()), v8::Isolate::GetCurrent());
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 183
183 v8::ResourceConstraints resourceConstraints; 184 v8::ResourceConstraints resourceConstraints;
184 uint32_t here; 185 uint32_t here;
185 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin t32_t*)); 186 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin t32_t*));
186 v8::SetResourceConstraints(&resourceConstraints); 187 v8::SetResourceConstraints(&resourceConstraints);
187 188
188 V8PerIsolateData::ensureInitialized(isolate); 189 V8PerIsolateData::ensureInitialized(isolate);
189 } 190 }
190 191
191 } // namespace WebCore 192 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698