Skip to content

[webkitscmpy] Generate commit message template - #13

Closed
JonWBedard wants to merge 1 commit into
WebKit:mainfrom
JonWBedard:eng/commit-message-template
Closed

JonWBedard wants to merge 1 commit into
WebKit:mainfrom
JonWBedard:eng/commit-message-template

Conversation

@JonWBedard

@JonWBedard JonWBedard commented Sep 30, 2021 •

Copy link
Copy Markdown
Member

7dfc515

[webkitscmpy] Generate commit message template
https://bugs.webkit.org/show_bug.cgi?id=231023
<rdar://problem/83722871 >

Reviewed by NOBODY (OOPS!).

* Tools/Scripts/git-webkit: Use prepare-ChangeLog to generate commit messages.
* Tools/Scripts/hooks/prepare-commit-msg: Added.
* Tools/Scripts/libraries/webkitscmpy/setup.py: Bump version, add jinja.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/local/git.py:
(Git.__init__): Add unbound status mock.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/__init__.py:
(main): Pass hooks to sub-programs.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/setup.py:
(Setup.git): iterate through the directory of provided hooks and render with jinja2.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/hooks/prepare-commit-msg: Added.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/setup_unittest.py:
(TestSetup.test_commit_message):

@huskyroll huskyroll left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure we align our internal markings for the review needing changes with GitHubs

Comment thread Tools/Scripts/git-webkit Resolved
Comment thread Tools/Scripts/git-webkit Resolved

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, although clever, what benefits are we getting from having the prepare-commit-msg script a function as opposed to a standalone file?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the time projects are defining prepare-commit-msg, they're only doing so for one repository. This means that you can take advantage of the fact that you know how your repository is setup up and that .git/hooks is in a predictable location relative to your scripts. The problem we have in git-webkit is that we want it to work regardless of the repository we're targeting, which means that we know where webkitscmpy is when we run git-webkit setup, but not when we actually run prepare-commit-msg. If we generate prepare-commit-msg like this, it lets us embed the known location of things in prepare-commit-msg based on the content of git-webkit setup. At the moment, we're only leveraging this in Tools/Scripts/git-webkit, but I suspect we will leverage it here in the near future when (hopefully) webkitscmpy owns commit message generation directly instead of relying on a perl script.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth calling out the other two approaches here, though: jinja templates or laying down a config file in hooks with information linking back to the location git-webkit setup is called from

@JonWBedard JonWBedard self-assigned this Oct 13, 2021
@JonWBedard
JonWBedard force-pushed the eng/commit-message-template branch 5 times, most recently from 83e7af2 to d6f6930 Compare October 14, 2021 17:31

@kocsenc kocsenc left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks clean. It's easier to follow than the previous version with not many drawbacks. r=me

@huskyroll huskyroll left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the conflicts and we can land it!

https://bugs.webkit.org/show_bug.cgi?id=231023
<rdar://problem/83722871>

Reviewed by NOBODY (OOPS!).

* Tools/Scripts/git-webkit: Use prepare-ChangeLog to generate commit messages.
* Tools/Scripts/hooks/prepare-commit-msg: Added.
* Tools/Scripts/libraries/webkitscmpy/setup.py: Bump version, add jinja.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/local/git.py:
(Git.__init__): Add unbound status mock.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/__init__.py:
(main): Pass hooks to sub-programs.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/setup.py:
(Setup.git): iterate through the directory of provided hooks and render with jinja2.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/hooks/prepare-commit-msg: Added.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/setup_unittest.py:
(TestSetup.test_commit_message):
@JonWBedard
JonWBedard force-pushed the eng/commit-message-template branch from d6f6930 to 7dfc515 Compare October 18, 2021 16:31
@sundiamonde
sundiamonde self-requested a review October 18, 2021 19:32

@dewei-zhu dewei-zhu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me

@JonWBedard

Copy link
Copy Markdown
Member Author

