Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Draft] Merge up to 0.76-stable branch cut #2190

Draft
wants to merge 969 commits into
base: main
Choose a base branch
from

Conversation

Saadnajmi
Copy link
Collaborator

Summary:

Merge up to the 0.76-stable branch cut.

Test Plan:

CI should passs

Interesting commits:

TODO

Full merge conflict log

[react-native-macos] git merge 143f1ad29874c1e8e9561abae263cb08f4859407                                                                                         0.76-merge 
Auto-merging .github/workflows/autorebase.yml
CONFLICT (content): Merge conflict in .github/workflows/autorebase.yml
Auto-merging .gitignore
Auto-merging Gemfile.lock
Auto-merging jest.config.js
Auto-merging package.json
CONFLICT (content): Merge conflict in package.json
Auto-merging packages/babel-plugin-codegen/package.json
CONFLICT (content): Merge conflict in packages/babel-plugin-codegen/package.json
Auto-merging packages/community-cli-plugin/package.json
Auto-merging packages/core-cli-utils/package.json
CONFLICT (content): Merge conflict in packages/core-cli-utils/package.json
Auto-merging packages/helloworld/package.json
Auto-merging packages/react-native-babel-preset/package.json
CONFLICT (content): Merge conflict in packages/react-native-babel-preset/package.json
Auto-merging packages/react-native-bots/package.json
CONFLICT (content): Merge conflict in packages/react-native-bots/package.json
Auto-merging packages/react-native-codegen-typescript-test/package.json
CONFLICT (content): Merge conflict in packages/react-native-codegen-typescript-test/package.json
Auto-merging packages/react-native-codegen/package.json
CONFLICT (content): Merge conflict in packages/react-native-codegen/package.json
Auto-merging packages/react-native-test-library/package.json
CONFLICT (content): Merge conflict in packages/react-native-test-library/package.json
Auto-merging packages/react-native-test-renderer/package.json
Auto-merging packages/react-native/Libraries/Alert/Alert.js
CONFLICT (modify/delete): packages/react-native/Libraries/Animated/NativeAnimatedHelper.js deleted in 143f1ad29874c1e8e9561abae263cb08f4859407 and modified in HEAD.  Version HEAD of packages/react-native/Libraries/Animated/NativeAnimatedHelper.js left in tree.
Auto-merging packages/react-native/Libraries/AppDelegate/RCTAppDelegate.h
Auto-merging packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm
Auto-merging packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.mm
Auto-merging packages/react-native/Libraries/Components/ScrollView/ScrollView.js
Auto-merging packages/react-native/Libraries/Components/ScrollView/__tests__/__snapshots__/ScrollView-test.js.snap
Auto-merging packages/react-native/Libraries/Components/StatusBar/StatusBar.js
Auto-merging packages/react-native/Libraries/Components/TextInput/TextInput.d.ts
Auto-merging packages/react-native/Libraries/Components/TextInput/TextInput.js
Auto-merging packages/react-native/Libraries/Components/View/ReactNativeViewAttributes.js
Auto-merging packages/react-native/Libraries/Components/View/ViewPropTypes.js
Auto-merging packages/react-native/Libraries/Image/Image.ios.js
Auto-merging packages/react-native/Libraries/Image/RCTImageLoader.mm
CONFLICT (content): Merge conflict in packages/react-native/Libraries/Image/RCTImageLoader.mm
Auto-merging packages/react-native/Libraries/Image/RCTImageView.mm
CONFLICT (content): Merge conflict in packages/react-native/Libraries/Image/RCTImageView.mm
Auto-merging packages/react-native/Libraries/Image/RCTResizeMode.h
Auto-merging packages/react-native/Libraries/Image/React-RCTImage.podspec
CONFLICT (content): Merge conflict in packages/react-native/Libraries/Image/React-RCTImage.podspec
Auto-merging packages/react-native/Libraries/Image/__tests__/__snapshots__/Image-test.js.snap
Auto-merging packages/react-native/Libraries/Inspector/NetworkOverlay.js
Auto-merging packages/react-native/Libraries/LinkingIOS/React-RCTLinking.podspec
Auto-merging packages/react-native/Libraries/Lists/FlatList.js
Auto-merging packages/react-native/Libraries/Lists/SectionList.js
Auto-merging packages/react-native/Libraries/Lists/SectionListModern.js
CONFLICT (content): Merge conflict in packages/react-native/Libraries/Lists/SectionListModern.js
Auto-merging packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeader.js
Auto-merging packages/react-native/Libraries/Modal/Modal.js
Auto-merging packages/react-native/Libraries/NativeAnimation/RCTNativeAnimatedModule.mm
Auto-merging packages/react-native/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h
Auto-merging packages/react-native/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.mm
Auto-merging packages/react-native/Libraries/Network/React-RCTNetwork.podspec
Auto-merging packages/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts
Auto-merging packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js
Auto-merging packages/react-native/Libraries/Text/BaseText/RCTBaseTextViewManager.mm
Auto-merging packages/react-native/Libraries/Text/RCTTextAttributes.h
Auto-merging packages/react-native/Libraries/Text/RCTTextAttributes.mm
Auto-merging packages/react-native/Libraries/Text/React-RCTText.podspec
CONFLICT (content): Merge conflict in packages/react-native/Libraries/Text/React-RCTText.podspec
Auto-merging packages/react-native/Libraries/Text/Text/RCTTextShadowView.mm
Auto-merging packages/react-native/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.mm
Auto-merging packages/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.mm
CONFLICT (content): Merge conflict in packages/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.mm
Auto-merging packages/react-native/Libraries/Text/TextNativeComponent.js
Auto-merging packages/react-native/Libraries/Utilities/Appearance.js
CONFLICT (content): Merge conflict in packages/react-native/Libraries/Utilities/Appearance.js
Auto-merging packages/react-native/Libraries/Utilities/HMRClient.js
Auto-merging packages/react-native/Libraries/Utilities/ReactNativeTestTools.js
Auto-merging packages/react-native/Libraries/WebSocket/WebSocket.js
Auto-merging packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap
CONFLICT (content): Merge conflict in packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap
Auto-merging packages/react-native/React/Base/RCTBridge.mm
Auto-merging packages/react-native/React/Base/RCTConvert.h
CONFLICT (content): Merge conflict in packages/react-native/React/Base/RCTConvert.h
Auto-merging packages/react-native/React/Base/RCTConvert.mm
CONFLICT (content): Merge conflict in packages/react-native/React/Base/RCTConvert.mm
Auto-merging packages/react-native/React/Base/RCTKeyCommands.m
CONFLICT (content): Merge conflict in packages/react-native/React/Base/RCTKeyCommands.m
Auto-merging packages/react-native/React/CoreModules/RCTAppearance.mm
Auto-merging packages/react-native/React/CoreModules/RCTDevLoadingView.mm
Auto-merging packages/react-native/React/CoreModules/RCTDevMenu.mm
Auto-merging packages/react-native/React/CoreModules/RCTDeviceInfo.mm
CONFLICT (content): Merge conflict in packages/react-native/React/CoreModules/RCTDeviceInfo.mm
Auto-merging packages/react-native/React/CoreModules/RCTPerfMonitor.mm
CONFLICT (content): Merge conflict in packages/react-native/React/CoreModules/RCTPerfMonitor.mm
Auto-merging packages/react-native/React/CoreModules/RCTPlatform.mm
Auto-merging packages/react-native/React/CoreModules/RCTRedBox.mm
CONFLICT (content): Merge conflict in packages/react-native/React/CoreModules/RCTRedBox.mm
Auto-merging packages/react-native/React/CoreModules/RCTStatusBarManager.mm
Auto-merging packages/react-native/React/CoreModules/React-CoreModules.podspec
Auto-merging packages/react-native/React/CxxBridge/RCTCxxBridge.mm
Auto-merging packages/react-native/React/DevSupport/RCTInspectorDevServerHelper.mm
CONFLICT (content): Merge conflict in packages/react-native/React/DevSupport/RCTInspectorDevServerHelper.mm
Auto-merging packages/react-native/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm
Auto-merging packages/react-native/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm
CONFLICT (content): Merge conflict in packages/react-native/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm
Auto-merging packages/react-native/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm
Auto-merging packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.h
Auto-merging packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm
CONFLICT (content): Merge conflict in packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm
Auto-merging packages/react-native/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm
CONFLICT (content): Merge conflict in packages/react-native/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm
Auto-merging packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm
Auto-merging packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm
Auto-merging packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm
CONFLICT (content): Merge conflict in packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm
Auto-merging packages/react-native/React/Fabric/Mounting/RCTMountingManager.mm
Auto-merging packages/react-native/React/Fabric/RCTSurfacePresenter.mm
Auto-merging packages/react-native/React/Modules/RCTRedBoxExtraDataViewController.m
Auto-merging packages/react-native/React/React-RCTFabric.podspec
Auto-merging packages/react-native/React/Views/RCTBorderDrawing.h
Auto-merging packages/react-native/React/Views/RCTBorderDrawing.m
Auto-merging packages/react-native/React/Views/RCTComponentData.m
Auto-merging packages/react-native/React/Views/RCTModalHostView.m
Auto-merging packages/react-native/React/Views/RCTModalHostViewController.m
CONFLICT (content): Merge conflict in packages/react-native/React/Views/RCTModalHostViewController.m
Auto-merging packages/react-native/React/Views/RCTModalHostViewManager.m
Auto-merging packages/react-native/React/Views/RCTView.m
CONFLICT (content): Merge conflict in packages/react-native/React/Views/RCTView.m
Auto-merging packages/react-native/React/Views/RCTViewManager.h
Auto-merging packages/react-native/React/Views/RCTViewManager.m
Auto-merging packages/react-native/React/Views/RefreshControl/RCTRefreshControl.m
Auto-merging packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java
Auto-merging packages/react-native/ReactCommon/react/nativemodule/samples/platform/ios/ReactCommon/RCTSampleTurboModule.mm
Auto-merging packages/react-native/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm
CONFLICT (content): Merge conflict in packages/react-native/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm
Auto-merging packages/react-native/ReactCommon/react/renderer/components/view/BaseViewProps.h
Auto-merging packages/react-native/ReactCommon/react/renderer/components/view/conversions.h
Auto-merging packages/react-native/ReactCommon/react/renderer/components/view/primitives.h
Auto-merging packages/react-native/ReactCommon/react/renderer/graphics/React-graphics.podspec
Auto-merging packages/react-native/ReactCommon/react/renderer/graphics/platform/ios/react/renderer/graphics/HostPlatformColor.mm
Auto-merging packages/react-native/ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager/RCTImagePrimitivesConversions.h
Auto-merging packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.h
Auto-merging packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm
Auto-merging packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTFontUtils.mm
Auto-merging packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm
Auto-merging packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextPrimitivesConversions.h
Auto-merging packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHermesInstance.h
Auto-merging packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.h
Auto-merging packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm
Auto-merging packages/react-native/index.js
Auto-merging packages/react-native/package.json
CONFLICT (content): Merge conflict in packages/react-native/package.json
Auto-merging packages/react-native/react-native.config.js
CONFLICT (content): Merge conflict in packages/react-native/react-native.config.js
Auto-merging packages/react-native/scripts/cocoapods/__tests__/codegen_utils-test.rb
Auto-merging packages/react-native/scripts/cocoapods/helpers.rb
Auto-merging packages/react-native/scripts/cocoapods/utils.rb
Auto-merging packages/react-native/scripts/react-native-xcode.sh
Auto-merging packages/react-native/scripts/react_native_pods.rb
Auto-merging packages/react-native/sdks/hermes-engine/hermes-engine.podspec
CONFLICT (modify/delete): packages/react-native/template/package.json deleted in 143f1ad29874c1e8e9561abae263cb08f4859407 and modified in HEAD.  Version HEAD of packages/react-native/template/package.json left in tree.
Auto-merging packages/rn-tester/Podfile.lock
CONFLICT (content): Merge conflict in packages/rn-tester/Podfile.lock
Auto-merging packages/rn-tester/RNTester/AppDelegate.mm
Auto-merging packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj
CONFLICT (content): Merge conflict in packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj
Auto-merging packages/rn-tester/RNTesterUnitTests/RCTAllocationTests.m
Auto-merging packages/rn-tester/js/components/RNTPressableRow.js
CONFLICT (content): Merge conflict in packages/rn-tester/js/components/RNTPressableRow.js
Auto-merging packages/rn-tester/js/components/RNTesterModuleContainer.js
Auto-merging packages/rn-tester/js/components/RNTesterModuleList.js
CONFLICT (content): Merge conflict in packages/rn-tester/js/components/RNTesterModuleList.js
Auto-merging packages/rn-tester/js/examples/Accessibility/AccessibilityExample.js
Auto-merging packages/rn-tester/js/examples/Border/BorderExample.js
Auto-merging packages/rn-tester/js/examples/Image/ImageExample.js
Auto-merging packages/rn-tester/js/examples/Layout/LayoutEventsExample.js
Auto-merging packages/rn-tester/js/examples/PlatformColor/PlatformColorExample.js
CONFLICT (content): Merge conflict in packages/rn-tester/js/examples/PlatformColor/PlatformColorExample.js
Auto-merging packages/rn-tester/js/examples/Pressable/PressableExample.js
Auto-merging packages/rn-tester/js/examples/ScrollView/ScrollViewExample.js
Auto-merging packages/rn-tester/js/examples/Snapshot/SnapshotExample.js
Auto-merging packages/rn-tester/js/examples/Text/TextExample.ios.js
Auto-merging packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js
Auto-merging packages/rn-tester/js/examples/Touchable/TouchableExample.js
Auto-merging packages/rn-tester/js/types/RNTesterTypes.js
Auto-merging packages/rn-tester/js/utils/RNTesterList.ios.js
Auto-merging packages/rn-tester/package.json
CONFLICT (content): Merge conflict in packages/rn-tester/package.json
Auto-merging packages/virtualized-lists/Lists/VirtualizedList.js
Auto-merging packages/virtualized-lists/Lists/VirtualizedListCellRenderer.js
Auto-merging packages/virtualized-lists/Lists/VirtualizedListProps.js
Auto-merging packages/virtualized-lists/package.json
CONFLICT (content): Merge conflict in packages/virtualized-lists/package.json
Auto-merging scripts/releases-ci/__tests__/publish-npm-test.js
CONFLICT (content): Merge conflict in scripts/releases-ci/__tests__/publish-npm-test.js
Auto-merging scripts/releases-ci/publish-npm.js
CONFLICT (content): Merge conflict in scripts/releases-ci/publish-npm.js
Auto-merging scripts/releases/utils/release-utils.js
CONFLICT (content): Merge conflict in scripts/releases/utils/release-utils.js
Auto-merging yarn.lock
CONFLICT (content): Merge conflict in yarn.lock
Automatic merge failed; fix conflicts and then commit the result.

