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

Unified Diff: Source/WebCore/bindings/v8/ScriptWrappable.h

Issue 13814002: First part of work to move V8 binding integrity off of vtables. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/Modules/websockets/CloseEvent.h ('k') | Source/WebCore/css/CSSFontFaceLoadEvent.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/bindings/v8/ScriptWrappable.h
diff --git a/Source/WebCore/bindings/v8/ScriptWrappable.h b/Source/WebCore/bindings/v8/ScriptWrappable.h
index d476b9463cb772538ab553dc7bee36c210864475..05c971ac37985df8e17ca0fd5b2998fff24f1cff 100644
--- a/Source/WebCore/bindings/v8/ScriptWrappable.h
+++ b/Source/WebCore/bindings/v8/ScriptWrappable.h
@@ -41,7 +41,13 @@ namespace WebCore {
class ScriptWrappable {
friend class WeakHandleListener<ScriptWrappable>;
public:
- ScriptWrappable() { }
+ ScriptWrappable()
+ {
+ }
+
+ template <class C> static void init(C *object)
+ {
+ }
v8::Handle<v8::Object> wrapper() const
{
@@ -63,6 +69,11 @@ public:
info.ignoreMember(m_maskedWrapper);
}
+protected:
+ ~ScriptWrappable()
+ {
+ }
+
private:
inline void disposeWrapper(v8::Persistent<v8::Value> value, v8::Isolate* isolate)
{
@@ -72,16 +83,16 @@ private:
m_maskedWrapper.Clear();
}
- // Stores a masked wrapper to prevent attackers from overwriting this field
- // with a phony wrapper.
- v8::Persistent<v8::Object> m_maskedWrapper;
-
static inline v8::Object* maskOrUnmaskPointer(const v8::Object* object)
{
const uintptr_t objectPointer = reinterpret_cast<uintptr_t>(object);
const uintptr_t randomMask = ~(reinterpret_cast<uintptr_t>(&WebCoreMemoryTypes::DOM) >> 13); // Entropy via ASLR.
return reinterpret_cast<v8::Object*>((objectPointer ^ randomMask) & (!objectPointer - 1)); // Preserve null without branching.
}
+
+ // Stores a masked wrapper to prevent attackers from overwriting this field
+ // with a phony wrapper.
+ v8::Persistent<v8::Object> m_maskedWrapper;
};
template<>
« no previous file with comments | « Source/WebCore/Modules/websockets/CloseEvent.h ('k') | Source/WebCore/css/CSSFontFaceLoadEvent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698