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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 bool BindingSecurity::shouldAllowAccessTo(v8::Isolate* isolate, const LocalDOMWi
ndow* accessingWindow, const Location* target, SecurityReportingOption reporting
Option) | 125 bool BindingSecurity::shouldAllowAccessTo(v8::Isolate* isolate, const LocalDOMWi
ndow* accessingWindow, const Location* target, SecurityReportingOption reporting
Option) |
126 { | 126 { |
127 ASSERT(target); | 127 ASSERT(target); |
128 const Frame* frame = target->frame(); | 128 const Frame* frame = target->frame(); |
129 if (!frame || !frame->securityContext()) | 129 if (!frame || !frame->securityContext()) |
130 return false; | 130 return false; |
131 return canAccessFrame(isolate, accessingWindow, frame->securityContext()->ge
tSecurityOrigin(), frame->domWindow(), reportingOption); | 131 return canAccessFrame(isolate, accessingWindow, frame->securityContext()->ge
tSecurityOrigin(), frame->domWindow(), reportingOption); |
132 } | 132 } |
133 | 133 |
134 bool BindingSecurity::shouldAllowAccessTo(v8::Isolate* isolate, const LocalDOMWi
ndow* accessingWindow, const MainThreadWorkletGlobalScope* target, SecurityRepor
tingOption reportingOption) | 134 bool BindingSecurity::shouldAllowAccessTo(v8::Isolate* isolate, const v8::Local<
v8::Context>& context, const ExecutionContext* executionContext, const MainThrea
dWorkletGlobalScope* workletGlobalScope, SecurityReportingOption reportingOption
) |
135 { | 135 { |
136 ASSERT(target); | 136 DCHECK(executionContext); |
137 const Frame* frame = target->frame(); | 137 DOMWindow* domWindow = toDOMWindow(context); |
138 if (!frame || !frame->securityContext()) | 138 if (executionContext->isMainThreadWorkletGlobalScope()) { |
| 139 Frame* callingFrame = toMainThreadWorkletGlobalScope(executionContext)->
frame(); |
| 140 domWindow = callingFrame ? callingFrame->domWindow() : nullptr; |
| 141 } |
| 142 |
| 143 DCHECK(workletGlobalScope); |
| 144 const Frame* workletGlobalScopeFrame = workletGlobalScope->frame(); |
| 145 if (!workletGlobalScopeFrame || !workletGlobalScopeFrame->securityContext()) |
139 return false; | 146 return false; |
140 return canAccessFrame(isolate, accessingWindow, frame->securityContext()->ge
tSecurityOrigin(), frame->domWindow(), reportingOption); | 147 |
| 148 return domWindow && canAccessFrame(isolate, toLocalDOMWindow(domWindow), wor
kletGlobalScopeFrame->securityContext()->getSecurityOrigin(), workletGlobalScope
Frame->domWindow(), reportingOption); |
141 } | 149 } |
142 | 150 |
143 bool BindingSecurity::shouldAllowAccessTo(v8::Isolate* isolate, const LocalDOMWi
ndow* accessingWindow, const Node* target, ExceptionState& exceptionState) | 151 bool BindingSecurity::shouldAllowAccessTo(v8::Isolate* isolate, const LocalDOMWi
ndow* accessingWindow, const Node* target, ExceptionState& exceptionState) |
144 { | 152 { |
145 if (!target) | 153 if (!target) |
146 return false; | 154 return false; |
147 return canAccessFrame(isolate, accessingWindow, target->document().getSecuri
tyOrigin(), target->document().domWindow(), exceptionState); | 155 return canAccessFrame(isolate, accessingWindow, target->document().getSecuri
tyOrigin(), target->document().domWindow(), exceptionState); |
148 } | 156 } |
149 | 157 |
150 bool BindingSecurity::shouldAllowAccessTo(v8::Isolate* isolate, const LocalDOMWi
ndow* accessingWindow, const Node* target, SecurityReportingOption reportingOpti
on) | 158 bool BindingSecurity::shouldAllowAccessTo(v8::Isolate* isolate, const LocalDOMWi
ndow* accessingWindow, const Node* target, SecurityReportingOption reportingOpti
on) |
151 { | 159 { |
152 if (!target) | 160 if (!target) |
153 return false; | 161 return false; |
154 return canAccessFrame(isolate, accessingWindow, target->document().getSecuri
tyOrigin(), target->document().domWindow(), reportingOption); | 162 return canAccessFrame(isolate, accessingWindow, target->document().getSecuri
tyOrigin(), target->document().domWindow(), reportingOption); |
155 } | 163 } |
156 | 164 |
157 bool BindingSecurity::shouldAllowAccessToFrame(v8::Isolate* isolate, const Local
DOMWindow* accessingWindow, const Frame* target, SecurityReportingOption reporti
ngOption) | 165 bool BindingSecurity::shouldAllowAccessToFrame(v8::Isolate* isolate, const Local
DOMWindow* accessingWindow, const Frame* target, SecurityReportingOption reporti
ngOption) |
158 { | 166 { |
159 if (!target || !target->securityContext()) | 167 if (!target || !target->securityContext()) |
160 return false; | 168 return false; |
161 return canAccessFrame(isolate, accessingWindow, target->securityContext()->g
etSecurityOrigin(), target->domWindow(), reportingOption); | 169 return canAccessFrame(isolate, accessingWindow, target->securityContext()->g
etSecurityOrigin(), target->domWindow(), reportingOption); |
162 } | 170 } |
163 | 171 |
164 } // namespace blink | 172 } // namespace blink |
OLD | NEW |