huntie and others added 30 commits August 13, 2024 16:00
Summary:
Pull Request resolved: facebook#46000

Changelog: [Internal] - Update `react-native/debugger-frontend` from 7b143e5...c98a122

Resyncs `react-native/debugger-frontend` from GitHub - see `rn-chrome-devtools-frontend` [changelog](facebookexperimental/rn-chrome-devtools-frontend@7b143e5...c98a122).

Reviewed By: robhogan

Differential Revision: D61208000

fbshipit-source-id: 8884d7946f4f62bbfe48e3fddc6c873f952d826c
Summary:
Pull Request resolved: facebook#46005

The RCTDevLoadingView is clipped in Mac Catalyst, hiding half of it under the toolbar. This change maintains the behavior on iOS of extending past the dynamic island.

{F1803665273}

Changelog: [Internal]

Reviewed By: shwanton

Differential Revision: D61209780

fbshipit-source-id: 6c9c572a9e47a8caf191c40fb53c4a7d43b64281
Summary:
Pull Request resolved: facebook#46011

Backing out D58561775 in the meantime while we are trying to do proper fix in Hermes engine D61058869

Changelog: [Internal]
Temporarily revert this diff facebook#44900 while we wait for facebook#45966 to land

Reviewed By: makovkastar

Differential Revision: D61246120

fbshipit-source-id: 8c205efe9d29cd34f24676c4a48d55f0493d73ab
…positories (facebook#45566)

Summary:
At OEBB we currently facing an issue we're not able to use our mirrored git repositories for third-party podspecs. This is due to the fact podspecs contain hardcoded git repository urls. With this change we could specify urls to our mirrored git repositories.

## Changelog:

[IOS] [ADDED] Enable third-party podspec sources to be fetched from mirrored git repositories

Pull Request resolved: facebook#45566

Test Plan:
```bash
# Define env vars for git mirrors

export FMT_GIT_URL="https://my-git-host.com/my-mirrored-repo.git"
export GLOG_GIT_URL="https://my-git-host.com/my-mirrored-repo.git"
export FOLLY_GIT_URL="https://my-git-host.com/my-mirrored-repo.git"
export DOUBLE_CONVERSION_GIT_URL="https://my-git-host.com/my-mirrored-repo.git"
export BOOST_GIT_URL="https://my-git-host.com/my-mirrored-repo.git"

# Pod install command run from ios app folder
pod install
```

Reviewed By: cortinico

Differential Revision: D61209204

Pulled By: cipolleschi

fbshipit-source-id: b19f7b8262c860b5c4d553732da50c9bd0373397
Summary:
Pull Request resolved: facebook#45873

I'm removing the Gradle dependency on OSS SoLoader and stubbing it with our own implementation.
This will allow us to implement merging of further .so libraries and

As Fresco also depends on SoLoader, I had to stub the `NativeLoader` dependency as well.

Changelog:
[Android] [Breaking] - Do not depend on OSS SoLoader anymore and do not expose Fresco `api` dependency.

Reviewed By: mdvacca

Differential Revision: D60652007

fbshipit-source-id: 6e70a5c37ba9337fbe8772e192b886ba4693c7f1
…6004)

Summary:
Pull Request resolved: facebook#46004

This is the first library I'm moving over inside libreactnative.so

Changelog:
[Android] [Changed] - Move libreact_newarchdefaults.so inside libreactnative.so

Reviewed By: cipolleschi

Differential Revision: D61211104

fbshipit-source-id: 2526395a246df9ebf6387ca434e07b4ed4484f1e
Summary:
Pull Request resolved: facebook#46003

Another library going inside libreactnative.so

Changelog:
[Android] [Changed] - Move libmapbufferjni.so inside libreactnative.so

Reviewed By: cipolleschi

Differential Revision: D61211105

fbshipit-source-id: 38fce9ff9025fc6d2cd9eff3ee57303babed8852
Summary:
Pull Request resolved: facebook#46016

Wrapping the JavaScriptException with a RuntimException means we lose JS specific metadata on the top-level exceptions, and can break categorization in crash-reporting tools.

We could also use the same logic as [DefaultJSExceptionHandler](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/DefaultJSExceptionHandler.java) but that doesn't seem to be required for Kotlin.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D61261515

fbshipit-source-id: fa85c8818834905759cbc984ea3c45403eb87e8c
…5982)

Summary:
Pull Request resolved: facebook#45982

Changelog: [Internal]

Recently `src/private/renderer/errorhandling/ErrorHandlers.js` started showing up in some error stack traces, making LogBox less readable. This diff ensures we collapse these extra stack frames by default (as well as hide them in Fusebox, etc).

Reviewed By: hoxyq

Differential Revision: D61128294

fbshipit-source-id: 2ebcb47265aaf3281b669ed022c29978167f3e81
Summary:
Changelog for 0.75.0

## Changelog:

[Internal] - Changelog for 0.75.0

Pull Request resolved: facebook#45814

Test Plan: N/A

Reviewed By: cortinico

Differential Revision: D60446949

Pulled By: cipolleschi

fbshipit-source-id: e26e3486e3c9d224678f3df913368fa280c2e431
Differential Revision:
D60143747

Original commit changeset: 6f1a9ea1cf95

Original Phabricator Diff: D60143747

fbshipit-source-id: c07088c4591ca344dbdc31c9f86b1a44a575c0ae
Summary:
Pull Request resolved: facebook#45927

This was attempted earlier in the year, and was unsuccessful because HelloWorld had a hidden dependency on this.

Changelog: [General][Breaking] Projects that intend to use the community CLI will now have to declare that dependency instead of transitively having the react-native package handle this.

Reviewed By: GijsWeterings

Differential Revision: D60898346

