Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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())); |
| 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()); | |
|
abarth-chromium
2013/07/12 22:57:08
Why only location? Why not have every security vi
| |
| 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 Loading... | |
| 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 |
| OLD | NEW |