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

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

Issue 19932002: Throw exceptions on all failed cross-origin access checks. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: test. 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 | « LayoutTests/http/tests/security/xss-eval-expected.txt ('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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 firstWindow->document()->reportException(errorMessage, message->GetLineNumbe r(), message->GetStartColumn(), resource, callStack); 97 firstWindow->document()->reportException(errorMessage, message->GetLineNumbe r(), message->GetStartColumn(), 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 106
107 // Throw an exception for failed-access checks against Location objects, oth erwise write to the console. 107 setDOMException(SecurityError, targetWindow->crossDomainAccessErrorMessage(a ctiveDOMWindow()), v8::Isolate::GetCurrent());
108 WrapperTypeInfo* typeInfo = WrapperTypeInfo::unwrap(data);
109 if (V8Location::info.equals(typeInfo))
110 setDOMException(SecurityError, targetWindow->crossDomainAccessErrorMessa ge(activeDOMWindow()), v8::Isolate::GetCurrent());
111 else
112 targetWindow->printErrorMessage(targetWindow->crossDomainAccessErrorMess age(activeDOMWindow()));
113 } 108 }
114 109
115 static bool codeGenerationCheckCallbackInMainThread(v8::Local<v8::Context> conte xt) 110 static bool codeGenerationCheckCallbackInMainThread(v8::Local<v8::Context> conte xt)
116 { 111 {
117 if (ScriptExecutionContext* scriptExecutionContext = toScriptExecutionContex t(context)) { 112 if (ScriptExecutionContext* scriptExecutionContext = toScriptExecutionContex t(context)) {
118 if (ContentSecurityPolicy* policy = toDocument(scriptExecutionContext)-> contentSecurityPolicy()) 113 if (ContentSecurityPolicy* policy = toDocument(scriptExecutionContext)-> contentSecurityPolicy())
119 return policy->allowEval(ScriptState::forContext(context)); 114 return policy->allowEval(ScriptState::forContext(context));
120 } 115 }
121 return false; 116 return false;
122 } 117 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 182
188 v8::ResourceConstraints resourceConstraints; 183 v8::ResourceConstraints resourceConstraints;
189 uint32_t here; 184 uint32_t here;
190 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin t32_t*)); 185 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin t32_t*));
191 v8::SetResourceConstraints(&resourceConstraints); 186 v8::SetResourceConstraints(&resourceConstraints);
192 187
193 V8PerIsolateData::ensureInitialized(isolate); 188 V8PerIsolateData::ensureInitialized(isolate);
194 } 189 }
195 190
196 } // namespace WebCore 191 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/security/xss-eval-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698