Changeset 92027 in webkit
- Timestamp:
- Jul 29, 2011, 4:00:58 PM (15 years ago)
- Location:
- branches/chromium/835
- Files:
-
- 2 edited
- 4 copied
-
LayoutTests/http/tests/security/inactive-document-with-empty-security-origin-expected.txt (copied) (copied from trunk/LayoutTests/http/tests/security/inactive-document-with-empty-security-origin-expected.txt )
-
LayoutTests/http/tests/security/inactive-document-with-empty-security-origin.html (copied) (copied from trunk/LayoutTests/http/tests/security/inactive-document-with-empty-security-origin.html )
-
LayoutTests/http/tests/security/resources/post-done-to-opener.html (copied) (copied from trunk/LayoutTests/http/tests/security/resources/post-done-to-opener.html )
-
LayoutTests/platform/chromium/http/tests/security/inactive-document-with-empty-security-origin-expected.txt (copied) (copied from trunk/LayoutTests/platform/chromium/http/tests/security/inactive-document-with-empty-security-origin-expected.txt )
-
Source/WebCore/bindings/generic/BindingSecurityBase.cpp (modified) (3 diffs)
-
Source/WebCore/page/SecurityOrigin.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/chromium/835/Source/WebCore/bindings/generic/BindingSecurityBase.cpp
r85030 r92027 49 49 } 50 50 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) 51 bool BindingSecurityBase::canAccess(DOMWindow* activeWindow, DOMWindow* targetWindow) 79 52 { 80 53 ASSERT(targetWindow); 81 82 String message;83 84 54 if (activeWindow == targetWindow) 85 55 return true; … … 88 58 return false; 89 59 90 constSecurityOrigin* activeSecurityOrigin = activeWindow->securityOrigin();91 constSecurityOrigin* targetSecurityOrigin = targetWindow->securityOrigin();60 SecurityOrigin* activeSecurityOrigin = activeWindow->securityOrigin(); 61 SecurityOrigin* targetSecurityOrigin = targetWindow->securityOrigin(); 92 62 93 63 // We have seen crashes were the security origin of the target has not been … … 99 69 return true; 100 70 101 // Allow access to a "about:blank" page if the dynamic context is a102 // detached context of the same frame as the blank page.103 if (targetSecurityOrigin->isEmpty() && activeWindow->frame() == targetWindow->frame())104 return true;105 106 71 return false; 107 72 } 108 73 109 } // namespace WebCore74 } -
branches/chromium/835/Source/WebCore/page/SecurityOrigin.cpp
r87469 r92027 148 148 bool SecurityOrigin::isEmpty() const 149 149 { 150 ASSERT(!m_protocol.isEmpty() || m_isUnique); 150 151 return m_protocol.isEmpty(); 151 152 } … … 174 175 } 175 176 177 // FIXME: This should move to SchemeRegistry! 176 178 static HashSet<String>& schemesForbiddenFromDomainRelaxation() 177 179 { … … 374 376 375 377 bool SecurityOrigin::isSecureTransitionTo(const KURL& url) const 376 { 377 // New window created by the application378 { 379 // This origin represents a new window created by the application. 378 380 if (isEmpty()) 379 381 return true; … … 385 387 String SecurityOrigin::toString() const 386 388 { 387 if (isEmpty())388 return "null";389 390 389 if (isUnique()) 391 390 return "null";
Note:
See TracChangeset
for help on using the changeset viewer.