@JonWBedard JonWBedard closed this Oct 19, 2021
@JonWBedard
JonWBedard deleted the eng/commit-message-template branch October 19, 2021 22:03
webkit-early-warning-system pushed a commit to hyjorc1/WebKit that referenced this pull request Nov 19, 2022
…a rejected promise

https://bugs.webkit.org/show_bug.cgi?id=247785
rdar://102325201

Reviewed by Yusuke Suzuki.

Rest parameter should be caught in async function. So, running this
JavaScript program should print "caught".
```
async function f(...[[]]) { }
f().catch(e => print("caught"));
```

V8 (used console.log)
```
$ node input.js
caught
```

GraalJS
```
$ js input.js
caught
```

https://tc39.es/ecma262/#sec-async-function-definitions
...
AsyncFunctionDeclaration[Yield, Await, Default] :
    async [no LineTerminator here] function BindingIdentifier[?Yield, ?Await] ( FormalParameters[~Yield, +Await] ) { AsyncFunctionBody }
    [+Default] async [no LineTerminator here] function ( FormalParameters[~Yield, +Await] ) { AsyncFunctionBody }

AsyncFunctionExpression :
    async [no LineTerminator here] function BindingIdentifier[~Yield, +Await]opt ( FormalParameters[~Yield, +Await] ) { AsyncFunctionBody }
...

According to the spec, it indicates `FormalParameters` is used for Async
Function, where `FormalParameters` can be converted to `FunctionRestParameter`.

https://tc39.es/ecma262/#sec-parameter-lists
...
FormalParameters[Yield, Await] :
    [empty]
    FunctionRestParameter[?Yield, ?Await]
    FormalParameterList[?Yield, ?Await]
    FormalParameterList[?Yield, ?Await] ,
    FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await]
...

And based on RS: EvaluateAsyncFunctionBody, it will invoke the promise.reject
callback function with abrupt value ([[value]] of non-normal completion record).

https://tc39.es/ecma262/#sec-runtime-semantics-evaluateasyncfunctionbody
...
2. Let declResult be Completion(FunctionDeclarationInstantiation(functionObject, argumentsList)).
3. If declResult is an abrupt completion, then
    a. Perform ! Call(promiseCapability.[[Reject]], undefined, « declResult.[[Value]] »).
...

In that case, any non-normal results of evaluating rest parameters should be
caught and passed to the reject callback function.

To resolve this problem, we should allow the emitted RestParameterNode be wrapped
by the catch handler for promise. However, we should remove `m_restParameter` and
emit rest parameter byte code in `initializeDefaultParameterValuesAndSetupFunctionScopeStack`
if we can prove that change has no side effect. In that case, we can only use one
exception handler.

Current fix is to add another exception handler. And move the handler byte codes to
the bottom of code block in order to make other byte codes as much compact as possible.

Input:
```
async function f(arg0, ...[[]]) { }
f();
```

Dumped Byte Codes:
```
...

bb#2
Predecessors: [ WebKit#1 ]
[  20] mov                dst:loc9, src:<JSValue()>(const0)
...

bb#3
Predecessors: [ WebKit#2 ]
[  29] get_rest_length    dst:loc11, numParametersToSkip:1
...

bb#12
Predecessors: [ WebKit#8 WebKit#9 WebKit#10 ]
[ 138] new_func_exp       dst:loc10, scope:loc4, functionDecl:0
...

bb#13
Predecessors: [ ]
[ 170] catch              exception:loc10, thrownValue:loc8
[ 174] jmp                targetLabel:8(->182)
Successors: [ WebKit#15 ]

bb#14
Predecessors: [ WebKit#7 WebKit#11 ]
[ 176] catch              exception:loc10, thrownValue:loc8
[ 180] jmp                targetLabel:2(->182)
Successors: [ WebKit#15 ]

bb#15
Predecessors: [ WebKit#13 WebKit#14 ]
[ 182] mov                dst:loc12, src:Undefined(const1)
...

Exception Handlers:
	 1: { start: [  20] end: [  29] target: [ 170] } synthesized catch
	 2: { start: [  29] end: [ 138] target: [ 176] } synthesized catch
```

