浏览代码

LibWeb: Stub out Document.cookie

We don't get/set anything, but at least scripts that access document
cookies can now progress further. :^)
Andreas Kling 4 年之前
父节点
当前提交
36ea9fbd9e

+ 11 - 0
Userland/Libraries/LibWeb/DOM/Document.cpp

@@ -696,4 +696,15 @@ void Document::completely_finish_loading()
     dispatch_event(DOM::Event::create(HTML::EventNames::load));
 }
 
+String Document::cookie() const
+{
+    // FIXME: Support cookies!
+    return {};
+}
+
+void Document::set_cookie(String)
+{
+    // FIXME: Support cookies!
+}
+
 }

+ 3 - 0
Userland/Libraries/LibWeb/DOM/Document.h

@@ -73,6 +73,9 @@ public:
 
     virtual ~Document() override;
 
+    String cookie() const;
+    void set_cookie(String);
+
     bool should_invalidate_styles_on_attribute_changes() const { return m_should_invalidate_styles_on_attribute_changes; }
     void set_should_invalidate_styles_on_attribute_changes(bool b) { m_should_invalidate_styles_on_attribute_changes = b; }
 

+ 2 - 0
Userland/Libraries/LibWeb/DOM/Document.idl

@@ -11,6 +11,8 @@ interface Document : Node {
 
     readonly attribute Window? defaultView;
 
+    attribute DOMString cookie;
+
     Element? getElementById(DOMString id);
     ArrayFromVector getElementsByName(DOMString name);
     ArrayFromVector getElementsByTagName(DOMString tagName);