Skip to content

Commit

Permalink
* 修复一处崩溃。在主frame调用window.frameElement;就会崩溃
Browse files Browse the repository at this point in the history
  • Loading branch information
weolar committed May 19, 2018
1 parent 040e613 commit 9f7a531
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions third_party/WebKit/Source/bindings/core/v8/BindingSecurity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ static bool isOriginAccessibleFromDOMWindow(SecurityOrigin* targetOrigin, LocalD

static bool canAccessFrame(v8::Isolate* isolate, SecurityOrigin* targetFrameOrigin, DOMWindow* targetWindow, ExceptionState& exceptionState)
{
if (!RuntimeEnabledFeatures::cspCheckEnabled())
return true;

LocalDOMWindow* callingWindow = callingDOMWindow(isolate);
if (isOriginAccessibleFromDOMWindow(targetFrameOrigin, callingWindow))
return true;
Expand All @@ -62,9 +59,6 @@ static bool canAccessFrame(v8::Isolate* isolate, SecurityOrigin* targetFrameOrig

static bool canAccessFrame(v8::Isolate* isolate, SecurityOrigin* targetFrameOrigin, DOMWindow* targetWindow, SecurityReportingOption reportingOption = ReportSecurityError)
{
if (!RuntimeEnabledFeatures::cspCheckEnabled())
return true;

LocalDOMWindow* callingWindow = callingDOMWindow(isolate);
if (isOriginAccessibleFromDOMWindow(targetFrameOrigin, callingWindow))
return true;
Expand All @@ -76,29 +70,24 @@ static bool canAccessFrame(v8::Isolate* isolate, SecurityOrigin* targetFrameOrig

bool BindingSecurity::shouldAllowAccessToFrame(v8::Isolate* isolate, Frame* target, SecurityReportingOption reportingOption)
{
if (!RuntimeEnabledFeatures::cspCheckEnabled())
return true;

if (!target || !target->securityContext())
return false;
if (!RuntimeEnabledFeatures::cspCheckEnabled())
return true;
return canAccessFrame(isolate, target->securityContext()->securityOrigin(), target->domWindow(), reportingOption);
}

bool BindingSecurity::shouldAllowAccessToFrame(v8::Isolate* isolate, Frame* target, ExceptionState& exceptionState)
{
if (!RuntimeEnabledFeatures::cspCheckEnabled())
return true;

if (!target || !target->securityContext())
return false;
if (!RuntimeEnabledFeatures::cspCheckEnabled())
return true;
return canAccessFrame(isolate, target->securityContext()->securityOrigin(), target->domWindow(), exceptionState);
}

bool BindingSecurity::shouldAllowAccessToNode(v8::Isolate* isolate, Node* target, ExceptionState& exceptionState)
{
if (!RuntimeEnabledFeatures::cspCheckEnabled())
return true;

return target && canAccessFrame(isolate, target->document().securityOrigin(), target->document().domWindow(), exceptionState);
}

Expand Down

0 comments on commit 9f7a531

Please sign in to comment.