* JSTests/stress/catch-rest-parameter.js: Added.
(throwError):
(shouldThrow):
(async f):
(throwError.async f):
(throwError.async let):
(async let):
(x.async f):
(x):
(async shouldThrow):
* Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::initializeDefaultParameterValuesAndSetupFunctionScopeStack):
* Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h:

Canonical link: https://commits.webkit.org/256864@main
cdumez pushed a commit to cdumez/WebKit that referenced this pull request Jan 15, 2023
    Fix TypeError in parameter destructuring in async function should be a rejected promise
    https://bugs.webkit.org/show_bug.cgi?id=247785
    rdar://102325201

    Reviewed by Yusuke Suzuki.

    Rest parameter should be caught in async function. So, running this
    JavaScript program should print "caught".
    ```
    async function f(...[[]]) { }
    f().catch(e => print("caught"));
    ```

    V8 (used console.log)
    ```
    $ node input.js
    caught
    ```

    GraalJS
    ```
    $ js input.js
    caught
    ```

    https://tc39.es/ecma262/#sec-async-function-definitions
    ...
    AsyncFunctionDeclaration[Yield, Await, Default] :
        async [no LineTerminator here] function BindingIdentifier[?Yield, ?Await] ( FormalParameters[~Yield, +Await] ) { AsyncFunctionBody }
        [+Default] async [no LineTerminator here] function ( FormalParameters[~Yield, +Await] ) { AsyncFunctionBody }

    AsyncFunctionExpression :
        async [no LineTerminator here] function BindingIdentifier[~Yield, +Await]opt ( FormalParameters[~Yield, +Await] ) { AsyncFunctionBody }
    ...

    According to the spec, it indicates `FormalParameters` is used for Async
    Function, where `FormalParameters` can be converted to `FunctionRestParameter`.

    https://tc39.es/ecma262/#sec-parameter-lists
    ...
    FormalParameters[Yield, Await] :
        [empty]
        FunctionRestParameter[?Yield, ?Await]
        FormalParameterList[?Yield, ?Await]
        FormalParameterList[?Yield, ?Await] ,
        FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await]
    ...

    And based on RS: EvaluateAsyncFunctionBody, it will invoke the promise.reject
    callback function with abrupt value ([[value]] of non-normal completion record).

    https://tc39.es/ecma262/#sec-runtime-semantics-evaluateasyncfunctionbody
    ...
    2. Let declResult be Completion(FunctionDeclarationInstantiation(functionObject, argumentsList)).
    3. If declResult is an abrupt completion, then
        a. Perform ! Call(promiseCapability.[[Reject]], undefined, « declResult.[[Value]] »).
    ...

    In that case, any non-normal results of evaluating rest parameters should be
    caught and passed to the reject callback function.

    To resolve this problem, we should allow the emitted RestParameterNode be wrapped
    by the catch handler for promise. However, we should remove `m_restParameter` and
    emit rest parameter byte code in `initializeDefaultParameterValuesAndSetupFunctionScopeStack`
    if we can prove that change has no side effect. In that case, we can only use one
    exception handler.

    Current fix is to add another exception handler. And move the handler byte codes to
    the bottom of code block in order to make other byte codes as much compact as possible.

    Input:
    ```
    async function f(arg0, ...[[]]) { }
    f();
    ```

    Dumped Byte Codes:
    ```
    ...

    bb#2
    Predecessors: [ WebKit#1 ]
    [  20] mov                dst:loc9, src:<JSValue()>(const0)
    ...

    bb#3
    Predecessors: [ WebKit#2 ]
    [  29] get_rest_length    dst:loc11, numParametersToSkip:1
    ...

    bb#12
    Predecessors: [ WebKit#8 WebKit#9 WebKit#10 ]
    [ 138] new_func_exp       dst:loc10, scope:loc4, functionDecl:0
    ...

    bb#13
    Predecessors: [ ]
    [ 170] catch              exception:loc10, thrownValue:loc8
    [ 174] jmp                targetLabel:8(->182)
    Successors: [ WebKit#15 ]

    bb#14
    Predecessors: [ WebKit#7 WebKit#11 ]
    [ 176] catch              exception:loc10, thrownValue:loc8
    [ 180] jmp                targetLabel:2(->182)
    Successors: [ WebKit#15 ]

    bb#15
    Predecessors: [ WebKit#13 WebKit#14 ]
    [ 182] mov                dst:loc12, src:Undefined(const1)
    ...

    Exception Handlers:
    	 1: { start: [  20] end: [  29] target: [ 170] } synthesized catch
    	 2: { start: [  29] end: [ 138] target: [ 176] } synthesized catch
    ```

    * JSTests/stress/catch-rest-parameter.js: Added.
    (throwError):
    (shouldThrow):
    (async f):
    (throwError.async f):
    (throwError.async let):
    (async let):
    (x.async f):
    (x):
    (async shouldThrow):
    * Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:
    (JSC::BytecodeGenerator::BytecodeGenerator):
    (JSC::BytecodeGenerator::initializeDefaultParameterValuesAndSetupFunctionScopeStack):
    * Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h:

    Canonical link: https://commits.webkit.org/256864@main

