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

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

Issue 19095003: Throw 'SecurityError' upon cross-origin Location access. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebaseline. 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/xssAuditor/xss-protection-parsing-04-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 17 matching lines...) Expand all
28 28
29 #include "V8History.h" 29 #include "V8History.h"
30 #include "V8Location.h" 30 #include "V8Location.h"
31 #include "V8Window.h" 31 #include "V8Window.h"
32 #include "bindings/v8/ScriptCallStackFactory.h" 32 #include "bindings/v8/ScriptCallStackFactory.h"
33 #include "bindings/v8/ScriptProfiler.h" 33 #include "bindings/v8/ScriptProfiler.h"
34 #include "bindings/v8/V8Binding.h" 34 #include "bindings/v8/V8Binding.h"
35 #include "bindings/v8/V8GCController.h" 35 #include "bindings/v8/V8GCController.h"
36 #include "bindings/v8/V8PerContextData.h" 36 #include "bindings/v8/V8PerContextData.h"
37 #include "core/dom/Document.h" 37 #include "core/dom/Document.h"
38 #include "core/dom/ExceptionCode.h"
38 #include "core/inspector/ScriptCallStack.h" 39 #include "core/inspector/ScriptCallStack.h"
39 #include "core/page/ConsoleTypes.h" 40 #include "core/page/ConsoleTypes.h"
40 #include "core/page/ContentSecurityPolicy.h" 41 #include "core/page/ContentSecurityPolicy.h"
41 #include "core/page/DOMWindow.h" 42 #include "core/page/DOMWindow.h"
42 #include "core/page/Frame.h" 43 #include "core/page/Frame.h"
43 #include "core/platform/MemoryUsageSupport.h" 44 #include "core/platform/MemoryUsageSupport.h"
44 #include <v8-debug.h> 45 #include <v8-debug.h>
45 #include "wtf/RefPtr.h" 46 #include "wtf/RefPtr.h"
46 #include "wtf/text/WTFString.h" 47 #include "wtf/text/WTFString.h"
47 48
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 String resource = shouldUseDocumentURL ? firstWindow->document()->url() : to WebCoreString(resourceName); 96 String resource = shouldUseDocumentURL ? firstWindow->document()->url() : to WebCoreString(resourceName);
96 firstWindow->document()->reportException(errorMessage, message->GetLineNumbe r(), resource, callStack); 97 firstWindow->document()->reportException(errorMessage, message->GetLineNumbe r(), resource, callStack);
97 } 98 }
98 99
99 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)
100 { 101 {
101 Frame* target = findFrame(host, data, v8::Isolate::GetCurrent()); 102 Frame* target = findFrame(host, data, v8::Isolate::GetCurrent());
102 if (!target) 103 if (!target)
103 return; 104 return;
104 DOMWindow* targetWindow = target->document()->domWindow(); 105 DOMWindow* targetWindow = target->document()->domWindow();
105 targetWindow->printErrorMessage(targetWindow->crossDomainAccessErrorMessage( activeDOMWindow())); 106 targetWindow->printErrorMessage(targetWindow->crossDomainAccessErrorMessage( activeDOMWindow()));
abarth-chromium 2013/07/17 17:51:31 I'm sorry I didn't mention this before, but my und
107
108 // Throw an exception for failed-access checks against Location objects, oth erwise write to the console.
109 WrapperTypeInfo* typeInfo = WrapperTypeInfo::unwrap(data);
110 if (V8Location::info.equals(typeInfo))
111 setDOMException(SecurityError, v8::Isolate::GetCurrent());
106 } 112 }
107 113
108 static bool codeGenerationCheckCallbackInMainThread(v8::Local<v8::Context> conte xt) 114 static bool codeGenerationCheckCallbackInMainThread(v8::Local<v8::Context> conte xt)
109 { 115 {
110 if (ScriptExecutionContext* scriptExecutionContext = toScriptExecutionContex t(context)) { 116 if (ScriptExecutionContext* scriptExecutionContext = toScriptExecutionContex t(context)) {
111 if (ContentSecurityPolicy* policy = toDocument(scriptExecutionContext)-> contentSecurityPolicy()) 117 if (ContentSecurityPolicy* policy = toDocument(scriptExecutionContext)-> contentSecurityPolicy())
112 return policy->allowEval(ScriptState::forContext(context)); 118 return policy->allowEval(ScriptState::forContext(context));
113 } 119 }
114 return false; 120 return false;
115 } 121 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 185
180 v8::ResourceConstraints resourceConstraints; 186 v8::ResourceConstraints resourceConstraints;
181 uint32_t here; 187 uint32_t here;
182 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin t32_t*)); 188 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin t32_t*));
183 v8::SetResourceConstraints(&resourceConstraints); 189 v8::SetResourceConstraints(&resourceConstraints);
184 190
185 V8PerIsolateData::ensureInitialized(isolate); 191 V8PerIsolateData::ensureInitialized(isolate);
186 } 192 }
187 193
188 } // namespace WebCore 194 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/security/xssAuditor/xss-protection-parsing-04-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698