Chromium Code Reviews| 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 13 matching lines...) Expand all Loading... | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef BindingSecurity_h | 31 #ifndef BindingSecurity_h |
| 32 #define BindingSecurity_h | 32 #define BindingSecurity_h |
| 33 | 33 |
| 34 // FIXME: The LocalFrame include should not be necessary, clients should be incl uding it where they use it. | |
| 35 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
| 36 #include "core/frame/LocalFrame.h" | |
| 37 #include "wtf/Allocator.h" | 35 #include "wtf/Allocator.h" |
| 38 #include <v8.h> | 36 #include <v8.h> |
| 39 | 37 |
| 40 namespace blink { | 38 namespace blink { |
| 41 | 39 |
| 40 class DOMWindow; | |
| 41 class EventTarget; | |
| 42 class ExceptionState; | |
| 43 class Frame; | |
| 42 class LocalDOMWindow; | 44 class LocalDOMWindow; |
| 43 class ExceptionState; | 45 class Location; |
| 44 class Node; | 46 class Node; |
| 45 | 47 |
| 46 enum SecurityReportingOption { | 48 enum SecurityReportingOption { |
| 47 DoNotReportSecurityError, | 49 DoNotReportSecurityError, |
| 48 ReportSecurityError, | 50 ReportSecurityError, |
| 49 }; | 51 }; |
| 50 | 52 |
| 51 class BindingSecurity { | 53 class BindingSecurity { |
|
haraken
2015/11/16 11:34:20
Add CORE_EXPORT to the class (and remove CORE_EXPO
Yuki
2015/11/20 12:27:52
Done.
| |
| 52 STATIC_ONLY(BindingSecurity); | 54 STATIC_ONLY(BindingSecurity); |
| 53 public: | 55 public: |
| 56 // Check the access to the receiver. | |
|
haraken
2015/11/16 11:34:20
// Check if the receiver is allowed to access the
dcheng
2015/11/17 01:56:59
Can we clarify the comments to define what "receiv
Yuki
2015/11/20 12:27:52
I rewrote the comment in a little bit different wa
Yuki
2015/11/20 12:27:52
Done.
| |
| 57 // DOMWindow | |
| 58 CORE_EXPORT static bool shouldAllowAccessTo(v8::Isolate*, const LocalDOMWind ow* accessingWindow, const DOMWindow* target, ExceptionState&); | |
|
jochen (gone - plz use gerrit)
2015/11/16 14:16:58
should we encode what the method does in the name
Yuki
2015/11/20 12:27:52
I agree that we'd better to encode what the method
| |
| 59 CORE_EXPORT static bool shouldAllowAccessTo(v8::Isolate*, const LocalDOMWind ow* accessingWindow, const DOMWindow* target, SecurityReportingOption); | |
| 60 // EventTarget (as the parent of DOMWindow) | |
| 61 CORE_EXPORT static bool shouldAllowAccessTo(v8::Isolate*, const LocalDOMWind ow* accessingWindow, const EventTarget* target, ExceptionState&); // NOLINT(rea dability/parameter_name) | |
|
haraken
2015/11/16 11:34:20
I'm just curious but how much is the EventTarget*
Yuki
2015/11/20 12:27:52
The generated V8EventTarget.cpp needs the EventTar
| |
| 62 // Location | |
| 63 CORE_EXPORT static bool shouldAllowAccessTo(v8::Isolate*, const LocalDOMWind ow* accessingWindow, const Location* target, ExceptionState&); | |
| 64 CORE_EXPORT static bool shouldAllowAccessTo(v8::Isolate*, const LocalDOMWind ow* accessingWindow, const Location* target, SecurityReportingOption); | |
| 65 | |
| 54 // Check the access to the return value. | 66 // Check the access to the return value. |
|
dcheng
2015/11/17 01:56:59
and "access to the return value". I'm not super fa
Yuki
2015/11/20 12:27:52
Done.
| |
| 55 static bool shouldAllowAccessToNode(v8::Isolate*, LocalDOMWindow* accessingW indow, Node*, SecurityReportingOption); | 67 // Node |
| 56 static bool shouldAllowAccessToNode(v8::Isolate*, LocalDOMWindow* accessingW indow, Node*, ExceptionState&); | 68 CORE_EXPORT static bool shouldAllowAccessTo(v8::Isolate*, const LocalDOMWind ow* accessingWindow, const Node* target, ExceptionState&); |
| 69 CORE_EXPORT static bool shouldAllowAccessTo(v8::Isolate*, const LocalDOMWind ow* accessingWindow, const Node* target, SecurityReportingOption); | |
| 57 | 70 |
| 58 // Check the access to the receiver. | 71 // Check the access to the frame rather than to a DOM object. |
|
haraken
2015/11/16 11:34:20
DOM object => DOMWindow/EventTarget/Location
Yuki
2015/11/20 12:27:52
Done.
| |
| 59 CORE_EXPORT static bool shouldAllowAccessToFrame(v8::Isolate*, LocalDOMWindo w* accessingWindow, Frame*, SecurityReportingOption = ReportSecurityError); | 72 // You should check the access to the DOM object as long as it's possible. |
|
dcheng
2015/11/17 01:56:59
Nit: reword this as "Prefer to use the previous ov
Yuki
2015/11/20 12:27:52
Done.
| |
| 60 CORE_EXPORT static bool shouldAllowAccessToFrame(v8::Isolate*, LocalDOMWindo w* accessingWindow, Frame*, ExceptionState&); | 73 CORE_EXPORT static bool shouldAllowAccessToFrame(v8::Isolate*, const LocalDO MWindow* accessingWindow, const Frame*, SecurityReportingOption); |
|
haraken
2015/11/16 11:34:20
const Frame* target
dcheng
2015/11/17 01:56:59
This is a 'receiver' method, right? Should it be g
Yuki
2015/11/20 12:27:52
Done.
Yuki
2015/11/20 12:27:52
Done.
| |
| 61 }; | 74 }; |
| 62 | 75 |
| 63 } | 76 } // namespace blink |
| 64 | 77 |
| 65 #endif | 78 #endif |
| OLD | NEW |