Canonical link: https://commits.webkit.org/252432.994@safari-7614-branch
webkit-commit-queue pushed a commit to Constellation/WebKit that referenced this pull request Jan 24, 2023
https://bugs.webkit.org/show_bug.cgi?id=251063
rdar://104585575

Reviewed by Mark Lam and Justin Michaud.

This patch enhances CallFrame::dump to support wasm frames in btjs stacktrace.
The example is as follows.

    frame #0: 0x00000001035fca78 JavaScriptCore`JSC::functionBreakpoint(globalObject=0x000000012f410068, callFrame=0x000000016fdfa9d0) at JSDollarVM.cpp:2273:9 [opt]
    frame WebKit#1: 0x000000010ec44204 0x10eccc5dc
    frame WebKit#2: 0x000000010eccc5dc callback#Dwaxn6 [Baseline bc#50](Undefined)
    frame WebKit#3: 0x000000010ec4ca84 wasm-stub [WasmToJS](Wasm::Instance: 0x10d29da40)
    frame WebKit#4: 0x000000010ed0c060 <?>.wasm-function[1] [OMG](Wasm::Instance: 0x10d29da40)
    frame WebKit#5: 0x000000010ed100d0 jsToWasm#CWTx6k [FTL bc#22](Cell[JSModuleEnvironment]: 0x12f524540, Cell[WebAssemblyFunction]: 0x10d06a3a8, 1, 2, 3)
    frame WebKit#6: 0x000000010ec881b0 #D5ymZE [Baseline bc#733](Undefined, Cell[Generator]: 0x12f55c180, 1, Cell[Object]: 0x12f69dfc0, 0, Cell[JSLexicalEnvironment]: 0x12f52cee0)
    frame WebKit#7: 0x000000010ec3c008 asyncFunctionResume#A4ayYg [LLInt bc#49](Undefined, Cell[Generator]: 0x12f55c180, Cell[Object]: 0x12f69dfc0, 0)
    frame WebKit#8: 0x000000010ec3c008 promiseReactionJobWithoutPromise#D0yDF1 [LLInt bc#25](Undefined, Cell[Function]: 0x12f44f3c0, Cell[Object]: 0x12f69dfc0, Cell[Generator]: 0x12f55c180)
    frame WebKit#9: 0x000000010ec80ec0 promiseReactionJob#EdShZz [Baseline bc#74](Undefined, Undefined, Cell[Function]: 0x12f44f3c0, Cell[Object]: 0x12f69dfc0, Cell[Generator]: 0x12f55c180)
    frame WebKit#10: 0x000000010ec3c728
    frame WebKit#11: 0x0000000103137560 JavaScriptCore`JSC::Interpreter::executeCall(JSC::JSGlobalObject*, JSC::JSObject*, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) [inlined] JSC::JITCode::execute(this=<unavailable>, vm=<unavailable>, protoCallFrame=<unavailable>) at JITCodeInlines.h:42:38 [opt]
    frame WebKit#12: 0x0000000103137524 JavaScriptCore`JSC::Interpreter::executeCall(this=<unavailable>, lexicalGlobalObject=<unavailable>, function=<unavailable>, callData=<unavailable>, thisValue=<unavailable>, args=<unavailable>) at Interpreter.cpp:1093:27 [opt]
    frame WebKit#13: 0x000000010349d6d0 JavaScriptCore`JSC::runJSMicrotask(globalObject=0x000000012f410068, identifier=(m_identifier = 81), job=JSValue @ x22, argument0=JSValue @ x26, argument1=JSValue @ x25, argument2=<unavailable>, argument3=<unavailable>) at JSMicrotask.cpp:98:9 [opt]
    frame WebKit#14: 0x00000001039dfc54 JavaScriptCore`JSC::VM::drainMicrotasks() (.cold.1) at VM.cpp:0:9 [opt]
    frame WebKit#15: 0x00000001035e58a4 JavaScriptCore`JSC::VM::drainMicrotasks() [inlined] JSC::MicrotaskQueue::dequeue(this=<unavailable>) at VM.cpp:0:9 [opt]
    frame WebKit#16: 0x00000001035e5894 JavaScriptCore`JSC::VM::drainMicrotasks(this=0x000000012f000000) at VM.cpp:1255:46 [opt]
    ...

