⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 92027 in webkit


Ignore:
Timestamp:
Jul 29, 2011, 4:00:58 PM (15 years ago)
Author:
cevans@google.com
Message:

Merge 91957
BUG=89453
Review URL: http://codereview.chromium.org/7540005

Location:
branches/chromium/835
Files:
2 edited
4 copied

Legend:

Unmodified
Added
Removed
  • branches/chromium/835/Source/WebCore/bindings/generic/BindingSecurityBase.cpp

    r85030 r92027  
    4949}
    5050
    51 // Same origin policy implementation:
    52 //
    53 // Same origin policy prevents JS code from domain A from accessing JS & DOM
    54 // objects in a different domain B. There are exceptions and several objects
    55 // are accessible by cross-domain code. For example, the window.frames object
    56 // is accessible by code from a different domain, but window.document is not.
    57 //
    58 // The JS binding code sets security check callbacks on a function template,
    59 // and accessing instances of the template calls the callback function.
    60 // The callback function enforces the same origin policy.
    61 //
    62 // Callback functions are expensive. Binding code should use a security token
    63 // string to do fast access checks for the common case where source and target
    64 // are in the same domain. A security token is a string object that represents
    65 // the protocol/url/port of a domain.
    66 //
    67 // There are special cases where security token matching is not enough.
    68 // For example, JS can set its domain to a super domain by calling
    69 // document.setDomain(...). In these cases, the binding code can reset
    70 // a context's security token to its global object so that the fast access
    71 // check will always fail.
    72 
    73 // Helper to check if the current execution context can access a target frame.
    74 // First it checks same domain policy using the lexical context.
    75 //
    76 // This is equivalent to KJS::Window::allowsAccessFrom(ExecState*).
    77 bool BindingSecurityBase::canAccess(DOMWindow* activeWindow,
    78                                     DOMWindow* targetWindow)
     51bool BindingSecurityBase::canAccess(DOMWindow* activeWindow, DOMWindow* targetWindow)
    7952{
    8053    ASSERT(targetWindow);
    81 
    82     String message;
    83 
    8454    if (activeWindow == targetWindow)
    8555        return true;
     
    8858        return false;
    8959
    90     const SecurityOrigin* activeSecurityOrigin = activeWindow->securityOrigin();
    91     const SecurityOrigin* targetSecurityOrigin = targetWindow->securityOrigin();
     60    SecurityOrigin* activeSecurityOrigin = activeWindow->securityOrigin();
     61    SecurityOrigin* targetSecurityOrigin = targetWindow->securityOrigin();
    9262
    9363    // We have seen crashes were the security origin of the target has not been
     
    9969        return true;
    10070
    101     // Allow access to a "about:blank" page if the dynamic context is a
    102     // detached context of the same frame as the blank page.
    103     if (targetSecurityOrigin->isEmpty() && activeWindow->frame() == targetWindow->frame())
    104         return true;
    105 
    10671    return false;
    10772}
    10873
    109 } // namespace WebCore
     74}
  • branches/chromium/835/Source/WebCore/page/SecurityOrigin.cpp

    r87469 r92027  
    148148bool SecurityOrigin::isEmpty() const
    149149{
     150    ASSERT(!m_protocol.isEmpty() || m_isUnique);
    150151    return m_protocol.isEmpty();
    151152}
     
    174175}
    175176
     177// FIXME: This should move to SchemeRegistry!
    176178static HashSet<String>& schemesForbiddenFromDomainRelaxation()
    177179{
     
    374376
    375377bool SecurityOrigin::isSecureTransitionTo(const KURL& url) const
    376 { 
    377     // New window created by the application
     378{
     379    // This origin represents a new window created by the application.
    378380    if (isEmpty())
    379381        return true;
     
    385387String SecurityOrigin::toString() const
    386388{
    387     if (isEmpty())
    388         return "null";
    389 
    390389    if (isUnique())
    391390        return "null";
Note: See TracChangeset for help on using the changeset viewer.