[Webkit-unassigned] [Bug 240219] foo(optional unsigned long long offset = 0) IDL functions don't work when called like foo(undefined) or foo()

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu May 12 18:11:08 PDT 2022


https://bugs.webkit.org/show_bug.cgi?id=240219

--- Comment #2 from Chris Dumez <cdumez at apple.com> ---
I have just double-checked here and things seem to work as expected. I validated with the following patch:
```
diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp
index 0636bd5b4363..370a789c0a9e 100644
--- a/Source/WebCore/dom/Document.cpp
+++ b/Source/WebCore/dom/Document.cpp
@@ -9202,6 +9202,11 @@ bool Document::isSameSiteForCookies(const URL& url) const
     return domain.matches(url);
 }

+void Document::testOptionalUnsignedLongLong(uint64_t param)
+{
+    WTFLogAlways("CHRIS: Document::testOptionalUnsignedLongLong(%llu)", param);
+}
+
 } // namespace WebCore

 #undef DOCUMENT_RELEASE_LOG
diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h
index 866abc6d7986..fcc1319cadb0 100644
--- a/Source/WebCore/dom/Document.h
+++ b/Source/WebCore/dom/Document.h
@@ -699,6 +699,8 @@ public:

     void cancelParsing();

+    void testOptionalUnsignedLongLong(uint64_t);
+
     ExceptionOr<void> write(Document* entryDocument, SegmentedString&&);
     WEBCORE_EXPORT ExceptionOr<void> write(Document* entryDocument, FixedVector<String>&&);
     WEBCORE_EXPORT ExceptionOr<void> writeln(Document* entryDocument, FixedVector<String>&&);
diff --git a/Source/WebCore/dom/Document.idl b/Source/WebCore/dom/Document.idl
index b5cc4978066a..db9726d66df7 100644
--- a/Source/WebCore/dom/Document.idl
+++ b/Source/WebCore/dom/Document.idl
@@ -94,6 +94,8 @@ typedef (HTMLScriptElement or SVGScriptElement) HTMLOrSVGScriptElement;

     // Non standard: It has been dropped from Blink already.
     RenderingContext? getCSSCanvasContext(DOMString contextId, DOMString name, long width, long height);
+
+    undefined testOptionalUnsignedLongLong(optional unsigned long long parameter = 0);
 };

 enum DocumentReadyState { "loading", "interactive", "complete" };
```

document.testOptionalUnsignedLongLong() -> implementation called with 0
document.testOptionalUnsignedLongLong(0) -> implementation called with 0
document.testOptionalUnsignedLongLong(1) -> implementation called with 1
document.testOptionalUnsignedLongLong(undefined) -> implementation called with 0

Works as expected IMO.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220513/ec27d5ed/attachment-0001.htm>


More information about the webkit-unassigned mailing list