* Source/JavaScriptCore/interpreter/CallFrame.cpp:
(JSC::CallFrame::dump const):

Canonical link: https://commits.webkit.org/259262@main
CGQAQ pushed a commit to CGQAQ/WebKit that referenced this pull request Aug 25, 2023
Let the embedder control pending tasks
Wowfunhappy referenced this pull request in Wowfunhappy/WebKit Jun 18, 2026
…timers

Safari's V0 WKPagePolicyClient (BrowserPagePolicyClient::decidePolicyForAction) casts its callback userData arg to a WKDictionary and bails WITHOUT driving the policy listener if it's null; it reads "CanHandleRequest" (Boolean) and "OriginatingFrame" (Frame) from it. That dictionary was built by Safari's WebProcess injected-bundle policy client, which modern WebKit gutted (WKBundlePageSetPolicyClient is an empty stub; WKBundleNavigationAction* return-0 stubs), so our WKPage.cpp dispatch passed nullptr userData -> Safari bailed -> navigation hung. The backport masked this with 50ms/1500ms RunLoop timers force-calling listener->use(), which also meant Safari could never genuinely ignore() or download().

Reconstruct the { CanHandleRequest: Boolean, OriginatingFrame: FrameHandle } dictionary in WebFrameLoaderClient (WebProcess), thread it through a new NavigationActionData::bundlePolicyUserData via the existing UserData handle round-trip (transformObjectsToHandles -> transformHandlesToObjects), rehydrate it in WebPageProxy and pass it to the policy client's V0/V1/V2 callbacks (was nullptr). DELETE both auto-USE timers. Reader (#37) custom-proto + Top Sites (#13) offscreen bypasses unchanged.

