WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
232557
WebIDL: const in namespace is not supported
https://bugs.webkit.org/show_bug.cgi?id=232557
Summary
WebIDL: const in namespace is not supported
Myles C. Maxfield
Reported
2021-11-01 00:53:50 PDT
namespace GPUMapMode { const GPUFlagsConstant READ = 0x0001; const GPUFlagsConstant WRITE = 0x0002; };
Attachments
Patch
(26.06 KB, patch)
2022-03-02 15:43 PST
,
Dan Glastonbury
no flags
Details
Formatted Diff
Diff
Patch
(26.30 KB, patch)
2022-03-02 19:03 PST
,
Dan Glastonbury
no flags
Details
Formatted Diff
Diff
Patch
(26.30 KB, patch)
2022-03-03 17:35 PST
,
Dan Glastonbury
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2021-11-07 23:54:19 PST
<
rdar://problem/85142162
>
Dan Glastonbury
Comment 2
2022-03-02 15:43:18 PST
Created
attachment 453669
[details]
Patch
Sam Weinig
Comment 3
2022-03-02 17:11:16 PST
Comment on
attachment 453669
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=453669&action=review
> Source/WebCore/ChangeLog:11 > + * bindings/scripts/CodeGeneratorJS.pm:
Please fill in the ChangeLog with details about the change.
> Source/WebCore/ChangeLog:23 > + * bindings/scripts/test/JS/JSTestNamespaceConst.cpp: Added.
We often replace all the bindings/scripts/tests/JS/ lines with a single: * bindings/scripts/test/JS/*: Updated
> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:7883 > + if ($interface->isNamespaceObject && scalar(@runtimeEnabledProperties) == 0) { > + push(@$outputArray, " UNUSED_PARAM(globalObject);\n"); > + }
Is this related?
> Source/WebCore/bindings/scripts/IDLAttributes.json:464 > - "contextsAllowed": ["interface", "dictionary", "enum", "attribute", "operation", "constant"], > + "contextsAllowed": ["interface", "namespace", "dictionary", "enum", "attribute", "operation", "constant"],
This seems unrelated.
Sam Weinig
Comment 4
2022-03-02 17:24:59 PST
Comment on
attachment 453669
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=453669&action=review
> Source/WebCore/bindings/scripts/IDLParser.pm:1111 > + if ($next->value() eq "const") {
Would be good to update $nextNamespaceMembers_1 as well to include "|const" if it doesn't already have it. (Though I am unclear if it is ever used in a context where that would matter, I try to keep those correct in case they do).
Dan Glastonbury
Comment 5
2022-03-02 17:31:48 PST
(In reply to Sam Weinig from
comment #3
)
> > Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:7883 > > + if ($interface->isNamespaceObject && scalar(@runtimeEnabledProperties) == 0) { > > + push(@$outputArray, " UNUSED_PARAM(globalObject);\n"); > > + } > > Is this related?
Yes. This is fix a compilation error when a namespace contains just constants. For example, this: namespace GPUMapMode { const GPUFlagsConstant READ = 0x0001; const GPUFlagsConstant WRITE = 0x0002; }; Generates the following code which has a compile error because globalObject is unused. template<> void JSGPUMapModeDOMConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) { JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); reifyStaticProperties(vm, JSGPUMapMode::info(), JSGPUMapModeConstructorTableValues, *this); } If there are no attributes or operations in the namespace, globalObject is unused, so I added the UNUNSED_PARAM to quiet the error.
> > Source/WebCore/bindings/scripts/IDLAttributes.json:464 > > - "contextsAllowed": ["interface", "dictionary", "enum", "attribute", "operation", "constant"], > > + "contextsAllowed": ["interface", "namespace", "dictionary", "enum", "attribute", "operation", "constant"], > > This seems unrelated.
This allows [SecureContext] to be applied to namespace, which is allowed by the spec. Yes, it's not related to constants in namespace, so I'll open another bug for this change.
Dan Glastonbury
Comment 6
2022-03-02 19:03:42 PST
Created
attachment 453690
[details]
Patch
Dan Glastonbury
Comment 7
2022-03-03 17:35:36 PST
Created
attachment 453804
[details]
Patch
EWS
Comment 8
2022-03-04 14:09:32 PST
Committed
r290845
(
248078@main
): <
https://commits.webkit.org/248078@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 453804
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug