Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: Source/bindings/core/v8/BindingSecurity.cpp

Issue 1180923003: Add window access checks for Suborigins (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix tests on Windows Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/security/suborigins/suborigin-valid-names-expected.txt ('k') | Source/core/dom/ExecutionContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698