Verified live: Safari makes real use()/download() decisions (a .zip link downloads instead of navigating); github/cnn/verge load promptly; Top Sites thumbnails + Reader intact; no hangs. Disassembly-confirmed root cause; independent hack-check clean.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Wowfunhappy referenced this pull request in Wowfunhappy/WebKit Jun 18, 2026
The backport installed a global NSEvent monitor (+[WKView installEventMonitorOnce]) that intercepted mouse/scroll/key events and dispatched them to WKView, on the belief that layer-tree mirror subviews intercepted hit-testing. That was a MISDIAGNOSIS: WKView hosts the WebContent layer tree as a plain CALayer sublayer of its backing layer (MinimalPageClient enterAcceleratedCompositingMode/setRemoteLayerTreeRootNode, [[m_view layer] addSublayer:]) with ZERO NSView subviews. CALayers don't participate in NSView -hitTest:, so nothing ever intercepted events. Worse, the monitor consumed events before -[NSWindow sendEvent:] (where AppKit activates the window on click), creating the very click-to-activate problem it then re-patched.

Remove the monitor and rely on AppKit's natural responder chain; WKView's own scrollWheel:/keyDown:/mouseDown:/mouseMoved: handlers receive events directly. Keep the -hitTest: override as upstream-equivalent insurance (upstream WebViewImpl::hitTest does the same redirect).