fbshipit-source-id: 1d62615f718e06caf684f48ecfaf610bf1f51f8e
Summary:
This PR solves [issue](facebook#45958) with displaying irregular borders on Fabric. The same issue appears on the old architecture, but I am having a problems there, so I am pushing this fix for now.

The problem is solved by decoupling `backgroundColor` from `borderLayer` and setting `zPosition` on `borderLayer` to `1024.0f`, so that the border is always in front of the layer. The `zPosition` is compared within a layer, so it shouldn't impact outside components. I would love to hear your opinion if there is a case in which this could break.

## Changelog:

[IOS] [FIXED] - changed border display

Pull Request resolved: facebook#45973

Test Plan:
I've checked that on RNTester Images.

![border-issues-screen](https://github.com/user-attachments/assets/e12add82-8016-4c42-833d-f396307e9423)

Reviewed By: joevilches

Differential Revision: D61119409

Pulled By: cipolleschi

fbshipit-source-id: a88912061c7a8d72eec4f4092adb076dd6ae511e
Summary:
Pull Request resolved: facebook#46023

Minimizing and restoring a Mac Catalyst app causes an `interfaceOrientationDidChange` which causes a downstream crash on `application.delegate.window`.

There doesn't seem to be a clean way to get if an app is fullscreen in Mac Catalyst, so just no-oping for now.

Changelog: [Internal]

Reviewed By: shwanton

Differential Revision: D61253706

fbshipit-source-id: 73d260366adcc74e88f43f256cc5aff8a6e3ef71
Summary:
Pull Request resolved: facebook#46025

Changelog:
[General][Fixed] - Change RawPropsParser logs from ERROR level to WARNING

Reviewed By: christophpurrer

Differential Revision: D61304854

fbshipit-source-id: bc16df4916a54cb7c1fa57f359eab3d9eed4e2f4
Summary:
## History
1. Originally landed in D60138415
2. Reverted in D60232011 (it broke ios oss builds)

## Motivation
In bridgeless, we want to configure the error handling of runtime scheduler. So that we can route those errors to the C++ error handling pipeline, when necessary.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D60477342

fbshipit-source-id: f14e20d7aff39e0fee42918567ccc6e685674134
Summary:
If any fatal js error is caught in c++, just route it through js error handler.

Then, make js error handler call into the right pipeline:
1. After the js pipeline is ready: Route the errors through the js pipeline
2. Otherwise: Route errors through the c++ pipeline.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D60138417

fbshipit-source-id: 24c466ffadbd14a9e9a5571548f3d34d2f406a8d
Summary:
If a fatal error is caught in js, and the js pipeline isn't ready, route it through the c++ pipeline.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D60138414

fbshipit-source-id: 333e38e2b904d6434a88469816e39bf1b9d0bc3f
Summary:
Pull Request resolved: facebook#45617

This isn't necessary.

RuntimeScheduler will catch and report via js error handler.

Changelog: [Internal]

Reviewed By: alanleedev

Differential Revision: D60139055

fbshipit-source-id: 511f384ede71d88b81ef5c031fa67b1fb03f7631
Summary:
Fixes build error like https://github.com/facebook/react-native/actions/runs/10398775597/job/28797041872. cc RSNara

## Changelog:

[IOS] [FIXED] - Add missing pod dependency of jserrorhandler

Pull Request resolved: facebook#46030

Test Plan: CI green.

Reviewed By: cortinico

Differential Revision: D61329173

Pulled By: cipolleschi

fbshipit-source-id: c7dc6d7af3b57f748ae3464d9f4231ff4fb36e63
Summary:
Pull Request resolved: facebook#46034

The create release workflow was not working properly for 0.75:

* the latest tag was not pushed because we were using the wrong input
* the latest tag was not deleted because we were not fetching all the tags
* the create release job 'dry-run' defaults to false, which is a bit dangerous

This change is a backport from 0.75 to main of these changes.

## Changelog
[Internal] - Make sure that the Latest tag is properly pushed to github while releasing

Reviewed By: cortinico

Differential Revision: D61331247

fbshipit-source-id: 89bf0698c45ec6c766e25b11599dbe926d8a6297
Summary:
Add changelog for 0.75.1

## Changelog:
[Internal] - Add changelog

Pull Request resolved: facebook#46038

Test Plan: N/A

Reviewed By: cortinico

Differential Revision: D61333096

Pulled By: cipolleschi

fbshipit-source-id: 19ba0bce60056be12d1b0427939c5896c22e215b
Summary:
Pull Request resolved: facebook#46040

The URL to dispatch the workflow was not correct, see [0].

## Changelog: [Internal]

[0] https://docs.github.com/en/rest/actions/workflows?apiVersion=2022-11-28#create-a-workflow-dispatch-event

## Internal:

For S441191, see the job launched:
- https://github.com/react-native-community/template/actions/runs/10404141179/job/28811993693

 {F1806960111}

Reviewed By: cipolleschi

Differential Revision: D61333084

fbshipit-source-id: 62b20d792b9c667b3ee80d6d446423a6d24a67c2
Summary:
Removed UIReturnKeyDefault as it caused bug when there wasn't any type.

## Changelog:

[IOS] [REMOVED]: UIReturnKeyDefault

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests

Pull Request resolved: facebook#46020

Reviewed By: christophpurrer

Differential Revision: D61277058

Pulled By: cipolleschi

fbshipit-source-id: 18349c49b05d492a2c2ed5713af3ceb6d3728e70
Summary:
Pull Request resolved: facebook#45980

Use a safe remove method that won't crash on IndexOutOfBounds.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D61132496

fbshipit-source-id: edd887611c47f236b495986fc29e2d0b9ce56b8e
…oid) (facebook#46041)

Summary:
Pull Request resolved: facebook#46041

We observed that large or remotely loaded source maps could time out. This change aligns `OkHttpClient` timeout values with `CxxInspectorPackagerConnection`.

https://github.com/facebook/react-native/blob/a77f26827fee0fc18a11faccd0b5e51d1b222735/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/CxxInspectorPackagerConnection.java#L87-L91

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D61333240

fbshipit-source-id: 605b1fbf1b050d8e80ed569b25cb5694e2d14ec7
Summary:
Pull Request resolved: facebook#46039

Broke during Kotlin conversion I assume

Image onSubmit events were failing with

```
FdingControllerListener  E  InternalListener exception in onSubmit
                         E  java.lang.NullPointerException: Parameter specified as non-null is null: method com.facebook.react.views.image.ReactImageView$setShouldNotifyLoadEvents$1.onSubmit, parameter
                            callerContext
                         E      at com.facebook.react.views.image.ReactImageView$setShouldNotifyLoadEvents$1.onSubmit(Unknown Source:9)
                         E      at com.facebook.drawee.controller.ForwardingControllerListener.onSubmit(ForwardingControllerListener.java:75)
                         E      at com.facebook.drawee.controller.AbstractDraweeController.reportSubmit(AbstractDraweeController.java:832)
                         E      at com.facebook.drawee.controller.AbstractDraweeController.submitRequest(AbstractDraweeController.java:578)
                         E      at com.facebook.drawee.controller.AbstractDraweeController.onAttach(AbstractDraweeController.java:468)
                         E      at com.facebook.drawee.view.DraweeHolder.attachController(DraweeHolder.java:252)
                         E      at com.facebook.drawee.view.DraweeHolder.attachOrDetachController(DraweeHolder.java:269)
                         E      at com.facebook.drawee.view.DraweeHolder.onAttach(DraweeHolder.java:87)
                         E      at com.facebook.drawee.view.DraweeView.doAttach(DraweeView.java:208)
                         E      at com.facebook.drawee.view.DraweeView.onAttach(DraweeView.java:194)
                         E      at com.facebook.drawee.view.DraweeView.onAttachedToWindow(DraweeView.java:168)
                         E      at android.view.View.dispatchAttachedToWindow(View.java:20812)
                         E      at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
                         E      at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
                         E      at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
                         E      at android.view.ViewGroup.addViewInner(ViewGroup.java:5290)
                         E      at android.view.ViewGroup.addView(ViewGroup.java:5076)
                         E      at com.facebook.react.views.view.ReactViewGroup.addView(ReactViewGroup.java:591)
                         E      at android.view.ViewGroup.addView(ViewGroup.java:5016)
                         E      at com.facebook.react.views.view.ReactClippingViewManager.addView(ReactClippingViewManager.java:41)
                         E      at com.facebook.react.views.view.ReactClippingViewManager.addView(ReactClippingViewManager.java:21)
                         E      at com.facebook.react.fabric.mounting.SurfaceMountingManager.addViewAt(SurfaceMountingManager.java:412)
                         E      at com.facebook.react.fabric.mounting.mountitems.IntBufferBatchMountItem.execute(IntBufferBatchMountItem.java:119)
                         E      at com.facebook.react.fabric.mounting.MountItemDispatcher.executeOrEnqueue(MountItemDispatcher.java:387)
                         E      at com.facebook.react.fabric.mounting.MountItemDispatcher.dispatchMountItems(MountItemDispatcher.java:294)
                         E      at com.facebook.react.fabric.mounting.MountItemDispatcher.tryDispatchMountItems(MountItemDispatcher.java:127)
                         E      at com.facebook.react.fabric.FabricUIManager$DispatchUIFrameCallback.doFrameGuarded(FabricUIManager.java:1362)
                         E      at com.facebook.react.fabric.GuardedFrameCallback.doFrame(GuardedFrameCallback.kt:22)
                         E      at com.facebook.react.modules.core.ReactChoreographer$frameCallback$1.doFrame(ReactChoreographer.kt:59)
                         E      at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1035)
                         E      at android.view.Choreographer.doCallbacks(Choreographer.java:845)
                         E      at android.view.Choreographer.doFrame(Choreographer.java:775)
                         E      at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022)
                         E      at android.os.Handler.handleCallback(Handler.java:938)
                         E      at android.os.Handler.dispatchMessage(Handler.java:99)
                         E      at android.os.Looper.loopOnce(Looper.java:214)
                         E      at android.os.Looper.loop(Looper.java:304)
                         E      at android.app.ActivityThread.main(ActivityThread.java:7918)
                         E      at java.lang.reflect.Method.invoke(Native Method)
                         E      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
                         E      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1010)
```

Changelog: [Internal]

Reviewed By: fabriziocucci

Differential Revision: D61332854

fbshipit-source-id: 48409e2b93abf15e846620580d1f0d07a2e75025
…ds (facebook#46024)

Summary:
Pull Request resolved: facebook#46024

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D61298649

fbshipit-source-id: 16ee8084fa31297ee12db26ee86254eed6da248f
Summary:
Pull Request resolved: facebook#45985

As title.

We can now create ellipses when using percentages. The algorithm for this is still flawed and to get it to be a 1:1 to web it will probably require a re-write of some of the logic but this should get us closer for now.

Some examples:

1. Border thinning on large single corner radii (100%)
 {F1798145800}
2. Thinning gets worse when having irregular border colors (100%)
 {F1798148002}

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D61025927

fbshipit-source-id: 218d44af014bc8351c329ff1bca82658aebac38c
)

Summary:
Referring to the [iOS Large Content Viewer](https://developer.apple.com/videos/play/wwdc2019/261/):
iOS Tab Bars can't grow with dynamic text, but the Large Content Viewer helps them to be seen by people with low vision.

Currently on React Native we don't expose the properties that can help implementing iOS [UILargeContentViewerItem](https://developer.apple.com/documentation/uikit/uilargecontentvieweritem) protocol.
The goal of this PR is to expose the necessary props.

In this PR, I'm exposing 2 props:
- `accessibilityShowsLargeContentViewer`: to enable the large content viewer
- `accessibilityLargeContentTitle`: to define the large content viewer title

I plan to use this to open a PR on react-navigation so that bottom tabbars can implement largeContentViewer.
Should fix facebook#30892

## Changelog:
[IOS] [ADDED] - Support LargeContentViewer on iOS for better accessibility

Pull Request resolved: facebook#45903

Test Plan: <img width="300" src="https://github.com/user-attachments/assets/d8f1dc46-66e7-4945-bc3b-f1d29044441b" />

Reviewed By: cipolleschi

Differential Revision: D61148361

Pulled By: joevilches

fbshipit-source-id: 86dd92f4f79534a58e6e015febdaf217ea291eb4
yungsters and others added 19 commits September 6, 2024 12:15
Summary:
Pull Request resolved: facebook#46312

Refactors `NativeAnimatedHelper` to make it easier to read, reduce runtime overhead, and no longer export `queueOperation` (which was not useable externally anyway).

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D62139993

fbshipit-source-id: ce75e530887da6290f26060ecfe36049cf81879a
Summary:
Pull Request resolved: facebook#46286

Optimizes the runtime performance of `Animated` by using memoization to avoid repetitive traversals of `props` (and `style`) values.

Changelog:
[General][Changed] - Improved runtime performance of `Animated`

Reviewed By: javache

Differential Revision: D62037506

fbshipit-source-id: b0202f02c87466e1cef61b841de7e861a0ecae4e
Summary:
Currently, `AnimatedNode.prototype.getListeners` creates an array with `Object.keys()` to determine the number of listeners.

This is a relatively hot code path for animation-intensive user interfaces. Although `Object.keys()` is fast, every unnecessary memory allocation is an unnecessary opportunity to create garbage that requires collection.

Using an object as a dictionary performs worst than using a `Map` anyway, so this switches `AnimatedNode` to use a `Map`.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D62267352

fbshipit-source-id: 8629861a64109a3a711c0f66a345029d0bfcd440
Summary:
Pull Request resolved: facebook#46370

Add a function to write the current trace contents to a file. To be used by the upcoming Perfetto data source while we wait for devtools to work in a profiling build.

Reviewed By: rubennorte

Differential Revision: D62262985

fbshipit-source-id: 04789f5312721434c773e51b3da333498bf0e786
…lobalModuleMap` (facebook#46360)

Summary:
Reverts the PR facebook#45967 from philIip to bring back the `registerCxxModuleToGlobalModuleMap(..)` function, which I use in Nitro Modules and MMKV.

Ontop of that, this also removes the "experimental" `RCT_EXPORT_CXX_MODULE_EXPERIMENTAL` macro, which I think was the original intent of this PR as this macro is a bit unsafe.

I also added some small docs to `registerCxxModuleToGlobalModuleMap` while I'm at it.

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[GENERAL] [CHANGED] - Bring back CxxTurboModule autolinking function, but remove `RCT_EXPORT_CXX_MODULE_EXPERIMENTAL` macro

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests

Pull Request resolved: facebook#46360

Test Plan: Build Nitro Modules. Worked for me! :)

Reviewed By: realsoelynn

Differential Revision: D62310637

Pulled By: philIip

fbshipit-source-id: 2caa2b8ea094dda5e13c81431a9a645cbcf8f807
…cebook#46274)

Summary:
Pull Request resolved: facebook#46274

changelog: [General][Add] - Add E2E test cases for Flat/SectionList to RNTester

Reviewed By: philIip

Differential Revision: D62002065

fbshipit-source-id: 038907cd7afd33505b7599e390cb9f366b7b32f6
Summary:
Pull Request resolved: facebook#46326

- renaming variabled to make intent more clear
    - `dialog` -> `dialogWindow` to distinguish with `activity.window`
    - `hostView` -> `dialogRootViewGroup` as name was confusing.
        - `ReactModalHostView` creates and manages `DialogRootViewGroup` but it used as contentView for the Dialog.
- bug fixes

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D62177564

fbshipit-source-id: f81b167c1a234c02617ec2a3d63979628e01063b
…6359)

Summary:
Pull Request resolved: facebook#46359

Remove unneeded code around size calculation and old arch support
- updateState was getting called unnecessarily in multiple places --> only call from onSizeChanged()
    - this is a reliable source for getting the content size area of the dialog used for Modal
     - remove code checking duplicated update
- Old architecture cleanup
    - Remove Java implementation of ShadowNode
      - we already have logic to set the node size via UIManagerModule::updateNodeSize(). This  code is now group together in updateState() for both new and old architecture

This fixes issues with resulting from wrong size calculation:
- having gaps at bottom when we set `statusBarTranslucent` to `true`
- Modal cut off at bottom on Android 15 (drawn under bottom nav bar)

Changelog:
[Android][Fixed] - Modal statusBarTranslucent bug, Modal at bottom being cut off in Android 15 (without forced edge-to-edge)
[Android][Deprecation] - Deprecating ModalHostShadowNode and ModalHostHelper classes

Reviewed By: mdvacca

Differential Revision: D62286026

fbshipit-source-id: 03b64a7783c12bebd1457c86a9a2657adc882c79
Summary:
This PR bumps Socket Rocket to 0.7.1, this release brings some new improvements and visionOS support. I've also moved the version to a constant.

## Changelog:

[INTERNAL] [CHANGED] - Bump SocketRocket to 0.7.1

Pull Request resolved: facebook#46300

Test Plan: CI Green

Reviewed By: cortinico, cipolleschi

Differential Revision: D62294833

Pulled By: blakef

fbshipit-source-id: 0e45c7de041710fb1f500b0ac23898b68a8a8936
…e_post_install script (facebook#46262)

Summary:
In a react native project where USE_FRAMEWORKS is not nil, every time when running `pod install`, duplicate lines are added to `HEADER_SEARCH_PATHS` section of `project.pbxproj`:

```
" ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
```

Note: a popular library that needs `use_frameworks` is react-native-firebase.
See https://rnfirebase.io/#altering-cocoapods-to-use-frameworks

## Analyse

- `react_native_post_install` calls `ReactNativePodsUtils.update_search_paths(installer)`
- when `ENV['USE_FRAMEWORKS'] != nil` then `update_search_paths` calls `add_search_path_if_not_included`
- `add_search_path_if_not_included` checks if `"#{new_search_path}"` is already there
- if not found it adds `" #{new_search_path}"` _with an extra space_
- next time, it can't find `"#{new_search_path}"` because of the extra space, and adds `" #{new_search_path}"` again

## Changelog:

[IOS] [FIXED] - react_native_post_install script no longer adds duplicate entries to HEADER_SEARCH_PATHS

Pull Request resolved: facebook#46262

Test Plan:
- create a react native project
- add `use_frameworks! :linkage => :static` to `ios/Podfile` (just before `use_react_native`)
- run `pod install`
- assert no duplicate lines are added to HEADER_SEARCH_PATHS of file `project.pbxproj`

Reviewed By: cipolleschi

Differential Revision: D61982680

Pulled By: shwanton

fbshipit-source-id: 61b566893c551d0813edd6eec2f8352c041c748f
Summary:
When creating Hermes in CI, we build it for MacOS and Mac Catalyst as well.
The slices for these platforms requires symlinks to work properly.
The upload artifacts action on github, when applied to folders, follows the symlinks and copies the destination folder. The result is that Hermes for macOS and Catalyst does not work as expected.

This should fix facebook#46213.

## Changelog:
[Internal] - Build Hermes in CI properly

Pull Request resolved: facebook#46387

Test Plan: Tested already in 0.75

Reviewed By: robhogan

Differential Revision: D62355050

Pulled By: cipolleschi

fbshipit-source-id: 7abb85c8a2a88f13e06a49c6cb0caccbdad4551a
Summary:
Pull Request resolved: facebook#46390

As React Native's minSdkVersion is not 24, clean up version checks and code that is using deprecated version from OSS

Changelog:
[Internal] - code cleanup for minSdkVersion 24

Reviewed By: philIip

Differential Revision: D62362059

fbshipit-source-id: a851d0908d4175269524f41955acca5f2da69cad
Summary:
Pull Request resolved: facebook#46391

**Issue:**
RedBox displays early error before JS Error handling is properly setup.
On Android 15, targetSdk 35 (forced edge-to-edge), dialog overlaps with system bars making it difficult to use.

**Solution**
Add inset based margins so content does not overlap with system bars.

Changelog:
[Android][Fixed] - RedBox content overlapping with system bars on Android 15 forced edge-to-edge

Reviewed By: fkgozali

Differential Revision: D62362105

fbshipit-source-id: 57f60222914d407ebdcfd0359dbdf3ac36bde8f5
…k#46228)

Summary:
This PR exposes the `newArchEnabled` flag and deprecates all of the separate methods to enable new architecture.

As discussed with cipolleschi here: react-native-community/template#45 (comment)

## Changelog:

[IOS] [DEPRECATED] - Deprecate turboModuleEnabled, fabricEnabled, bridgelessEnabled
[IOS] [ADDED] - Add newArchEnabled method to RCTAppDelegate

Pull Request resolved: facebook#46228

Test Plan: Test if switching newArchEnabled flag from AppDelegate works.

Reviewed By: cortinico

Differential Revision: D61849385

Pulled By: cipolleschi

fbshipit-source-id: 8acf718386882679f00d2d5000b4432a523b34ac
Summary:
Bumps the CLI to the next version

## Changelog:
[General][Changed] - Bump cli dependencies to 15.0.0-alpha.2

Pull Request resolved: facebook#46394

Test Plan: CI

Reviewed By: huntie

Differential Revision: D62375405

Pulled By: cipolleschi

fbshipit-source-id: fec99216bc7ad6decfd83840091d807f603184da
…acebook#46017)

Summary:
I'm able to reproduce a case when Appearance module methods are called in the following order:

starting point: dark mode enabled
1. call `setColorScheme` light
2. call `getColorScheme`, which sets `colorScheme` to light [here](https://github.com/facebook/react-native/blob/7bb7a6037bd78bbfa6d9e8499973ea921e9c70e1/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/appearance/AppearanceModule.kt#L57)
3. [onConfigurationChanged](https://github.com/facebook/react-native/blob/7bb7a6037bd78bbfa6d9e8499973ea921e9c70e1/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/appearance/AppearanceModule.kt#L82) is called but `if (colorScheme != newColorScheme)` does not evaluate to true, so no event is dispatched to JS. That means JS is not in sync with the native state.

The issue was the `getColorScheme` had a side-effect of setting `colorScheme` private member (not sure what its use was). The fix remembers the last emitted color scheme value and emits event if new value is different.

## Changelog:

[ANDROID] [FIXED] - ensure Appearance change listener does not skip events

Pull Request resolved: facebook#46017

Test Plan: tested locally with RN tester

Reviewed By: NickGerleman

Differential Revision: D62016949

Pulled By: cipolleschi

fbshipit-source-id: b7b5755d38becda655cf376749d9a996daff7e07
…6307)

Summary:
Pull Request resolved: facebook#46307

Changelog:
[General][Breaking] - Remove Inspector Panel perf + network tabs  under New Arch (see react-native-community/discussions-and-proposals#777)

Reviewed By: christophpurrer

Differential Revision: D62123634

fbshipit-source-id: 44ecc476943ccb33f8de96dcefa3e233e954841a
…ods (facebook#46393)

Summary:
Pull Request resolved: facebook#46393

> [!Note]
> Replaces facebook#46282.

We intended to enable Fusebox on `main` since facebook#45469 — this worked when building under Buck, however was not working for builds under Xcode. This is because the `HERMES_ENABLE_DEBUGGER` preprocessor flag was missing for the `React-jsinspector` Podspec.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D62375148

fbshipit-source-id: 5d4d243d0a2cb7796fdf59d57086a0cb966639c7
Summary:
Pull Request resolved: facebook#46395

Enable React Native Devtools in Android OSS debug builds

Changelog:
[Android][Added] Enable React Native DevTools in OSS debug builds

Reviewed By: huntie

Differential Revision: D62376708

fbshipit-source-id: b5f98d003fee224930c0b8df1455be962e56d245
@@ -1 +1 @@
import*as e from"../../../../core/common/common.js";import*as t from"../../../../core/host/host.js";import*as n from"../../../../core/i18n/i18n.js";import*as i from"../../../../core/platform/platform.js";import*as o from"../../../../core/sdk/sdk.js";import*as r from"../../../../models/bindings/bindings.js";import*as a from"../../../visual_logging/visual_logging.js";import*as s from"../../legacy.js";import*as c from"../../../../models/breakpoints/breakpoints.js";import*as l from"../../../../models/text_utils/text_utils.js";import*as d from"../../../../models/workspace/workspace.js";const u=new CSSStyleSheet;u.replaceSync(".image-preview-container{background:transparent;text-align:center;border-spacing:0}.image-preview-container img{margin:6px 0;max-width:100px;max-height:100px;background-image:var(--image-file-checker);user-select:text;vertical-align:top;-webkit-user-drag:auto}.image-container{padding:0}.image-container > div{min-height:50px;display:flex;align-items:center;justify-content:center;cursor:pointer}.image-preview-container .row{line-height:1.2;vertical-align:baseline}.image-preview-container .title{padding-right:0.5em;text-align:right;color:var(--sys-color-token-subtle);white-space:nowrap}.image-preview-container .description{white-space:nowrap;text-align:left;color:var(--sys-color-on-surface)}.image-preview-container .description-link{max-width:20em}.image-preview-container .source-link{white-space:normal;word-break:break-all;color:var(--sys-color-primary);cursor:pointer}\n/*# sourceURL=imagePreview.css */\n");const p={unknownSource:"unknown source",imageFromS:"Image from {PH1}",fileSize:"File size:",intrinsicSize:"Intrinsic size:",renderedSize:"Rendered size:",currentSource:"Current source:",renderedAspectRatio:"Rendered aspect ratio:",intrinsicAspectRatio:"Intrinsic aspect ratio:"},g=n.i18n.registerUIStrings("ui/legacy/components/utils/ImagePreview.ts",p),m=n.i18n.getLocalizedString.bind(void 0,g);function h(t){return null!==t&&t.resourceType()===e.ResourceType.resourceTypes.Image}var k=Object.freeze({__proto__:null,ImagePreview:class{static async build(e,n,r,a={precomputedFeatures:void 0,imageAltText:void 0}){const{precomputedFeatures:s,imageAltText:c}=a,l=e.model(o.ResourceTreeModel.ResourceTreeModel);if(!l)return null;let d=l.resourceForURL(n),g=n;if(!h(d)&&s&&s.currentSrc&&(g=s.currentSrc,d=l.resourceForURL(g)),!d||!h(d))return null;const k=d,L=d.displayName,b=d.content?d.content:d.url.split("base64,")[1],f=d.contentSize(),C=f||i.StringUtilities.base64ToSize(b),v=C>0?i.NumberUtilities.bytesToString(C):"";return new Promise((e=>{const n=document.createElement("img");n.addEventListener("load",(function(){const o=document.createElement("div"),a=o.attachShadow({mode:"open"});a.adoptedStyleSheets=[u];const c=a.createChild("table");c.className="image-preview-container";const l=c.createChild("tr").createChild("td","image-container");l.colSpan=2;const d=l.createChild("div");d.title=L,d.appendChild(n),d.addEventListener("click",(()=>{t.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(g)}));const h=n.naturalWidth,k=n.naturalHeight,b=s?s.renderedWidth:h,f=s?s.renderedHeight:k;if(r){const e=c.createChild("tr","row");e.createChild("td","title").textContent=m(p.renderedSize),e.createChild("td","description").textContent=`${b} × ${f} px`;const t=c.createChild("tr","row");if(t.createChild("td","title").textContent=m(p.renderedAspectRatio),t.createChild("td","description").textContent=i.NumberUtilities.aspectRatio(b,f),f!==k||b!==h){const e=c.createChild("tr","row");e.createChild("td","title").textContent=m(p.intrinsicSize),e.createChild("td","description").textContent=`${h} × ${k} px`;const t=c.createChild("tr","row");t.createChild("td","title").textContent=m(p.intrinsicAspectRatio),t.createChild("td","description").textContent=i.NumberUtilities.aspectRatio(h,k)}}const C=c.createChild("tr","row");C.createChild("td","title").textContent=m(p.fileSize),C.createChild("td","description").textContent=v;const w=c.createChild("tr","row");w.createChild("td","title").textContent=m(p.currentSource);const I=i.StringUtilities.trimMiddle(g,100),S=w.createChild("td","description description-link").createChild("span","source-link");S.textContent=I,S.addEventListener("click",(()=>{t.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(g)})),e(o)}),!1),n.addEventListener("error",(()=>e(null)),!1),c&&(n.alt=c),k.populateImageSource(n)}))}static async loadDimensionsForNode(e){if(!e.nodeName()||"img"!==e.nodeName().toLowerCase())return;const t=await e.resolveToObject("");if(!t)return;const n=await t.callFunctionJSON((function(){return{renderedWidth:this.width,renderedHeight:this.height,currentSrc:this.currentSrc}}),void 0);return t.release(),n}static defaultAltTextForImageURL(t){const n=new e.ParsedURL.ParsedURL(t),i=n.isValid?n.displayName:m(p.unknownSource);return m(p.imageFromS,{PH1:i})}}});const L=new CSSStyleSheet;L.replaceSync(":host{display:inline-block;width:100%}.stack-preview-async-description{padding:3px 0 1px;font-style:italic}.stack-preview-container{display:block;width:100%}.stack-preview-container .ignore-list-link{opacity:60%}.stack-preview-container > tr{height:16px;line-height:16px}.stack-preview-container td{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-inline:2px}.stack-preview-container td.link{width:100%;max-width:0}.stack-preview-container .function-name{max-width:80em}.stack-preview-container:not(.show-hidden-rows) > tr.hidden-row{display:none}.stack-preview-container > tr.show-all-link,\n.stack-preview-container > tr.show-less-link{font-style:italic}.stack-preview-container.show-hidden-rows > tr.show-all-link{display:none}.stack-preview-container:not(.show-hidden-rows) > tr.show-less-link{display:none}\n/*# sourceURL=jsUtils.css */\n");const b={unknown:"(unknown)",auto:"auto",revealInS:"Reveal in {PH1}",reveal:"Reveal",openUsingS:"Open using {PH1}",linkHandling:"Link handling:"},f=n.i18n.registerUIStrings("ui/legacy/components/utils/Linkifier.ts",b),C=n.i18n.getLocalizedString.bind(void 0,f),v=new Set;let w=null;const I=new WeakMap,S=new WeakMap,x=new WeakMap,y=new Map;let T,U;class N extends e.ObjectWrapper.ObjectWrapper{maxLength;anchorsByTarget;locationPoolByTarget;useLinkDecorator;constructor(e,t){super(),this.maxLength=e||s.UIUtils.MaxLengthForDisplayedURLs,this.anchorsByTarget=new Map,this.locationPoolByTarget=new Map,this.useLinkDecorator=Boolean(t),v.add(this),o.TargetManager.TargetManager.instance().observeTargets(this)}static setLinkDecorator(e){console.assert(!w,"Cannot re-register link decorator."),w=e,e.addEventListener("LinkIconChanged",(function(e){const t=e.data,n=I.get(t)||[];for(const e of n)N.updateLinkDecorations(e)}));for(const e of v)e.updateAllAnchorDecorations()}updateAllAnchorDecorations(){for(const e of this.anchorsByTarget.values())for(const t of e)N.updateLinkDecorations(t)}static bindUILocation(e,t){const n=N.linkInfo(e);if(!n)return;if(n.uiLocation=t,!t)return;const i=t.uiSourceCode;let o=I.get(i);o||(o=new Set,I.set(i,o)),o.add(e)}static unbindUILocation(e){const t=N.linkInfo(e);if(!t||!t.uiLocation)return;const n=t.uiLocation.uiSourceCode;t.uiLocation=null;const i=I.get(n);i&&i.delete(e)}static bindBreakpoint(e,t){const n=N.linkInfo(e);if(!n)return;const i=c.BreakpointManager.BreakpointManager.instance().findBreakpoint(t);i&&(n.revealable=i)}static unbindBreakpoint(e){const t=N.linkInfo(e);t&&t.revealable&&(t.revealable=null)}targetAdded(e){this.anchorsByTarget.set(e,[]),this.locationPoolByTarget.set(e,new r.LiveLocation.LiveLocationPool)}targetRemoved(e){const t=this.locationPoolByTarget.get(e);if(this.locationPoolByTarget.delete(e),!t)return;t.disposeAll();const n=this.anchorsByTarget.get(e);if(n){this.anchorsByTarget.delete(e);for(const e of n){const t=N.linkInfo(e);if(!t)continue;t.liveLocation=null,N.unbindUILocation(e);const n=t.fallback;n&&e.replaceWith(n)}}}maybeLinkifyScriptLocation(e,t,n,i,a){let s=null;const c={lineNumber:i,maxLength:this.maxLength,columnNumber:a?.columnNumber,showColumnNumber:Boolean(a?.showColumnNumber),className:a?.className,tabStop:a?.tabStop,inlineFrameIndex:a?.inlineFrameIndex??0,userMetric:a?.userMetric},{columnNumber:l,className:d=""}=c;if(n&&(s=N.linkifyURL(n,c)),!e||e.isDisposed())return s;const u=e.model(o.DebuggerModel.DebuggerModel);if(!u)return s;const p=t?u.createRawLocationByScriptId(t,i||0,l,c.inlineFrameIndex):u.createRawLocationByURL(n,i||0,l,c.inlineFrameIndex);if(!p)return s;const g={tabStop:a?.tabStop},{link:m,linkInfo:h}=N.createLink(s&&s.textContent?s.textContent:"",d,g);h.enableDecorator=this.useLinkDecorator,h.fallback=s,h.userMetric=a?.userMetric;const k=this.locationPoolByTarget.get(p.debuggerModel.target());if(!k)return s;const L={showColumnNumber:c.showColumnNumber??!1,revealBreakpoint:a?.revealBreakpoint};r.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance().createLiveLocation(p,(async e=>{await this.updateAnchor(m,L,e),this.dispatchEventToListeners("liveLocationUpdated",e)}).bind(this),k).then((e=>{e&&(h.liveLocation=e)}));return this.anchorsByTarget.get(p.debuggerModel.target()).push(m),m}linkifyScriptLocation(e,t,n,i,o){const r=this.maybeLinkifyScriptLocation(e,t,n,i,o),a={lineNumber:i,maxLength:this.maxLength,className:o?.className,columnNumber:o?.columnNumber,showColumnNumber:Boolean(o?.showColumnNumber),inlineFrameIndex:o?.inlineFrameIndex??0,tabStop:o?.tabStop,userMetric:o?.userMetric};return r||N.linkifyURL(n,a)}linkifyRawLocation(e,t,n){return this.linkifyScriptLocation(e.debuggerModel.target(),e.scriptId,t,e.lineNumber,{columnNumber:e.columnNumber,className:n,inlineFrameIndex:e.inlineFrameIndex})}maybeLinkifyConsoleCallFrame(e,t,n){const i={...n,columnNumber:t.columnNumber,inlineFrameIndex:n?.inlineFrameIndex??0};return this.maybeLinkifyScriptLocation(e,t.scriptId,t.url,t.lineNumber,i)}linkifyStackTraceTopFrame(e,t){console.assert(t.callFrames.length>0);const{url:n,lineNumber:i,columnNumber:a}=t.callFrames[0],s=N.linkifyURL(n,{lineNumber:i,columnNumber:a,showColumnNumber:!1,inlineFrameIndex:0,maxLength:this.maxLength,preventClick:!0});if(!e)return s;const c=this.locationPoolByTarget.get(e);if(!c)return console.assert(e.isDisposed()),s;console.assert(!e.isDisposed());const l=e.model(o.DebuggerModel.DebuggerModel),{link:d,linkInfo:u}=N.createLink("","");u.enableDecorator=this.useLinkDecorator,u.fallback=s;const p={showColumnNumber:!1};r.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance().createStackTraceTopFrameLiveLocation(l.createRawLocationsByStackTrace(t),(async e=>{await this.updateAnchor(d,p,e),this.dispatchEventToListeners("liveLocationUpdated",e)}).bind(this),c).then((e=>{u.liveLocation=e}));return this.anchorsByTarget.get(e).push(d),d}linkifyCSSLocation(e,t){const{link:n,linkInfo:i}=N.createLink("",t||"",{tabStop:!0});i.enableDecorator=this.useLinkDecorator;const o=this.locationPoolByTarget.get(e.cssModel().target());if(!o)return n;const a={showColumnNumber:!1};r.CSSWorkspaceBinding.CSSWorkspaceBinding.instance().createLiveLocation(e,(async e=>{await this.updateAnchor(n,a,e),this.dispatchEventToListeners("liveLocationUpdated",e)}).bind(this),o).then((e=>{i.liveLocation=e}));return this.anchorsByTarget.get(e.cssModel().target()).push(n),n}reset(){for(const e of[...this.anchorsByTarget.keys()])this.targetRemoved(e),this.targetAdded(e)}dispose(){for(const e of[...this.anchorsByTarget.keys()])this.targetRemoved(e);o.TargetManager.TargetManager.instance().unobserveTargets(this),v.delete(this)}async updateAnchor(t,n,i){N.unbindUILocation(t),n.revealBreakpoint&&N.unbindBreakpoint(t);const o=await i.uiLocation();if(!o){if(i instanceof r.CSSWorkspaceBinding.LiveLocation){const n=i.header();n&&n.ownerNode&&(t.addEventListener("click",(t=>{t.consume(!0),e.Revealer.reveal(n.ownerNode||null)}),!1),N.setTrimmedText(t,"<style>"))}return t.classList.add("invalid-link"),void t.removeAttribute("role")}N.bindUILocation(t,o),n.revealBreakpoint&&N.bindBreakpoint(t,o);const a=o.linkText(!0,n.showColumnNumber);N.setTrimmedText(t,a,this.maxLength);let c=o.uiSourceCode.url();"application/wasm"===o.uiSourceCode.mimeType()?"number"==typeof o.columnNumber&&(c+=`:0x${o.columnNumber.toString(16)}`):(c+=":"+(o.lineNumber+1),n.showColumnNumber&&"number"==typeof o.columnNumber&&(c+=":"+(o.columnNumber+1))),s.Tooltip.Tooltip.install(t,c),t.classList.toggle("ignore-list-link",await i.isIgnoreListed()),N.updateLinkDecorations(t)}static updateLinkDecorations(e){const t=N.linkInfo(e);if(!t||!t.enableDecorator)return;if(!w||!t.uiLocation)return;t.icon&&t.icon.parentElement&&e.removeChild(t.icon);const n=w.linkIcon(t.uiLocation.uiSourceCode);n&&(n.style.setProperty("margin-right","2px"),e.insertBefore(n,e.firstChild)),t.icon=n}static linkifyURL(t,n){const i=(n=n||{showColumnNumber:!1,inlineFrameIndex:0}).text,o=n.className||"",a=n.lineNumber,c=n.columnNumber,l=n.showColumnNumber,d=n.preventClick,u=n.maxLength||s.UIUtils.MaxLengthForDisplayedURLs,p=n.bypassURLTrimming;if(!t||e.ParsedURL.schemeIs(t,"javascript:")){const e=document.createElement("span");return o&&(e.className=o),e.textContent=i||t||C(b.unknown),e}let g=i||r.ResourceUtils.displayNameForURL(t);"number"!=typeof a||i||(g+=":"+(a+1),l&&"number"==typeof c&&(g+=":"+(c+1)));const m={maxLength:u,title:g!==t?t:"",href:t,preventClick:d,tabStop:n.tabStop,bypassURLTrimming:p},{link:h,linkInfo:k}=N.createLink(g,o,m);return a&&(k.lineNumber=a),c&&(k.columnNumber=c),k.userMetric=n?.userMetric,h}static linkifyRevealable(e,t,n,i,o){const r={maxLength:s.UIUtils.MaxLengthForDisplayedURLs,href:n,title:i},{link:a,linkInfo:c}=N.createLink(t,o||"",r);return c.revealable=e,a}static createLink(e,t,n={}){const{maxLength:i,title:o,href:r,preventClick:a,tabStop:c,bypassURLTrimming:l}=n,d=document.createElement("button");t&&(d.className=t),d.classList.add("devtools-link","text-button","link-style"),o&&s.Tooltip.Tooltip.install(d,o),r&&(d.href=r),e instanceof HTMLElement?d.appendChild(e):l?(d.classList.add("devtools-link-styled-trim"),N.appendTextWithoutHashes(d,e)):N.setTrimmedText(d,e,i);const u={icon:null,enableDecorator:!1,uiLocation:null,liveLocation:null,url:r||null,lineNumber:null,columnNumber:null,inlineFrameIndex:0,revealable:null,fallback:null};return S.set(d,u),a?d.classList.add("devtools-link-prevent-click"):d.addEventListener("click",(e=>{N.handleClick(e)&&e.consume(!0)}),!1),s.ARIAUtils.markAsLink(d),d.tabIndex=c?0:-1,{link:d,linkInfo:u}}static setTrimmedText(e,t,n){if(e.removeChildren(),n&&t.length>n){const i=function(e,t){let n=Math.floor(t/2),i=e.length-Math.ceil(t/2)+1;const o=e.codePointAt(i-1);void 0!==o&&o>=65536&&(i++,n++);const r=e.codePointAt(n-1);void 0!==r&&n>0&&r>=65536&&n--;return[e.substring(0,n),e.substring(n,i),e.substring(i)]}(t,n);N.appendTextWithoutHashes(e,i[0]),N.appendHiddenText(e,i[1]),N.appendTextWithoutHashes(e,i[2])}else N.appendTextWithoutHashes(e,t)}static appendTextWithoutHashes(e,t){const n=l.TextUtils.Utils.splitStringByRegexes(t,[/[a-f0-9]{20,}/g]);for(const t of n)-1===t.regexIndex?s.UIUtils.createTextChild(e,t.value):(s.UIUtils.createTextChild(e,t.value.substring(0,7)),N.appendHiddenText(e,t.value.substring(7)))}static appendHiddenText(e,t){const n=s.UIUtils.createTextChild(e.createChild("span","devtools-link-ellipsis"),"…");x.set(n,t)}static untruncatedNodeText(e){return x.get(e)||e.textContent||""}static linkInfo(e){return e&&S.get(e)||null}static handleClick(e){const t=e.currentTarget;if(s.UIUtils.isBeingEdited(e.target)||t.hasSelection())return!1;const n=N.linkInfo(t);return!!n&&N.invokeFirstAction(n)}static handleClickFromNewComponentLand(e){N.invokeFirstAction(e)}static invokeFirstAction(e){const n=N.linkActions(e);return!!n.length&&(n[0].handler.call(null),e.userMetric&&t.userMetrics.actionTaken(e.userMetric),!0)}static linkHandlerSetting(){return T||(T=e.Settings.Settings.instance().createSetting("open-link-handler",C(b.auto))),T}static registerLinkHandler(e,t){y.set(e,t),F.instance().update()}static unregisterLinkHandler(e){y.delete(e),F.instance().update()}static uiLocation(e){const t=N.linkInfo(e);return t?t.uiLocation:null}static linkActions(n){const o=[];if(!n)return o;let a=i.DevToolsPath.EmptyUrlString,l=null;if(n.uiLocation)l=n.uiLocation,a=l.uiSourceCode.contentURL();else if(n.url){a=n.url;const t=d.Workspace.WorkspaceImpl.instance().uiSourceCodeForURL(a)||d.Workspace.WorkspaceImpl.instance().uiSourceCodeForURL(e.ParsedURL.ParsedURL.urlWithoutHash(a));l=t?t.uiLocation(n.lineNumber||0,n.columnNumber||0):null}const u=a?r.ResourceUtils.resourceForURL(a):null,p=l?l.uiSourceCode:u,g=n.revealable||l||u;if(g){const n=e.Revealer.revealDestination(g);o.push({section:"reveal",title:n?C(b.revealInS,{PH1:n}):C(b.reveal),jslogContext:"reveal",handler:()=>(g instanceof c.BreakpointManager.BreakpointLocation&&t.userMetrics.breakpointEditDialogRevealedFrom(5),e.Revealer.reveal(g))})}if(p){const e=l?l.lineNumber:n.lineNumber||0;for(const t of y.keys()){const n=y.get(t);if(!n)continue;const i={section:"reveal",title:C(b.openUsingS,{PH1:t}),jslogContext:"open-using",handler:n.bind(null,p,e)};t===N.linkHandlerSetting().get()?o.unshift(i):o.push(i)}}if((u||n.url)&&(o.push({section:"reveal",title:s.UIUtils.openLinkExternallyLabel(),jslogContext:"open-in-new-tab",handler:()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(a)}),o.push({section:"clipboard",title:s.UIUtils.copyLinkAddressLabel(),jslogContext:"copy-link-address",handler:()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(a)})),l&&l.uiSourceCode){const e=l.uiSourceCode;o.push({section:"clipboard",title:s.UIUtils.copyFileNameLabel(),jslogContext:"copy-file-name",handler:()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(e.displayName())})}return o}}class F{element;constructor(){this.element=document.createElement("select"),this.element.classList.add("chrome-select"),this.element.addEventListener("change",this.onChange.bind(this),!1),this.update()}static instance(e={forceNew:null}){const{forceNew:t}=e;return U&&!t||(U=new F),U}update(){this.element.removeChildren();const e=[...y.keys()];e.unshift(C(b.auto));for(const t of e){const e=document.createElement("option");e.textContent=t,e.selected=t===N.linkHandlerSetting().get(),this.element.appendChild(e)}this.element.disabled=e.length<=1}onChange(e){if(!e.target)return;const t=e.target.value;N.linkHandlerSetting().set(t)}settingElement(){return s.SettingsUI.createCustomSetting(C(b.linkHandling),this.element)}}let D=!1;D||(D=!0,window.addEventListener("linkifieractivated",(function(e){const t=e;N.handleClickFromNewComponentLand(t.data)})));var R=Object.freeze({__proto__:null,Linkifier:N,LinkContextMenuProvider:class{appendApplicableItems(e,t,n){let i=n;for(;i&&!S.get(i);)i=i.parentNodeOrShadowHost();const o=i,r=N.linkInfo(o);if(!r)return;const a=N.linkActions(r);for(const e of a)t.section(e.section).appendItem(e.title,e.handler,{jslogContext:e.jslogContext})}},LinkHandlerSettingUI:F,ContentProviderContextMenuProvider:class{appendApplicableItems(n,i,r){const a=r.contentURL();if(a){e.ParsedURL.schemeIs(a,"file:")||i.revealSection().appendItem(s.UIUtils.openLinkExternallyLabel(),(()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(a.endsWith(":formatted")?e.ParsedURL.ParsedURL.slice(a,0,a.lastIndexOf(":")):a)),{jslogContext:"open-in-new-tab"});for(const e of y.keys()){const t=y.get(e);t&&i.revealSection().appendItem(C(b.openUsingS,{PH1:e}),t.bind(null,r,0),{jslogContext:"open-using"})}r instanceof o.NetworkRequest.NetworkRequest||(i.clipboardSection().appendItem(s.UIUtils.copyLinkAddressLabel(),(()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(a)),{jslogContext:"copy-link-address"}),r instanceof d.UISourceCode.UISourceCode?i.clipboardSection().appendItem(s.UIUtils.copyFileNameLabel(),(()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(r.displayName())),{jslogContext:"copy-file-name"}):i.clipboardSection().appendItem(s.UIUtils.copyFileNameLabel(),(()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(r.displayName)),{jslogContext:"copy-file-name"}))}}}});const M={removeFromIgnore:"Remove from ignore list",addToIgnore:"Add script to ignore list",showSMoreFrames:"{n, plural, =1 {Show # more frame} other {Show # more frames}}",showLess:"Show less",unknownSource:"unknown"},H=n.i18n.registerUIStrings("ui/legacy/components/utils/JSPresentationUtils.ts",M),B=n.i18n.getLocalizedString.bind(void 0,H);function P(e,t){const n=new s.ContextMenu.ContextMenu(t);t.consume(!0);const i=N.uiLocation(e);i&&r.IgnoreListManager.IgnoreListManager.instance().canIgnoreListUISourceCode(i.uiSourceCode)&&(r.IgnoreListManager.IgnoreListManager.instance().isUserIgnoreListedURL(i.uiSourceCode.url())?n.debugSection().appendItem(B(M.removeFromIgnore),(()=>r.IgnoreListManager.IgnoreListManager.instance().unIgnoreListUISourceCode(i.uiSourceCode)),{jslogContext:"remove-from-ignore-list"}):n.debugSection().appendItem(B(M.addToIgnore),(()=>r.IgnoreListManager.IgnoreListManager.instance().ignoreListUISourceCode(i.uiSourceCode)),{jslogContext:"add-to-ignore-list"})),n.appendApplicableItems(t),n.show()}function A(t,n,i,c,l){const d=[];if(l){const t=new e.Throttler.Throttler(100);i.addEventListener("liveLocationUpdated",(()=>{t.schedule((async()=>function(e,t){let n=0,i=t.length;for(let e=t.length-1;e>=0;e--){const o=t[e];if("link"in o&&o.link){const e=N.uiLocation(o.link);e&&r.IgnoreListManager.IgnoreListManager.instance().isUserOrSourceMapIgnoreListedUISourceCode(e.uiSourceCode)&&(o.ignoreListHide=!0),o.ignoreListHide&&n++}"asyncDescription"in o&&(n>0&&n===i-e-1&&(o.ignoreListHide=!0),i=e,n=0)}e(t)}(l,d)))}))}function u(e,t=void 0){let l=null;t&&(l={asyncDescription:s.UIUtils.asyncStackTraceLabel(e.description,t),ignoreListHide:!1},d.push(l));let u=0,p=!1;for(const t of e.callFrames){let e=!1;const l=s.UIUtils.beautifyFunctionName(t.functionName),g=i.maybeLinkifyConsoleCallFrame(n,t,{tabStop:Boolean(c),inlineFrameIndex:0,revealBreakpoint:p});if(g){g.setAttribute("jslog",`${a.link("stack-trace").track({click:!0})}`),g.addEventListener("contextmenu",P.bind(null,g));const t=N.uiLocation(g);t&&r.IgnoreListManager.IgnoreListManager.instance().isUserOrSourceMapIgnoreListedUISourceCode(t.uiSourceCode)&&(e=!0),g.textContent||(g.textContent=B(M.unknownSource))}e&&++u,d.push({functionName:l,link:g,ignoreListHide:e}),p=[o.DebuggerModel.COND_BREAKPOINT_SOURCE_URL,o.DebuggerModel.LOGPOINT_SOURCE_URL].includes(t.url)}l&&u>0&&u===e.callFrames.length&&(l.ignoreListHide=!0)}u(t);let p=t.callFrames;for(let e=t.parent;e;e=e.parent)e.callFrames.length&&u(e,p),p=e.callFrames;return d}function j(e,t){e.removeChildren();let n=0;const i=[];for(const o of t){const t=e.createChild("tr");"asyncDescription"in o?(t.createChild("td").textContent="\n",t.createChild("td","stack-preview-async-description").textContent=o.asyncDescription,t.createChild("td"),t.createChild("td")):(t.createChild("td").textContent="\n",t.createChild("td","function-name").textContent=o.functionName,t.createChild("td").textContent=" @ ",o.link&&(t.createChild("td","link").appendChild(o.link),i.push(o.link)),o.ignoreListHide&&++n),o.ignoreListHide&&t.classList.add("hidden-row"),e.appendChild(t)}if(n){const t=e.createChild("tr","show-all-link");t.createChild("td").textContent="\n";const i=t.createChild("td");i.colSpan=4;const o=i.createChild("span","link");o.textContent=B(M.showSMoreFrames,{n:n}),o.addEventListener("click",(()=>{e.classList.add("show-hidden-rows"),s.GlassPane.GlassPane.containerMoved(e)}),!1);const r=e.createChild("tr","show-less-link");r.createChild("td").textContent="\n";const a=r.createChild("td");a.colSpan=4;const c=a.createChild("span","link");c.textContent=B(M.showLess),c.addEventListener("click",(()=>{e.classList.remove("show-hidden-rows"),s.GlassPane.GlassPane.containerMoved(e)}),!1)}return i}var E=Object.freeze({__proto__:null,buildStackTraceRows:A,buildStackTracePreviewContents:function(e,t,n={stackTrace:void 0,tabStops:void 0}){const{stackTrace:i,tabStops:o}=n,r=document.createElement("span");r.classList.add("monospace"),r.classList.add("stack-preview-container"),r.style.display="inline-block";const a=s.Utils.createShadowRootWithCoreStyles(r,{cssFile:[L],delegatesFocus:void 0}).createChild("table","stack-preview-container");if(!i)return{element:r,links:[]};const c=j.bind(null,a);return{element:r,links:j(a,A(i,e,t,o,c))}}});var _=Object.freeze({__proto__:null,reload:function(){s.DockController.DockController.instance().canDock()&&"undocked"===s.DockController.DockController.instance().dockSide()&&t.InspectorFrontendHost.InspectorFrontendHostInstance.setIsDocked(!0,(function(){})),t.InspectorFrontendHost.InspectorFrontendHostInstance.reattach((()=>window.location.reload()))}});const W={websocketDisconnected:"WebSocket disconnected"},z=n.i18n.registerUIStrings("ui/legacy/components/utils/TargetDetachedDialog.ts",W),O=n.i18n.getLocalizedString.bind(void 0,z);class $ extends o.SDKModel.SDKModel{static hideCrashedDialog;constructor(e){super(e),e.registerInspectorDispatcher(this),e.inspectorAgent().invoke_enable(),e.parentTarget()?.type()===o.Target.Type.Browser&&$.hideCrashedDialog&&($.hideCrashedDialog.call(null),$.hideCrashedDialog=null)}detached({reason:e}){s.RemoteDebuggingTerminatedScreen.RemoteDebuggingTerminatedScreen.show(e)}static webSocketConnectionLost(){s.RemoteDebuggingTerminatedScreen.RemoteDebuggingTerminatedScreen.show(O(W.websocketDisconnected))}targetCrashed(){if($.hideCrashedDialog)return;const e=this.target().parentTarget();if(e&&e.type()!==o.Target.Type.Browser)return;const t=new s.Dialog.Dialog("target-crashed");t.setSizeBehavior("MeasureContent"),t.addCloseButton(),t.setDimmed(!0),$.hideCrashedDialog=t.hide.bind(t),new s.TargetCrashedScreen.TargetCrashedScreen((()=>{$.hideCrashedDialog=null})).show(t.contentElement),t.show()}targetReloadedAfterCrash(){this.target().runtimeAgent().invoke_runIfWaitingForDebugger(),$.hideCrashedDialog&&($.hideCrashedDialog.call(null),$.hideCrashedDialog=null)}}o.SDKModel.SDKModel.register($,{capabilities:2048,autostart:!0});var G=Object.freeze({__proto__:null,TargetDetachedDialog:$});export{k as ImagePreview,E as JSPresentationUtils,R as Linkifier,_ as Reload,G as TargetDetachedDialog};
import*as e from"../../../../core/common/common.js";import*as t from"../../../../core/host/host.js";import*as n from"../../../../core/i18n/i18n.js";import*as i from"../../../../core/platform/platform.js";import*as o from"../../../../core/sdk/sdk.js";import*as r from"../../../../models/bindings/bindings.js";import*as a from"../../../visual_logging/visual_logging.js";import*as s from"../../legacy.js";import*as c from"../../../../models/breakpoints/breakpoints.js";import*as l from"../../../../models/text_utils/text_utils.js";import*as d from"../../../../models/workspace/workspace.js";const u=new CSSStyleSheet;u.replaceSync(".image-preview-container{background:transparent;text-align:center;border-spacing:0}.image-preview-container img{margin:6px 0;max-width:100px;max-height:100px;background-image:var(--image-file-checker);user-select:text;vertical-align:top;-webkit-user-drag:auto}.image-container{padding:0}.image-container > div{min-height:50px;display:flex;align-items:center;justify-content:center;cursor:pointer}.image-preview-container .row{line-height:1.2;vertical-align:baseline}.image-preview-container .title{padding-right:0.5em;text-align:right;color:var(--sys-color-token-subtle);white-space:nowrap}.image-preview-container .description{white-space:nowrap;text-align:left;color:var(--sys-color-on-surface)}.image-preview-container .description-link{max-width:20em}.image-preview-container .source-link{white-space:normal;word-break:break-all;color:var(--sys-color-primary);cursor:pointer}\n/*# sourceURL=imagePreview.css */\n");const p={unknownSource:"unknown source",imageFromS:"Image from {PH1}",fileSize:"File size:",intrinsicSize:"Intrinsic size:",renderedSize:"Rendered size:",currentSource:"Current source:",renderedAspectRatio:"Rendered aspect ratio:",intrinsicAspectRatio:"Intrinsic aspect ratio:"},g=n.i18n.registerUIStrings("ui/legacy/components/utils/ImagePreview.ts",p),m=n.i18n.getLocalizedString.bind(void 0,g);function h(t){return null!==t&&t.resourceType()===e.ResourceType.resourceTypes.Image}var k=Object.freeze({__proto__:null,ImagePreview:class{static async build(e,n,r,a={precomputedFeatures:void 0,imageAltText:void 0}){const{precomputedFeatures:s,imageAltText:c}=a,l=e.model(o.ResourceTreeModel.ResourceTreeModel);if(!l)return null;let d=l.resourceForURL(n),g=n;if(!h(d)&&s&&s.currentSrc&&(g=s.currentSrc,d=l.resourceForURL(g)),!d||!h(d))return null;const k=d,L=d.displayName,b=d.content?d.content:d.url.split("base64,")[1],f=d.contentSize(),C=f||i.StringUtilities.base64ToSize(b),v=C>0?i.NumberUtilities.bytesToString(C):"";return new Promise((e=>{const n=document.createElement("img");n.addEventListener("load",(function(){const o=document.createElement("div"),a=o.attachShadow({mode:"open"});a.adoptedStyleSheets=[u];const c=a.createChild("table");c.className="image-preview-container";const l=c.createChild("tr").createChild("td","image-container");l.colSpan=2;const d=l.createChild("div");d.title=L,d.appendChild(n),d.addEventListener("click",(()=>{t.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(g)}));const h=n.naturalWidth,k=n.naturalHeight,b=s?s.renderedWidth:h,f=s?s.renderedHeight:k;if(r){const e=c.createChild("tr","row");e.createChild("td","title").textContent=m(p.renderedSize),e.createChild("td","description").textContent=`${b} × ${f} px`;const t=c.createChild("tr","row");if(t.createChild("td","title").textContent=m(p.renderedAspectRatio),t.createChild("td","description").textContent=i.NumberUtilities.aspectRatio(b,f),f!==k||b!==h){const e=c.createChild("tr","row");e.createChild("td","title").textContent=m(p.intrinsicSize),e.createChild("td","description").textContent=`${h} × ${k} px`;const t=c.createChild("tr","row");t.createChild("td","title").textContent=m(p.intrinsicAspectRatio),t.createChild("td","description").textContent=i.NumberUtilities.aspectRatio(h,k)}}const C=c.createChild("tr","row");C.createChild("td","title").textContent=m(p.fileSize),C.createChild("td","description").textContent=v;const w=c.createChild("tr","row");w.createChild("td","title").textContent=m(p.currentSource);const I=i.StringUtilities.trimMiddle(g,100),S=w.createChild("td","description description-link").createChild("span","source-link");S.textContent=I,S.addEventListener("click",(()=>{t.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(g)})),e(o)}),!1),n.addEventListener("error",(()=>e(null)),!1),c&&(n.alt=c),k.populateImageSource(n)}))}static async loadDimensionsForNode(e){if(!e.nodeName()||"img"!==e.nodeName().toLowerCase())return;const t=await e.resolveToObject("");if(!t)return;const n=await t.callFunctionJSON((function(){return{renderedWidth:this.width,renderedHeight:this.height,currentSrc:this.currentSrc}}),void 0);return t.release(),n}static defaultAltTextForImageURL(t){const n=new e.ParsedURL.ParsedURL(t),i=n.isValid?n.displayName:m(p.unknownSource);return m(p.imageFromS,{PH1:i})}}});const L=new CSSStyleSheet;L.replaceSync(":host{display:inline-block;width:100%}.stack-preview-async-description{padding:3px 0 1px;font-style:italic}.stack-preview-container{display:block;width:100%}.stack-preview-container .ignore-list-link{opacity:60%}.stack-preview-container > tr{height:16px;line-height:16px}.stack-preview-container td{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-inline:2px}.stack-preview-container td.link{width:100%;max-width:0}.stack-preview-container .function-name{max-width:80em}.stack-preview-container:not(.show-hidden-rows) > tr.hidden-row{display:none}.stack-preview-container > tr.show-all-link,\n.stack-preview-container > tr.show-less-link{font-style:italic}.stack-preview-container.show-hidden-rows > tr.show-all-link{display:none}.stack-preview-container:not(.show-hidden-rows) > tr.show-less-link{display:none}\n/*# sourceURL=jsUtils.css */\n");const b={unknown:"(unknown)",auto:"auto",revealInS:"Reveal in {PH1}",reveal:"Reveal",openUsingS:"Open using {PH1}",linkHandling:"Link handling:"},f=n.i18n.registerUIStrings("ui/legacy/components/utils/Linkifier.ts",b),C=n.i18n.getLocalizedString.bind(void 0,f),v=new Set;let w=null;const I=new WeakMap,S=new WeakMap,x=new WeakMap,y=new Map;let T,U;class N extends e.ObjectWrapper.ObjectWrapper{maxLength;anchorsByTarget;locationPoolByTarget;useLinkDecorator;constructor(e,t){super(),this.maxLength=e||s.UIUtils.MaxLengthForDisplayedURLs,this.anchorsByTarget=new Map,this.locationPoolByTarget=new Map,this.useLinkDecorator=Boolean(t),v.add(this),o.TargetManager.TargetManager.instance().observeTargets(this)}static setLinkDecorator(e){console.assert(!w,"Cannot re-register link decorator."),w=e,e.addEventListener("LinkIconChanged",(function(e){const t=e.data,n=I.get(t)||[];for(const e of n)N.updateLinkDecorations(e)}));for(const e of v)e.updateAllAnchorDecorations()}updateAllAnchorDecorations(){for(const e of this.anchorsByTarget.values())for(const t of e)N.updateLinkDecorations(t)}static bindUILocation(e,t){const n=N.linkInfo(e);if(!n)return;if(n.uiLocation=t,!t)return;const i=t.uiSourceCode;let o=I.get(i);o||(o=new Set,I.set(i,o)),o.add(e)}static unbindUILocation(e){const t=N.linkInfo(e);if(!t||!t.uiLocation)return;const n=t.uiLocation.uiSourceCode;t.uiLocation=null;const i=I.get(n);i&&i.delete(e)}static bindBreakpoint(e,t){const n=N.linkInfo(e);if(!n)return;const i=c.BreakpointManager.BreakpointManager.instance().findBreakpoint(t);i&&(n.revealable=i)}static unbindBreakpoint(e){const t=N.linkInfo(e);t&&t.revealable&&(t.revealable=null)}targetAdded(e){this.anchorsByTarget.set(e,[]),this.locationPoolByTarget.set(e,new r.LiveLocation.LiveLocationPool)}targetRemoved(e){const t=this.locationPoolByTarget.get(e);if(this.locationPoolByTarget.delete(e),!t)return;t.disposeAll();const n=this.anchorsByTarget.get(e);if(n){this.anchorsByTarget.delete(e);for(const e of n){const t=N.linkInfo(e);if(!t)continue;t.liveLocation=null,N.unbindUILocation(e);const n=t.fallback;n&&e.replaceWith(n)}}}maybeLinkifyScriptLocation(e,t,n,i,a){let s=null;const c={lineNumber:i,maxLength:this.maxLength,columnNumber:a?.columnNumber,showColumnNumber:Boolean(a?.showColumnNumber),className:a?.className,tabStop:a?.tabStop,inlineFrameIndex:a?.inlineFrameIndex??0,userMetric:a?.userMetric},{columnNumber:l,className:d=""}=c;if(n&&(s=N.linkifyURL(n,c)),!e||e.isDisposed())return s;const u=e.model(o.DebuggerModel.DebuggerModel);if(!u)return s;const p=t?u.createRawLocationByScriptId(t,i||0,l,c.inlineFrameIndex):u.createRawLocationByURL(n,i||0,l,c.inlineFrameIndex,!0);if(!p)return s;const g={tabStop:a?.tabStop},{link:m,linkInfo:h}=N.createLink(s&&s.textContent?s.textContent:"",d,g);h.enableDecorator=this.useLinkDecorator,h.fallback=s,h.userMetric=a?.userMetric;const k=this.locationPoolByTarget.get(p.debuggerModel.target());if(!k)return s;const L={showColumnNumber:c.showColumnNumber??!1,revealBreakpoint:a?.revealBreakpoint};r.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance().createLiveLocation(p,(async e=>{await this.updateAnchor(m,L,e),this.dispatchEventToListeners("liveLocationUpdated",e)}).bind(this),k).then((e=>{e&&(h.liveLocation=e)}));return this.anchorsByTarget.get(p.debuggerModel.target()).push(m),m}linkifyScriptLocation(e,t,n,i,o){const r=this.maybeLinkifyScriptLocation(e,t,n,i,o),a={lineNumber:i,maxLength:this.maxLength,className:o?.className,columnNumber:o?.columnNumber,showColumnNumber:Boolean(o?.showColumnNumber),inlineFrameIndex:o?.inlineFrameIndex??0,tabStop:o?.tabStop,userMetric:o?.userMetric};return r||N.linkifyURL(n,a)}linkifyRawLocation(e,t,n){return this.linkifyScriptLocation(e.debuggerModel.target(),e.scriptId,t,e.lineNumber,{columnNumber:e.columnNumber,className:n,inlineFrameIndex:e.inlineFrameIndex})}maybeLinkifyConsoleCallFrame(e,t,n){const i={...n,columnNumber:t.columnNumber,inlineFrameIndex:n?.inlineFrameIndex??0};return this.maybeLinkifyScriptLocation(e,t.scriptId,t.url,t.lineNumber,i)}linkifyStackTraceTopFrame(e,t){console.assert(t.callFrames.length>0);const{url:n,lineNumber:i,columnNumber:a}=t.callFrames[0],s=N.linkifyURL(n,{lineNumber:i,columnNumber:a,showColumnNumber:!1,inlineFrameIndex:0,maxLength:this.maxLength,preventClick:!0});if(!e)return s;const c=this.locationPoolByTarget.get(e);if(!c)return console.assert(e.isDisposed()),s;console.assert(!e.isDisposed());const l=e.model(o.DebuggerModel.DebuggerModel),{link:d,linkInfo:u}=N.createLink("","");u.enableDecorator=this.useLinkDecorator,u.fallback=s;const p={showColumnNumber:!1};r.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance().createStackTraceTopFrameLiveLocation(l.createRawLocationsByStackTrace(t),(async e=>{await this.updateAnchor(d,p,e),this.dispatchEventToListeners("liveLocationUpdated",e)}).bind(this),c).then((e=>{u.liveLocation=e}));return this.anchorsByTarget.get(e).push(d),d}linkifyCSSLocation(e,t){const{link:n,linkInfo:i}=N.createLink("",t||"",{tabStop:!0});i.enableDecorator=this.useLinkDecorator;const o=this.locationPoolByTarget.get(e.cssModel().target());if(!o)return n;const a={showColumnNumber:!1};r.CSSWorkspaceBinding.CSSWorkspaceBinding.instance().createLiveLocation(e,(async e=>{await this.updateAnchor(n,a,e),this.dispatchEventToListeners("liveLocationUpdated",e)}).bind(this),o).then((e=>{i.liveLocation=e}));return this.anchorsByTarget.get(e.cssModel().target()).push(n),n}reset(){for(const e of[...this.anchorsByTarget.keys()])this.targetRemoved(e),this.targetAdded(e)}dispose(){for(const e of[...this.anchorsByTarget.keys()])this.targetRemoved(e);o.TargetManager.TargetManager.instance().unobserveTargets(this),v.delete(this)}async updateAnchor(t,n,i){N.unbindUILocation(t),n.revealBreakpoint&&N.unbindBreakpoint(t);const o=await i.uiLocation();if(!o){if(i instanceof r.CSSWorkspaceBinding.LiveLocation){const n=i.header();n&&n.ownerNode&&(t.addEventListener("click",(t=>{t.consume(!0),e.Revealer.reveal(n.ownerNode||null)}),!1),N.setTrimmedText(t,"<style>"))}return t.classList.add("invalid-link"),void t.removeAttribute("role")}N.bindUILocation(t,o),n.revealBreakpoint&&N.bindBreakpoint(t,o);const a=o.linkText(!0,n.showColumnNumber);N.setTrimmedText(t,a,this.maxLength);let c=o.uiSourceCode.url();"application/wasm"===o.uiSourceCode.mimeType()?"number"==typeof o.columnNumber&&(c+=`:0x${o.columnNumber.toString(16)}`):(c+=":"+(o.lineNumber+1),n.showColumnNumber&&"number"==typeof o.columnNumber&&(c+=":"+(o.columnNumber+1))),s.Tooltip.Tooltip.install(t,c),t.classList.toggle("ignore-list-link",await i.isIgnoreListed()),N.updateLinkDecorations(t)}static updateLinkDecorations(e){const t=N.linkInfo(e);if(!t||!t.enableDecorator)return;if(!w||!t.uiLocation)return;t.icon&&t.icon.parentElement&&e.removeChild(t.icon);const n=w.linkIcon(t.uiLocation.uiSourceCode);n&&(n.style.setProperty("margin-right","2px"),e.insertBefore(n,e.firstChild)),t.icon=n}static linkifyURL(t,n){const i=(n=n||{showColumnNumber:!1,inlineFrameIndex:0}).text,o=n.className||"",a=n.lineNumber,c=n.columnNumber,l=n.showColumnNumber,d=n.preventClick,u=n.maxLength||s.UIUtils.MaxLengthForDisplayedURLs,p=n.bypassURLTrimming;if(!t||e.ParsedURL.schemeIs(t,"javascript:")){const e=document.createElement("span");return o&&(e.className=o),e.textContent=i||t||C(b.unknown),e}let g=i||r.ResourceUtils.displayNameForURL(t);"number"!=typeof a||i||(g+=":"+(a+1),l&&"number"==typeof c&&(g+=":"+(c+1)));const m={maxLength:u,title:g!==t?t:"",href:t,preventClick:d,tabStop:n.tabStop,bypassURLTrimming:p},{link:h,linkInfo:k}=N.createLink(g,o,m);return a&&(k.lineNumber=a),c&&(k.columnNumber=c),k.userMetric=n?.userMetric,h}static linkifyRevealable(e,t,n,i,o){const r={maxLength:s.UIUtils.MaxLengthForDisplayedURLs,href:n,title:i},{link:a,linkInfo:c}=N.createLink(t,o||"",r);return c.revealable=e,a}static createLink(e,t,n={}){const{maxLength:i,title:o,href:r,preventClick:a,tabStop:c,bypassURLTrimming:l}=n,d=document.createElement("button");t&&(d.className=t),d.classList.add("devtools-link","text-button","link-style"),o&&s.Tooltip.Tooltip.install(d,o),r&&(d.href=r),e instanceof HTMLElement?d.appendChild(e):l?(d.classList.add("devtools-link-styled-trim"),N.appendTextWithoutHashes(d,e)):N.setTrimmedText(d,e,i);const u={icon:null,enableDecorator:!1,uiLocation:null,liveLocation:null,url:r||null,lineNumber:null,columnNumber:null,inlineFrameIndex:0,revealable:null,fallback:null};return S.set(d,u),a?d.classList.add("devtools-link-prevent-click"):d.addEventListener("click",(e=>{N.handleClick(e)&&e.consume(!0)}),!1),s.ARIAUtils.markAsLink(d),d.tabIndex=c?0:-1,{link:d,linkInfo:u}}static setTrimmedText(e,t,n){if(e.removeChildren(),n&&t.length>n){const i=function(e,t){let n=Math.floor(t/2),i=e.length-Math.ceil(t/2)+1;const o=e.codePointAt(i-1);void 0!==o&&o>=65536&&(i++,n++);const r=e.codePointAt(n-1);void 0!==r&&n>0&&r>=65536&&n--;return[e.substring(0,n),e.substring(n,i),e.substring(i)]}(t,n);N.appendTextWithoutHashes(e,i[0]),N.appendHiddenText(e,i[1]),N.appendTextWithoutHashes(e,i[2])}else N.appendTextWithoutHashes(e,t)}static appendTextWithoutHashes(e,t){const n=l.TextUtils.Utils.splitStringByRegexes(t,[/[a-f0-9]{20,}/g]);for(const t of n)-1===t.regexIndex?s.UIUtils.createTextChild(e,t.value):(s.UIUtils.createTextChild(e,t.value.substring(0,7)),N.appendHiddenText(e,t.value.substring(7)))}static appendHiddenText(e,t){const n=s.UIUtils.createTextChild(e.createChild("span","devtools-link-ellipsis"),"…");x.set(n,t)}static untruncatedNodeText(e){return x.get(e)||e.textContent||""}static linkInfo(e){return e&&S.get(e)||null}static handleClick(e){const t=e.currentTarget;if(s.UIUtils.isBeingEdited(e.target)||t.hasSelection())return!1;const n=N.linkInfo(t);return!!n&&N.invokeFirstAction(n)}static handleClickFromNewComponentLand(e){N.invokeFirstAction(e)}static invokeFirstAction(e){const n=N.linkActions(e);return!!n.length&&(n[0].handler.call(null),e.userMetric&&t.userMetrics.actionTaken(e.userMetric),!0)}static linkHandlerSetting(){return T||(T=e.Settings.Settings.instance().createSetting("open-link-handler",C(b.auto))),T}static registerLinkHandler(e,t){y.set(e,t),F.instance().update()}static unregisterLinkHandler(e){y.delete(e),F.instance().update()}static uiLocation(e){const t=N.linkInfo(e);return t?t.uiLocation:null}static linkActions(n){const o=[];if(!n)return o;let a=i.DevToolsPath.EmptyUrlString,l=null;if(n.uiLocation)l=n.uiLocation,a=l.uiSourceCode.contentURL();else if(n.url){a=n.url;const t=d.Workspace.WorkspaceImpl.instance().uiSourceCodeForURL(a)||d.Workspace.WorkspaceImpl.instance().uiSourceCodeForURL(e.ParsedURL.ParsedURL.urlWithoutHash(a));l=t?t.uiLocation(n.lineNumber||0,n.columnNumber||0):null}const u=a?r.ResourceUtils.resourceForURL(a):null,p=l?l.uiSourceCode:u,g=n.revealable||l||u;if(g){const n=e.Revealer.revealDestination(g);o.push({section:"reveal",title:n?C(b.revealInS,{PH1:n}):C(b.reveal),jslogContext:"reveal",handler:()=>(g instanceof c.BreakpointManager.BreakpointLocation&&t.userMetrics.breakpointEditDialogRevealedFrom(5),e.Revealer.reveal(g))})}if(p){const e=l?l.lineNumber:n.lineNumber||0;for(const t of y.keys()){const n=y.get(t);if(!n)continue;const i={section:"reveal",title:C(b.openUsingS,{PH1:t}),jslogContext:"open-using",handler:n.bind(null,p,e)};t===N.linkHandlerSetting().get()?o.unshift(i):o.push(i)}}if((u||n.url)&&(o.push({section:"reveal",title:s.UIUtils.openLinkExternallyLabel(),jslogContext:"open-in-new-tab",handler:()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(a)}),o.push({section:"clipboard",title:s.UIUtils.copyLinkAddressLabel(),jslogContext:"copy-link-address",handler:()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(a)})),l&&l.uiSourceCode){const e=l.uiSourceCode;o.push({section:"clipboard",title:s.UIUtils.copyFileNameLabel(),jslogContext:"copy-file-name",handler:()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(e.displayName())})}return o}}class F{element;constructor(){this.element=document.createElement("select"),this.element.classList.add("chrome-select"),this.element.addEventListener("change",this.onChange.bind(this),!1),this.update()}static instance(e={forceNew:null}){const{forceNew:t}=e;return U&&!t||(U=new F),U}update(){this.element.removeChildren();const e=[...y.keys()];e.unshift(C(b.auto));for(const t of e){const e=document.createElement("option");e.textContent=t,e.selected=t===N.linkHandlerSetting().get(),this.element.appendChild(e)}this.element.disabled=e.length<=1}onChange(e){if(!e.target)return;const t=e.target.value;N.linkHandlerSetting().set(t)}settingElement(){return s.SettingsUI.createCustomSetting(C(b.linkHandling),this.element)}}let D=!1;D||(D=!0,window.addEventListener("linkifieractivated",(function(e){const t=e;N.handleClickFromNewComponentLand(t.data)})));var R=Object.freeze({__proto__:null,Linkifier:N,LinkContextMenuProvider:class{appendApplicableItems(e,t,n){let i=n;for(;i&&!S.get(i);)i=i.parentNodeOrShadowHost();const o=i,r=N.linkInfo(o);if(!r)return;const a=N.linkActions(r);for(const e of a)t.section(e.section).appendItem(e.title,e.handler,{jslogContext:e.jslogContext})}},LinkHandlerSettingUI:F,ContentProviderContextMenuProvider:class{appendApplicableItems(n,i,r){const a=r.contentURL();if(a){e.ParsedURL.schemeIs(a,"file:")||i.revealSection().appendItem(s.UIUtils.openLinkExternallyLabel(),(()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(a.endsWith(":formatted")?e.ParsedURL.ParsedURL.slice(a,0,a.lastIndexOf(":")):a)),{jslogContext:"open-in-new-tab"});for(const e of y.keys()){const t=y.get(e);t&&i.revealSection().appendItem(C(b.openUsingS,{PH1:e}),t.bind(null,r,0),{jslogContext:"open-using"})}r instanceof o.NetworkRequest.NetworkRequest||(i.clipboardSection().appendItem(s.UIUtils.copyLinkAddressLabel(),(()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(a)),{jslogContext:"copy-link-address"}),r instanceof d.UISourceCode.UISourceCode?i.clipboardSection().appendItem(s.UIUtils.copyFileNameLabel(),(()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(r.displayName())),{jslogContext:"copy-file-name"}):i.clipboardSection().appendItem(s.UIUtils.copyFileNameLabel(),(()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(r.displayName)),{jslogContext:"copy-file-name"}))}}}});const M={removeFromIgnore:"Remove from ignore list",addToIgnore:"Add script to ignore list",showSMoreFrames:"{n, plural, =1 {Show # more frame} other {Show # more frames}}",showLess:"Show less",unknownSource:"unknown"},H=n.i18n.registerUIStrings("ui/legacy/components/utils/JSPresentationUtils.ts",M),B=n.i18n.getLocalizedString.bind(void 0,H);function P(e,t){const n=new s.ContextMenu.ContextMenu(t);t.consume(!0);const i=N.uiLocation(e);i&&r.IgnoreListManager.IgnoreListManager.instance().canIgnoreListUISourceCode(i.uiSourceCode)&&(r.IgnoreListManager.IgnoreListManager.instance().isUserIgnoreListedURL(i.uiSourceCode.url())?n.debugSection().appendItem(B(M.removeFromIgnore),(()=>r.IgnoreListManager.IgnoreListManager.instance().unIgnoreListUISourceCode(i.uiSourceCode)),{jslogContext:"remove-from-ignore-list"}):n.debugSection().appendItem(B(M.addToIgnore),(()=>r.IgnoreListManager.IgnoreListManager.instance().ignoreListUISourceCode(i.uiSourceCode)),{jslogContext:"add-to-ignore-list"})),n.appendApplicableItems(t),n.show()}function A(t,n,i,c,l){const d=[];if(l){const t=new e.Throttler.Throttler(100);i.addEventListener("liveLocationUpdated",(()=>{t.schedule((async()=>function(e,t){let n=0,i=t.length;for(let e=t.length-1;e>=0;e--){const o=t[e];if("link"in o&&o.link){const e=N.uiLocation(o.link);e&&r.IgnoreListManager.IgnoreListManager.instance().isUserOrSourceMapIgnoreListedUISourceCode(e.uiSourceCode)&&(o.ignoreListHide=!0),o.ignoreListHide&&n++}"asyncDescription"in o&&(n>0&&n===i-e-1&&(o.ignoreListHide=!0),i=e,n=0)}e(t)}(l,d)))}))}function u(e,t=void 0){let l=null;t&&(l={asyncDescription:s.UIUtils.asyncStackTraceLabel(e.description,t),ignoreListHide:!1},d.push(l));let u=0,p=!1;for(const t of e.callFrames){let e=!1;const l=s.UIUtils.beautifyFunctionName(t.functionName),g=i.maybeLinkifyConsoleCallFrame(n,t,{tabStop:Boolean(c),inlineFrameIndex:0,revealBreakpoint:p});if(g){g.setAttribute("jslog",`${a.link("stack-trace").track({click:!0})}`),g.addEventListener("contextmenu",P.bind(null,g));const t=N.uiLocation(g);t&&r.IgnoreListManager.IgnoreListManager.instance().isUserOrSourceMapIgnoreListedUISourceCode(t.uiSourceCode)&&(e=!0),g.textContent||(g.textContent=B(M.unknownSource))}e&&++u,d.push({functionName:l,link:g,ignoreListHide:e}),p=[o.DebuggerModel.COND_BREAKPOINT_SOURCE_URL,o.DebuggerModel.LOGPOINT_SOURCE_URL].includes(t.url)}l&&u>0&&u===e.callFrames.length&&(l.ignoreListHide=!0)}u(t);let p=t.callFrames;for(let e=t.parent;e;e=e.parent)e.callFrames.length&&u(e,p),p=e.callFrames;return d}function j(e,t){e.removeChildren();let n=0;const i=[];for(const o of t){const t=e.createChild("tr");"asyncDescription"in o?(t.createChild("td").textContent="\n",t.createChild("td","stack-preview-async-description").textContent=o.asyncDescription,t.createChild("td"),t.createChild("td")):(t.createChild("td").textContent="\n",t.createChild("td","function-name").textContent=o.functionName,t.createChild("td").textContent=" @ ",o.link&&(t.createChild("td","link").appendChild(o.link),i.push(o.link)),o.ignoreListHide&&++n),o.ignoreListHide&&t.classList.add("hidden-row"),e.appendChild(t)}if(n){const t=e.createChild("tr","show-all-link");t.createChild("td").textContent="\n";const i=t.createChild("td");i.colSpan=4;const o=i.createChild("span","link");o.textContent=B(M.showSMoreFrames,{n:n}),o.addEventListener("click",(()=>{e.classList.add("show-hidden-rows"),s.GlassPane.GlassPane.containerMoved(e)}),!1);const r=e.createChild("tr","show-less-link");r.createChild("td").textContent="\n";const a=r.createChild("td");a.colSpan=4;const c=a.createChild("span","link");c.textContent=B(M.showLess),c.addEventListener("click",(()=>{e.classList.remove("show-hidden-rows"),s.GlassPane.GlassPane.containerMoved(e)}),!1)}return i}var E=Object.freeze({__proto__:null,buildStackTraceRows:A,buildStackTracePreviewContents:function(e,t,n={stackTrace:void 0,tabStops:void 0}){const{stackTrace:i,tabStops:o}=n,r=document.createElement("span");r.classList.add("monospace"),r.classList.add("stack-preview-container"),r.style.display="inline-block";const a=s.Utils.createShadowRootWithCoreStyles(r,{cssFile:[L],delegatesFocus:void 0}).createChild("table","stack-preview-container");if(!i)return{element:r,links:[]};const c=j.bind(null,a);return{element:r,links:j(a,A(i,e,t,o,c))}}});var _=Object.freeze({__proto__:null,reload:function(){s.DockController.DockController.instance().canDock()&&"undocked"===s.DockController.DockController.instance().dockSide()&&t.InspectorFrontendHost.InspectorFrontendHostInstance.setIsDocked(!0,(function(){})),t.InspectorFrontendHost.InspectorFrontendHostInstance.reattach((()=>window.location.reload()))}});const W={websocketDisconnected:"WebSocket disconnected"},z=n.i18n.registerUIStrings("ui/legacy/components/utils/TargetDetachedDialog.ts",W),O=n.i18n.getLocalizedString.bind(void 0,z);class $ extends o.SDKModel.SDKModel{static hideCrashedDialog;constructor(e){super(e),e.registerInspectorDispatcher(this),e.inspectorAgent().invoke_enable(),e.parentTarget()?.type()===o.Target.Type.Browser&&$.hideCrashedDialog&&($.hideCrashedDialog.call(null),$.hideCrashedDialog=null)}detached({reason:e}){s.RemoteDebuggingTerminatedScreen.RemoteDebuggingTerminatedScreen.show(e)}static webSocketConnectionLost(){s.RemoteDebuggingTerminatedScreen.RemoteDebuggingTerminatedScreen.show(O(W.websocketDisconnected))}targetCrashed(){if($.hideCrashedDialog)return;const e=this.target().parentTarget();if(e&&e.type()!==o.Target.Type.Browser)return;const t=new s.Dialog.Dialog("target-crashed");t.setSizeBehavior("MeasureContent"),t.addCloseButton(),t.setDimmed(!0),$.hideCrashedDialog=t.hide.bind(t),new s.TargetCrashedScreen.TargetCrashedScreen((()=>{$.hideCrashedDialog=null})).show(t.contentElement),t.show()}targetReloadedAfterCrash(){this.target().runtimeAgent().invoke_runIfWaitingForDebugger(),$.hideCrashedDialog&&($.hideCrashedDialog.call(null),$.hideCrashedDialog=null)}}o.SDKModel.SDKModel.register($,{capabilities:2048,autostart:!0});var G=Object.freeze({__proto__:null,TargetDetachedDialog:$});export{k as ImagePreview,E as JSPresentationUtils,R as Linkifier,_ as Reload,G as TargetDetachedDialog};

Check warning

Code scanning / CodeQL

DOM text reinterpreted as HTML Medium library

DOM text
is reinterpreted as HTML without escaping meta-characters.
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.