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

Unified Diff: Source/core/frame/Frame.h

Issue 307223002: Make sure we never pass a null Frame to Document::canNavigate() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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
Index: Source/core/frame/Frame.h
diff --git a/Source/core/frame/Frame.h b/Source/core/frame/Frame.h
index 5a78fa5477528314f7001e22b8fd6b7ee17469ce..72d5afda33fa7a5a756f3d5a2bae599e43eee36a 100644
--- a/Source/core/frame/Frame.h
+++ b/Source/core/frame/Frame.h
@@ -142,6 +142,18 @@ inline FrameTree& Frame::tree() const
return m_treeNode;
}
+// Allow equality comparisons of Frames by reference or pointer, interchangeably.
eseidel 2014/06/02 05:20:27 Can we make this a macro? Seems silly to have to
Inactive 2014/06/02 12:16:37 Makes sense. We already duplicate this for several
+inline bool operator==(const Frame& a, const Frame& b) { return &a == &b; }
+inline bool operator==(const Frame& a, const Frame* b) { return &a == b; }
+inline bool operator==(const Frame* a, const Frame& b) { return a == &b; }
+inline bool operator!=(const Frame& a, const Frame& b) { return !(a == b); }
+inline bool operator!=(const Frame& a, const Frame* b) { return !(a == b); }
+inline bool operator!=(const Frame* a, const Frame& b) { return !(a == b); }
+inline bool operator==(const PassRefPtr<Frame>& a, const Frame& b) { return a.get() == &b; }
+inline bool operator==(const Frame& a, const PassRefPtr<Frame>& b) { return &a == b.get(); }
+inline bool operator!=(const PassRefPtr<Frame>& a, const Frame& b) { return !(a == b); }
+inline bool operator!=(const Frame& a, const PassRefPtr<Frame>& b) { return !(a == b); }
+
} // namespace WebCore
#endif // Frame_h

Powered by Google App Engine
This is Rietveld 408576698