Verified live: main-view links/scroll/typing/right-click; hover (#17) fires :hover on a fresh page AND with the address bar focused; Reader scroll (#39) works via natural routing to the topmost ReaderWKView; and every secondary WKView that relied on the monitor -- uBlock popover (#14/#23), Web Inspector (#16), App Store (#72), Top Sites (#13), Preferences>Extensions (#24) -- stays interactive. No crashes. Retires the #62 event-monitor keystone and supersedes #39's monitor routing. (The DDG-logo black box, a separate #56 IOSurface-backing symptom, is root-caused but not fixed here.)

Co-Authored-By: Claude Opus 4.8 <[email protected]>
webkit-commit-queue pushed a commit that referenced this pull request Jul 23, 2026
…s' per-flex-item static helpers

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

Reviewed by Antti Koivisto.

The per-item static helpers in FlexFormattingUtils took the flex container as an
explicit (const RenderFlexibleBox&, const RenderBox& flexItem) pair, even though a
flex item's parent is always the flex container. Drop the container argument from
these twelve statics and derive it internally from the item's parent, mirroring
what ScopedCrossAxisOverrideForFlexItem already does:

    auto& flexBox = downcast<RenderFlexibleBox>(*flexItem.parent());

The two that only forwarded the container to other statics (useContentBasedMinimumSize,
flexBasisForFlexItem) no longer need it at all. All callers drop the container argument:
the utils' own static-to-static calls and instance forwarders, RenderFlexibleBox's proxies
and ScopedCrossAxisOverrideForFlexItem, and LayoutIntegration::FlexLayout (its positioned
flex items are direct out-of-flow children, so their parent is the container too). The
container-only statics (isColumnFlow, isHorizontalFlow, computeGap, ...) still take it.

Also correct the cross-axis step comments in FlexFormattingContext::layout(): they
labelled a section "9.6 (#13 - #16)" although the block also runs the §9.4 steps (#9,
dependency around the container's used-cross-size finalization (#15), not by spec number,
so the comment now says so.

No change in behavior.

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::FlexFormattingContext::layout):
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingUtils.cpp:
(WebCore::FlexFormattingUtils::crossAxisMarginExtentForFlexItem):
(WebCore::FlexFormattingUtils::preferredMainSizeLengthForFlexItem):
(WebCore::FlexFormattingUtils::minMainSizeLengthForFlexItem):
(WebCore::FlexFormattingUtils::preferredCrossSizeLengthForFlexItem):
(WebCore::FlexFormattingUtils::mainAxisOverflowForFlexItem):
(WebCore::FlexFormattingUtils::hasAutoMarginsInCrossAxis):
(WebCore::FlexFormattingUtils::useContentBasedMinimumSize):
(WebCore::FlexFormattingUtils::preferredAspectRatioForFlexItem const):
(WebCore::FlexFormattingUtils::needToStretchFlexItemLogicalHeight const):
(WebCore::FlexFormattingUtils::innerCrossSizeForFlexItem):
(WebCore::FlexFormattingUtils::availableAlignmentSpaceForFlexItem const):
(WebCore::FlexFormattingUtils::marginBoxAscentForFlexItem const):
(WebCore::FlexFormattingUtils::mainAxisIsFlexItemInlineAxis):
(WebCore::FlexFormattingUtils::flexBasisForFlexItem):
(WebCore::FlexFormattingUtils::alignmentForFlexItem):
(WebCore::FlexFormattingUtils::hasDefiniteCrossSizeForFlexItem):
(WebCore::FlexFormattingUtils::crossAxisMarginExtentForFlexItem const):
(WebCore::FlexFormattingUtils::preferredMainSizeLengthForFlexItem const):
(WebCore::FlexFormattingUtils::minMainSizeLengthForFlexItem const):
(WebCore::FlexFormattingUtils::preferredCrossSizeLengthForFlexItem const):
(WebCore::FlexFormattingUtils::hasAutoMarginsInCrossAxis const):
(WebCore::FlexFormattingUtils::useContentBasedMinimumSize const):
(WebCore::FlexFormattingUtils::innerCrossSizeForFlexItem const):
(WebCore::FlexFormattingUtils::mainAxisIsFlexItemInlineAxis const):
(WebCore::FlexFormattingUtils::flexBasisForFlexItem const):
(WebCore::FlexFormattingUtils::alignmentForFlexItem const):
(WebCore::FlexFormattingUtils::hasDefiniteCrossSizeForFlexItem const):
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingUtils.h:
* Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
(WebCore::LayoutIntegration::FlexLayout::firstLineBaseline const):
(WebCore::LayoutIntegration::FlexLayout::lastLineBaseline const):
(WebCore::LayoutIntegration::FlexLayout::baselineFlexItemInLine const):
(WebCore::LayoutIntegration::FlexLayout::staticCrossAxisPositionForPositionedFlexItem):
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::ScopedCrossAxisOverrideForFlexItem::ScopedCrossAxisOverrideForFlexItem):
(WebCore::RenderFlexibleBox::canUseFlexItemForPercentageResolution):
(WebCore::RenderFlexibleBox::computeBlockAxisContentSizeForFlexItem):
(WebCore::RenderFlexibleBox::setOverridingMainSizeForFlexItem):
(WebCore::RenderFlexibleBox::resetAutoMarginsAndLogicalTopInCrossAxis):
(WebCore::RenderFlexibleBox::useContentBasedMinimumBlockSize const):
(WebCore::RenderFlexibleBox::hasStretchedFlexItemWithAspectRatio const):
(WebCore::RenderFlexibleBox::mainAxisIsFlexItemInlineAxis const):
(WebCore::RenderFlexibleBox::flexBasisForFlexItem const):
(WebCore::RenderFlexibleBox::alignmentForFlexItem const):
(WebCore::RenderFlexibleBox::hasDefiniteCrossSizeForFlexItem const):
(WebCore::RenderFlexibleBox::flexItemMainSizeIsDefinite):

Canonical link: https://commits.webkit.org/317776@main
webkit-commit-queue pushed a commit to igower/WebKit that referenced this pull request Aug 27, 2026
… spec

https://bugs.webkit.org/show_bug.cgi?id=321725
rdar://184859143

Reviewed by Pascoe.

Widens IP address space classification beyond the ranges the Local Network Access spec
enumerates, and replaces string comparison on the host with a prefix-table match over raw
address bytes. See https://wicg.github.io/local-network-access/#ip-address-space-section and
WICG/local-network-access#6, WebKit/issues/13 and WebKit/issues/15.

The previous implementation compared host strings (`host == "::1"`, `host.contains(':')`),
which missed equivalent spellings of the same address -- `::1` and `0:0:0:0:0:0:0:1` are the
same host. Parsing to bytes and matching a prefix table classifies all spellings of an
address identically.

