| 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 25 matching lines...) Expand all Loading... |
| 36 #include "core/frame/LocalDOMWindow.h" | 36 #include "core/frame/LocalDOMWindow.h" |
| 37 #include "core/frame/LocalFrame.h" | 37 #include "core/frame/LocalFrame.h" |
| 38 #include "core/frame/Settings.h" | 38 #include "core/frame/Settings.h" |
| 39 #include "core/html/HTMLFrameElementBase.h" | 39 #include "core/html/HTMLFrameElementBase.h" |
| 40 #include "platform/weborigin/SecurityOrigin.h" | 40 #include "platform/weborigin/SecurityOrigin.h" |
| 41 | 41 |
| 42 namespace blink { | 42 namespace blink { |
| 43 | 43 |
| 44 static bool isOriginAccessibleFromDOMWindow(SecurityOrigin* targetOrigin, LocalD
OMWindow* callingWindow) | 44 static bool isOriginAccessibleFromDOMWindow(SecurityOrigin* targetOrigin, LocalD
OMWindow* callingWindow) |
| 45 { | 45 { |
| 46 return callingWindow && callingWindow->document()->securityOrigin()->canAcce
ss(targetOrigin); | 46 return callingWindow && callingWindow->document()->securityOrigin()->canAcce
ssCheckSuborigins(targetOrigin); |
| 47 } | 47 } |
| 48 | 48 |
| 49 static bool canAccessFrame(v8::Isolate* isolate, SecurityOrigin* targetFrameOrig
in, DOMWindow* targetWindow, ExceptionState& exceptionState) | 49 static bool canAccessFrame(v8::Isolate* isolate, SecurityOrigin* targetFrameOrig
in, DOMWindow* targetWindow, ExceptionState& exceptionState) |
| 50 { | 50 { |
| 51 LocalDOMWindow* callingWindow = callingDOMWindow(isolate); | 51 LocalDOMWindow* callingWindow = callingDOMWindow(isolate); |
| 52 if (isOriginAccessibleFromDOMWindow(targetFrameOrigin, callingWindow)) | 52 if (isOriginAccessibleFromDOMWindow(targetFrameOrigin, callingWindow)) |
| 53 return true; | 53 return true; |
| 54 | 54 |
| 55 if (targetWindow) | 55 if (targetWindow) |
| 56 exceptionState.throwSecurityError(targetWindow->sanitizedCrossDomainAcce
ssErrorMessage(callingWindow), targetWindow->crossDomainAccessErrorMessage(calli
ngWindow)); | 56 exceptionState.throwSecurityError(targetWindow->sanitizedCrossDomainAcce
ssErrorMessage(callingWindow), targetWindow->crossDomainAccessErrorMessage(calli
ngWindow)); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 81 return false; | 81 return false; |
| 82 return canAccessFrame(isolate, target->securityContext()->securityOrigin(),
target->domWindow(), exceptionState); | 82 return canAccessFrame(isolate, target->securityContext()->securityOrigin(),
target->domWindow(), exceptionState); |
| 83 } | 83 } |
| 84 | 84 |
| 85 bool BindingSecurity::shouldAllowAccessToNode(v8::Isolate* isolate, Node* target
, ExceptionState& exceptionState) | 85 bool BindingSecurity::shouldAllowAccessToNode(v8::Isolate* isolate, Node* target
, ExceptionState& exceptionState) |
| 86 { | 86 { |
| 87 return target && canAccessFrame(isolate, target->document().securityOrigin()
, target->document().domWindow(), exceptionState); | 87 return target && canAccessFrame(isolate, target->document().securityOrigin()
, target->document().domWindow(), exceptionState); |
| 88 } | 88 } |
| 89 | 89 |
| 90 } | 90 } |
| OLD | NEW |