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

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

Issue 19564003: Populate cross-origin location access SecurityError messages. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase. Created 7 years, 5 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 | « Source/bindings/v8/V8Binding.cpp ('k') | no next file » | 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) 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(), resource, callStack); 97 firstWindow->document()->reportException(errorMessage, message->GetLineNumbe r(), resource, callStack);
98 } 98 }
99 99
100 static void failedAccessCheckCallbackInMainThread(v8::Local<v8::Object> host, v8 ::AccessType type, v8::Local<v8::Value> data) 100 static void failedAccessCheckCallbackInMainThread(v8::Local<v8::Object> host, v8 ::AccessType type, v8::Local<v8::Value> data)
101 { 101 {
102 Frame* target = findFrame(host, data, v8::Isolate::GetCurrent()); 102 Frame* target = findFrame(host, data, v8::Isolate::GetCurrent());
103 if (!target) 103 if (!target)
104 return; 104 return;
105 DOMWindow* targetWindow = target->domWindow(); 105 DOMWindow* targetWindow = target->domWindow();
106 targetWindow->printErrorMessage(targetWindow->crossDomainAccessErrorMessage( activeDOMWindow()));
107 106
108 // Throw an exception for failed-access checks against Location objects, oth erwise write to the console. 107 // Throw an exception for failed-access checks against Location objects, oth erwise write to the console.
109 WrapperTypeInfo* typeInfo = WrapperTypeInfo::unwrap(data); 108 WrapperTypeInfo* typeInfo = WrapperTypeInfo::unwrap(data);
110 if (V8Location::info.equals(typeInfo)) 109 if (V8Location::info.equals(typeInfo))
111 setDOMException(SecurityError, v8::Isolate::GetCurrent()); 110 setDOMException(SecurityError, targetWindow->crossDomainAccessErrorMessa ge(activeDOMWindow()), v8::Isolate::GetCurrent());
111 else
112 targetWindow->printErrorMessage(targetWindow->crossDomainAccessErrorMess age(activeDOMWindow()));
112 } 113 }
113 114
114 static bool codeGenerationCheckCallbackInMainThread(v8::Local<v8::Context> conte xt) 115 static bool codeGenerationCheckCallbackInMainThread(v8::Local<v8::Context> conte xt)
115 { 116 {
116 if (ScriptExecutionContext* scriptExecutionContext = toScriptExecutionContex t(context)) { 117 if (ScriptExecutionContext* scriptExecutionContext = toScriptExecutionContex t(context)) {
117 if (ContentSecurityPolicy* policy = toDocument(scriptExecutionContext)-> contentSecurityPolicy()) 118 if (ContentSecurityPolicy* policy = toDocument(scriptExecutionContext)-> contentSecurityPolicy())
118 return policy->allowEval(ScriptState::forContext(context)); 119 return policy->allowEval(ScriptState::forContext(context));
119 } 120 }
120 return false; 121 return false;
121 } 122 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 186
186 v8::ResourceConstraints resourceConstraints; 187 v8::ResourceConstraints resourceConstraints;
187 uint32_t here; 188 uint32_t here;
188 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin t32_t*)); 189 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin t32_t*));
189 v8::SetResourceConstraints(&resourceConstraints); 190 v8::SetResourceConstraints(&resourceConstraints);
190 191
191 V8PerIsolateData::ensureInitialized(isolate); 192 V8PerIsolateData::ensureInitialized(isolate);
192 } 193 }
193 194
194 } // namespace WebCore 195 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8Binding.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698