Classifying a range as public is the permissive answer here: the check fires only when the
target is less public than the client, so a range left public is reachable from a public page
with no permission at all. None of the ranges below can host a publicly-served site.

Ranges added beyond the spec, each covered by a test:
  - as loopback: 0.0.0.0/32 (this host, RFC 1122), 198.18.0.0/15 (benchmarking, RFC 2544),
    ::/128 (IPv6 unspecified, RFC 4291)
  - as local: 0.0.0.0/8 (this network, RFC 791), 100.64.0.0/10 (carrier-grade NAT, RFC 6598),
    192.0.0.0/24 (IETF protocol assignments, RFC 6890), 192.0.2.0/24, 198.51.100.0/24,
    203.0.113.0/24 (documentation, RFC 5737), 192.88.99.0/24 (deprecated 6to4 relay anycast,
    RFC 7526), 224.0.0.0/4 (multicast), 240.0.0.0/4 (reserved, RFC 1112)
  - as local, IPv6: fec0::/10 (deprecated site-local, RFC 3879), 2001:db8::/32 and 3fff::/20
    (documentation, RFC 3849 and RFC 9637), ff00::/8 (multicast, RFC 4291), 0100::/64
    (discard-only, RFC 6666)
  - IPv4-mapped IPv6 forms, which now classify as their embedded IPv4 address does
  - NAT64 (RFC 6052), which likewise classifies as the IPv4 address it carries: the Well-Known
    Prefix 64:ff9b::/96, and 64:ff9b:1::/48 reserved for local use (RFC 8215). Without this a
    public page could reach a private host through a NAT64 prefix with no permission. At /48 the
    embedded address straddles the octet at bits 64-71 that the addressing architecture reserves,
    so 64:ff9b:1:c0a8:1:100:: carries 192.168.1.1. An operator's network-specific prefix cannot be
    recognised here, so only these two fixed prefixes are handled.

Also recognises localhost and .local by name, which the previous host-string path did not.

Non-dotted IPv4 hosts are canonicalised by the URL parser before classification sees them, so
http://2130706433/ and http://0x7f000001/ arrive as 127.0.0.1. Asserted rather than assumed, since
classifyHost() only parses dotted quads and would return Public for any form the parser stopped
normalising.

Adds Tests/WebCore/IPAddressSpaceTests.cpp to Tools/TestWebKitAPI/CMakeLists.txt. It was never
listed, so every CMake port has been skipping these tests entirely.

Also gates BrowsingContextGroup's shared-process exclusion on the LocalNetworkAccessEnabled
preference. Widening the classifier changes what isLoopbackOrLocalNetworkSite() returns, and
without the gate that would alter site-isolation process placement for embedders with the
feature off. Ordinary hostnames are unaffected either way: classifyHost() returns Public for
anything that is not an address literal, so only literals, localhost and .local names are
excluded from the shared process.

Two entry points share the tables: determineIPAddressSpace(URL/Site), used before any
connection exists by fetch()'s targetAddressSpace derivation and site-isolation process
placement; and classifyIPAddressSpace(IPAddress), used for a resolved peer address.

No behaviour change with LocalNetworkAccessEnabled off.

* Source/WebCore/Modules/fetch/IPAddressSpace.cpp:
(WebCore::matchesPrefix):
(WebCore::classifyAddress):
(WebCore::classifyIPv4Address):
(WebCore::nat64EmbeddedIPv4Address):
(WebCore::classifyIPv6Address):
(WebCore::determineIPAddressSpaceFromHost):
* Source/WebKit/UIProcess/BrowsingContextGroup.cpp:
(WebKit::isLoopbackOrLocalNetworkSite):
(WebKit::BrowsingContextGroup::sharedProcessForSite):
* Tools/TestWebKitAPI/CMakeLists.txt:
* Tools/TestWebKitAPI/Tests/WebCore/IPAddressSpaceTests.cpp:

Canonical link: https://commits.webkit.org/319918@main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants