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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/BindingSecurity.h

Issue 1417023006: bindings: Refactors BindingSecurity::shouldAllowAccessToXXX. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Synced. Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/core/v8/BindingSecurity.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/BindingSecurity.h b/third_party/WebKit/Source/bindings/core/v8/BindingSecurity.h
index f8fbe354caff51b25d157eae0ebc90d5296f1076..68b14f87be782d1b9f6040f14f30c6242bcebd47 100644
--- a/third_party/WebKit/Source/bindings/core/v8/BindingSecurity.h
+++ b/third_party/WebKit/Source/bindings/core/v8/BindingSecurity.h
@@ -31,16 +31,18 @@
#ifndef BindingSecurity_h
#define BindingSecurity_h
-// FIXME: The LocalFrame include should not be necessary, clients should be including it where they use it.
#include "core/CoreExport.h"
-#include "core/frame/LocalFrame.h"
#include "wtf/Allocator.h"
#include <v8.h>
namespace blink {
-class LocalDOMWindow;
+class DOMWindow;
+class EventTarget;
class ExceptionState;
+class Frame;
+class LocalDOMWindow;
+class Location;
class Node;
enum SecurityReportingOption {
@@ -51,15 +53,26 @@ enum SecurityReportingOption {
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.
STATIC_ONLY(BindingSecurity);
public:
+ // 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.
+ // DOMWindow
+ CORE_EXPORT static bool shouldAllowAccessTo(v8::Isolate*, const LocalDOMWindow* 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
+ CORE_EXPORT static bool shouldAllowAccessTo(v8::Isolate*, const LocalDOMWindow* accessingWindow, const DOMWindow* target, SecurityReportingOption);
+ // EventTarget (as the parent of DOMWindow)
+ CORE_EXPORT static bool shouldAllowAccessTo(v8::Isolate*, const LocalDOMWindow* accessingWindow, const EventTarget* target, ExceptionState&); // NOLINT(readability/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
+ // Location
+ CORE_EXPORT static bool shouldAllowAccessTo(v8::Isolate*, const LocalDOMWindow* accessingWindow, const Location* target, ExceptionState&);
+ CORE_EXPORT static bool shouldAllowAccessTo(v8::Isolate*, const LocalDOMWindow* accessingWindow, const Location* target, SecurityReportingOption);
+
// 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.
- static bool shouldAllowAccessToNode(v8::Isolate*, LocalDOMWindow* accessingWindow, Node*, SecurityReportingOption);
- static bool shouldAllowAccessToNode(v8::Isolate*, LocalDOMWindow* accessingWindow, Node*, ExceptionState&);
+ // Node
+ CORE_EXPORT static bool shouldAllowAccessTo(v8::Isolate*, const LocalDOMWindow* accessingWindow, const Node* target, ExceptionState&);
+ CORE_EXPORT static bool shouldAllowAccessTo(v8::Isolate*, const LocalDOMWindow* accessingWindow, const Node* target, SecurityReportingOption);
- // Check the access to the receiver.
- CORE_EXPORT static bool shouldAllowAccessToFrame(v8::Isolate*, LocalDOMWindow* accessingWindow, Frame*, SecurityReportingOption = ReportSecurityError);
- CORE_EXPORT static bool shouldAllowAccessToFrame(v8::Isolate*, LocalDOMWindow* accessingWindow, Frame*, ExceptionState&);
+ // 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.
+ // 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.
+ CORE_EXPORT static bool shouldAllowAccessToFrame(v8::Isolate*, const LocalDOMWindow* 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.
};
-}
+} // namespace blink
#endif

Powered by Google App Engine
This is Rietveld 408576698