helloadhavan/github_issues huggingface dataset:
Repository: ggml-org/llama.cpp
Pull request: vulkan : remove unused portability_enumeration_ext variable

This commit removes the portability_enumeration_ext variable from the ggml_vk_instance_portability_enumeration_ext_available function as it is initialized to false but never modified, making it redundant.


Changed files:
filename: ggml/src/ggml-vulkan/ggml-vulkan.cpp
patch: @@ -12015,16 +12015,13 @@ static bool ggml_vk_instance_validation_ext_available(const std::vector<vk::Exte
 }
 static bool ggml_vk_instance_portability_enumeration_ext_available(const std::vector<vk::ExtensionProperties>& instance_extensions) {
 #ifdef __APPLE__
-    bool portability_enumeration_ext = false;
     // Check for portability enumeration extension for MoltenVK support
     for (const auto& properties : instance_extensions) {
         if (strcmp("VK_KHR_portability_enumeration", properties.extensionName) == 0) {
             return true;
         }
     }
-    if (!portability_enumeration_ext) {
-        std::cerr << "ggml_vulkan: WARNING: Instance extension VK_KHR_portability_enumeration not found." << std::endl;
-    }
+    std::cerr << "ggml_vulkan: WARNING: Instance extension VK_KHR_portability_enumeration not found." << std::endl;
 #endif
     return false;
Repository: denoland/deno
Pull request: fix(ext/node): use primordials in `ext/node/polyfills/internal/hide_stack_frames.ts`

Towards #24236. This PR replaces `Object.defineProperty` with its primordial `ObjectDefineProperty`.

<!--
Before submitting a PR, please read https://docs.deno.com/runtime/manual/references/contributing

1. Give the PR a descriptive title.

  Examples of good title:
    - fix(std/http): Fix race condition in server
    - docs(console): Update docstrings
    - feat(doc): Handle nested reexports

  Examples of bad title:
    - fix #7123
    - update docs
    - fix bugs

2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
7. Open as a draft PR if your work is still in progress. The CI won't run
   all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench' label.
-->


Changed files:
filename: ext/node/polyfills/internal/hide_stack_frames.ts
patch: @@ -1,7 +1,7 @@
 // Copyright 2018-2025 the Deno authors. MIT license.
 
-// TODO(petamoriken): enable prefer-primordials for node polyfills
-// deno-lint-ignore-file prefer-primordials
+import { primordials } from "ext:core/mod.js";
+const { ObjectDefineProperty } = primordials;
 
 // deno-lint-ignore no-explicit-any
 type GenericFunction = (...args: any[]) => any;
@@ -13,7 +13,7 @@ export function hideStackFrames<T extends GenericFunction = GenericFunction>(
   // We rename the functions that will be hidden to cut off the stacktrace
   // at the outermost one.
   const hidden = "__node_internal_" + fn.name;
-  Object.defineProperty(fn, "name", { value: hidden });
+  ObjectDefineProperty(fn, "name", { __proto__: null, value: hidden });
 
   return fn;
 }
Repository: huggingface/transformers
Pull request: [shieldgemma] fix checkpoint loading

# What does this PR do?

As per title, reported by @ydshieh internally

(how many more models we have that load a VLM internally 🥲 )

Changed files:
filename: src/transformers/modeling_utils.py
patch: @@ -240,6 +240,7 @@ def is_local_dist_rank_0():
     "mistral3",
     "mllama",
     "paligemma",
+    "shieldgemma2",
     "qwen2vl",
     "qwen2_5_vl",
     "videollava",

filename: src/transformers/models/shieldgemma2/modeling_shieldgemma2.py
patch: @@ -45,6 +45,12 @@ class ShieldGemma2ImageClassifierOutputWithNoAttention(ImageClassifierOutputWith
 @auto_docstring
 class ShieldGemma2ForImageClassification(PreTrainedModel):
     config_class = ShieldGemma2Config
+    _checkpoint_conversion_mapping = {
+        "model.language_model.model": "model.model.language_model",
+        "model.vision_tower": "model.model.vision_tower",
+        "model.multi_modal_projector": "model.model.multi_modal_projector",
+        "model.language_model.lm_head": "model.lm_head",
+    }
 
     def __init__(self, config: ShieldGemma2Config):
         super().__init__(config=config)

filename: tests/models/shieldgemma2/test_modeling_shieldgemma2.py
patch: @@ -22,21 +22,20 @@
 from transformers import is_torch_available
 from transformers.testing_utils import (
     cleanup,
+    require_read_token,
     require_torch_accelerator,
     slow,
     torch_device,
 )
 
 
 if is_torch_available():
-    import torch
-
     from transformers import ShieldGemma2ForImageClassification, ShieldGemma2Processor
 
 
 @slow
 @require_torch_accelerator
-# @require_read_token
+@require_read_token
 class ShieldGemma2IntegrationTest(unittest.TestCase):
     def tearDown(self):
         cleanup(torch_device, gc_collect=True)
@@ -49,11 +48,9 @@ def test_model(self):
         response = requests.get(url)
         image = Image.open(BytesIO(response.content))
 
-        model = ShieldGemma2ForImageClassification.from_pretrained(model_id, torch_dtype=torch.bfloat16).to(
-            torch_device
-        )
+        model = ShieldGemma2ForImageClassification.from_pretrained(model_id, load_in_4bit=True)
 
-        inputs = processor(images=[image]).to(torch_device)
+        inputs = processor(images=[image], return_tensors="pt").to(torch_device)
         output = model(**inputs)
         self.assertEqual(len(output.probabilities), 3)
         for element in output.probabilities:
Repository: nodejs/node
Pull request: src: remove NonCopyableMaybe

I added this class in 823d86c47ce15fba8875fcebd412593b02aab362 in 2018 when we did not yet use `std::optional`. The last uses were removed in 5b9bf39b47afcf26aaad810eec2ba8bdff904d4c, so remove it.

Refs: https://github.com/nodejs/node/pull/24234
Refs: https://github.com/nodejs/node/pull/55368

<!--
Before submitting a pull request, please read:

- the CONTRIBUTING guide at https://github.com/nodejs/node/blob/HEAD/CONTRIBUTING.md
- the commit message formatting guidelines at
  https://github.com/nodejs/node/blob/HEAD/doc/contributing/pull-requests.md#commit-message-guidelines

For code changes:
1. Include tests for any bug fixes or new features.
2. Update documentation if relevant.
3. Ensure that `make -j4 test` (UNIX), or `vcbuild test` (Windows) passes.

If you believe this PR should be highlighted in the Node.js CHANGELOG
please add the `notable-change` label.

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.
-->


Changed files:
filename: src/util.h
patch: @@ -656,38 +656,6 @@ struct MallocedBuffer {
   MallocedBuffer& operator=(const MallocedBuffer&) = delete;
 };
 
-template <typename T>
-class NonCopyableMaybe {
- public:
-  NonCopyableMaybe() : empty_(true) {}
-  explicit NonCopyableMaybe(T&& value)
-      : empty_(false),
-        value_(std::move(value)) {}
-
-  bool IsEmpty() const {
-    return empty_;
-  }
-
-  const T* get() const {
-    return empty_ ? nullptr : &value_;
-  }
-
-  const T* operator->() const {
-    CHECK(!empty_);
-    return &value_;
-  }
-
-  T&& Release() {
-    CHECK_EQ(empty_, false);
-    empty_ = true;
-    return std::move(value_);
-  }
-
- private:
-  bool empty_;
-  T value_;
-};
-
 // Test whether some value can be called with ().
 template <typename T, typename = void>
 struct is_callable : std::is_function<T> { };
Repository: denoland/deno
Pull request: fix(ext/ffi): unexport brand from dts

This is technically **BREAKING** as it removes a public API, but the brand is type-only and the chance of anyone actually relying on this seems very unlikely.

Also, I kept managing to miscommit this or that. Third time's the charm and sorry for the spam.

Changed files:
filename: cli/tsc/dts/lib.deno.ns.d.ts
patch: @@ -5543,7 +5543,7 @@ declare namespace Deno {
   /**
    * @category FFI
    */
-  export const brand: unique symbol;
+  const brand: unique symbol;
 
   /**
    * @category FFI

filename: tools/jsdoc_checker.js
patch: @@ -1,6 +1,6 @@
 #!/usr/bin/env -S deno run --allow-read --allow-env --allow-sys --config=tests/config/deno.json
 // Copyright 2018-2025 the Deno authors. MIT license.
-import { Node, Project, ts } from "npm:ts-morph@22.0.0";
+import { Node, Project, ts } from "npm:ts-morph@25.0.1";
 import { join, ROOT_PATH } from "./util.js";
 
 const libs = [
@@ -50,7 +50,7 @@ for (const file of project.getSourceFiles()) {
       node.getKind() === ts.SyntaxKind.TypeAliasDeclaration;
 
     if (parent) {
-      if (!node.isExported()) {
+      if (!node.isExported() && !isBrandVarStmt(node)) {
         errors.push(getMissingErrorPrefix(node) + "export keyword");
         continue;
       }
@@ -87,6 +87,12 @@ if (errors.length > 0) {
   throw new AggregateError(errors);
 }
 
+function isBrandVarStmt(node) {
+  // this variable statement is intentionally private
+  return Node.isVariableStatement(node) &&
+    node.getDeclarations()[0].getName() === "brand";
+}
+
 function getMissingErrorPrefix(node) {
   return getErrorPrefix(node) + `is missing a `;
 }
Repository: ggml-org/llama.cpp
Pull request: ggml : WebGPU add TRANSPOSE and RESHAPE to supported ops

This commit adds support for the TRANSPOSE and RESHAPE operations in the
ggml webgpu backend.

Co-authored-by: Diego Devesa <slarengh@gmail.com>

Changed files:
filename: ggml/src/ggml-webgpu/ggml-webgpu.cpp
patch: @@ -611,6 +611,8 @@ static bool ggml_webgpu_encode_node(webgpu_context ctx, ggml_tensor * node) {
         case GGML_OP_NONE:
         case GGML_OP_VIEW:
         case GGML_OP_PERMUTE:
+        case GGML_OP_TRANSPOSE:
+        case GGML_OP_RESHAPE:
             return false;
         case GGML_OP_CPY:
             {
@@ -1062,6 +1064,8 @@ static bool ggml_backend_webgpu_device_supports_op(ggml_backend_dev_t dev, const
         case GGML_OP_NONE:
         case GGML_OP_VIEW:
         case GGML_OP_PERMUTE:
+        case GGML_OP_TRANSPOSE:
+        case GGML_OP_RESHAPE:
             return true;
         case GGML_OP_CPY:
         case GGML_OP_SET_ROWS:
Repository: nodejs/node
Pull request: buffer: improve byteLength performance

This improves the performance for non one-byte strings.

Benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1705/

Changed files:
filename: src/node_buffer.cc
patch: @@ -728,16 +728,28 @@ void SlowByteLengthUtf8(const FunctionCallbackInfo<Value>& args) {
   args.GetReturnValue().Set(args[0].As<String>()->Utf8Length(env->isolate()));
 }
 
-uint32_t FastByteLengthUtf8(Local<Value> receiver,
-                            const v8::FastOneByteString& source) {
+uint32_t FastByteLengthUtf8(
+    Local<Value> receiver,
+    Local<Value> sourceValue,
+    v8::FastApiCallbackOptions& options) {  // NOLINT(runtime/references)
+  TRACK_V8_FAST_API_CALL("Buffer::FastByteLengthUtf8");
+  auto isolate = options.isolate;
+  HandleScope handleScope(isolate);
+  CHECK(sourceValue->IsString());
+  Local<String> sourceStr = sourceValue.As<String>();
+
+  if (!sourceStr->IsExternalOneByte()) {
+    return sourceStr->Utf8Length(isolate);
+  }
+  auto source = sourceStr->GetExternalOneByteStringResource();
   // For short inputs, the function call overhead to simdutf is maybe
   // not worth it, reserve simdutf for long strings.
-  if (source.length > 128) {
-    return simdutf::utf8_length_from_latin1(source.data, source.length);
+  if (source->length() > 128) {
+    return simdutf::utf8_length_from_latin1(source->data(), source->length());
   }
 
-  uint32_t length = source.length;
-  const auto input = reinterpret_cast<const uint8_t*>(source.data);
+  uint32_t length = source->length();
+  const auto input = reinterpret_cast<const uint8_t*>(source->data());
 
   uint32_t answer = length;
   uint32_t i = 0;

filename: src/node_external_reference.h
patch: @@ -17,6 +17,11 @@ using CFunctionCallbackWithMultipleValueAndOptions =
              v8::Local<v8::Value>,
              v8::Local<v8::Value>,
              v8::FastApiCallbackOptions&);
+using CFunctionA =
+    uint32_t (*)(v8::Local<v8::Value> receiver,
+                 v8::Local<v8::Value> sourceValue,
+                 // NOLINTNEXTLINE(runtime/references) This is V8 api.
+                 v8::FastApiCallbackOptions& options);
 using CFunctionCallbackWithOneByteString =
     uint32_t (*)(v8::Local<v8::Value>, const v8::FastOneByteString&);
 
@@ -98,6 +103,7 @@ class ExternalReferenceRegistry {
   ExternalReferenceRegistry();
 
 #define ALLOWED_EXTERNAL_REFERENCE_TYPES(V)                                    \
+  V(CFunctionA)                                                                \
   V(CFunctionCallback)                                                         \
   V(CFunctionCallbackWithalueAndOptions)                                       \
   V(CFunctionCallbackWithMultipleValueAndOptions)                              \
Repository: facebook/react
Pull request: Add sideEffects flag to react-is for tree shaking

## Summary

This PR:

- Adds the `"sideEffects": false` flag to the `react-is` package, to enable proper tree-shaking

## How did you test this change?

React-Redux v9 beta switches its artifacts from separate JS files to pre-bundled artifacts.  While testing builds locally, I noticed that our use of `react-is` was no longer getting tree-shaken from Vite builds, despite `react-is` only being used by our `connect` API and `connect` itself getting shaken out of the final bundle.

Hand-adding `"sideEffects": false` to the `react-is` package locally convinced Vite (+Rollup) to properly tree-shake `react-is` out of the bundle when it wasn't being used.

I'd love to see this published as v18.2.1 as soon as this PR is merged - we're hoping to release React-Redux v9 in the next few weeks!

Changed files:
filename: packages/react-is/package.json
patch: @@ -3,6 +3,7 @@
   "version": "18.2.0",
   "description": "Brand checking of React Elements.",
   "main": "index.js",
+  "sideEffects": false,
   "repository": {
     "type": "git",
     "url": "https://github.com/facebook/react.git",
Repository: denoland/deno
Pull request: fix: make --allow-env stronger that --deny-env


Changed files:
filename: runtime/permissions/lib.rs
patch: @@ -1944,7 +1944,7 @@ impl UnaryPermission<EnvQueryDescriptor> {
 
   pub fn check_all(&mut self) -> Result<(), PermissionDeniedError> {
     skip_check_if_is_permission_fully_granted!(self);
-    self.check_desc(None, false, None)
+    self.check_desc(None, true, None)
   }
 }
 
@@ -5263,4 +5263,21 @@ mod tests {
       );
     }
   }
+
+  #[test]
+  fn test_env_check_all() {
+    set_prompter(Box::new(TestPrompter));
+    let parser = TestPermissionDescriptorParser;
+    let mut perms = Permissions::from_options(
+      &parser,
+      &PermissionsOptions {
+        allow_env: Some(vec![]),
+        deny_env: Some(svec!["FOO"]),
+        ..Default::default()
+      },
+    )
+    .unwrap();
+
+    assert!(perms.env.check_all().is_err());
+  }
 }

filename: tests/specs/run/permission_env_allow_and_deny/__test__.jsonc
patch: @@ -0,0 +1,8 @@
+{
+  "args": "run --allow-env --deny-env=FOOBAR main.ts",
+  "output": "main.out",
+  "exitCode": 1,
+  "envs": {
+    "FOOBAR": "FOOBAR"
+  }
+}

filename: tests/specs/run/permission_env_allow_and_deny/main.out
patch: @@ -0,0 +1,4 @@
+error: Uncaught (in promise) NotCapable: Requires env access, run again with the --allow-env flag
+console.log(Deno.env.toObject());
+                     ^
+[WILDCARD]main.ts:1:22

filename: tests/specs/run/permission_env_allow_and_deny/main.ts
patch: @@ -0,0 +1 @@
+console.log(Deno.env.toObject());
Repository: ggml-org/llama.cpp
Pull request: Added CI with RISC-V RVV1.0 Hardware

I have added the RISC-V CI for running RISC-V RVV 1.0 hardware 


Changed files:
filename: .devops/cloud-v-pipeline
patch: @@ -1,22 +0,0 @@
-node('x86_runner1'){            // Running on x86 runner containing latest vector qemu, latest vector gcc and all the necessary libraries
-    stage('Cleanup'){
-        cleanWs()               // Cleaning previous CI build in workspace
-    }
-    stage('checkout repo'){
-        retry(5){               // Retry if the cloning fails due to some reason
-            checkout scm        // Clone the repo on Runner
-        }
-    }
-    stage('Compiling llama.cpp'){
-        sh'''#!/bin/bash
-            make RISCV=1 RISCV_CROSS_COMPILE=1 # Compiling llama for RISC-V
-        '''
-    }
-    stage('Running llama.cpp'){
-        sh'''#!/bin/bash
-            module load gnu-bin2/0.1            # loading latest versions of vector qemu and vector gcc
-            qemu-riscv64 -L /softwares/gnu-bin2/sysroot  -cpu rv64,v=true,vlen=256,elen=64,vext_spec=v1.0 ./llama-cli -m /home/alitariq/codellama-7b.Q4_K_M.gguf -p "Anything" -n 9 > llama_log.txt            # Running llama.cpp on vector qemu-riscv64
-            cat llama_log.txt                   # Printing results
-        '''
-    }
-}

filename: .github/workflows/build-riscv-native.yml
patch: @@ -0,0 +1,43 @@
+name: Build on RISCV Linux Machine by Cloud-V
+on:
+  workflow_dispatch:
+  workflow_call:
+
+jobs:
+  bianbu-riscv64-native: # Bianbu 2.2
+    runs-on: self-hosted
+
+    steps:
+      - name: Install prerequisites
+        run: |
+          sudo apt-get update || true
+          sudo apt-get install -y libatomic1
+      - uses: actions/checkout@v4
+      - name: Setup Riscv
+        run: |
+          sudo apt-get update || true
+          sudo apt-get install -y --no-install-recommends \
+                  build-essential \
+                  gcc-14-riscv64-linux-gnu \
+                  g++-14-riscv64-linux-gnu \
+                  cmake
+
+      - name: Build
+        run: |
+          cmake -B build -DLLAMA_CURL=OFF \
+                         -DCMAKE_BUILD_TYPE=Release \
+                         -DGGML_OPENMP=OFF \
+                         -DLLAMA_BUILD_EXAMPLES=ON \
+                         -DLLAMA_BUILD_TOOLS=ON \
+                         -DLLAMA_BUILD_TESTS=OFF \
+                         -DCMAKE_SYSTEM_NAME=Linux \
+                         -DCMAKE_SYSTEM_PROCESSOR=riscv64 \
+                         -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
+                         -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14 \
+                         -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
+                         -DCMAKE_FIND_ROOT_PATH=/usr/lib/riscv64-linux-gnu \
+                         -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
+                         -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
+                         -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH
+
+          cmake --build build --config Release -j $(nproc)
Repository: vercel/next.js
Pull request: Always consider `captureOwnerStack` optional

When running `next build` with a custom `NODE_ENV` (e.g. `test` or `development`), the `captureOwnerStack` method is not defined and may lead to errors if called. This change ensures that we only call `captureOwnerStack` if it is defined, preventing potential runtime errors.

Changed files:
filename: packages/next/src/server/app-render/dynamic-rendering.ts
patch: @@ -664,7 +664,10 @@ function createErrorWithComponentOrOwnerStack(
   componentStack: string
 ) {
   const ownerStack =
-    process.env.NODE_ENV !== 'production' ? React.captureOwnerStack() : null
+    process.env.NODE_ENV !== 'production' && React.captureOwnerStack
+      ? React.captureOwnerStack()
+      : null
+
   const error = new Error(message)
   error.stack = error.name + ': ' + message + (ownerStack ?? componentStack)
   return error

filename: packages/next/src/server/node-environment-extensions/utils.tsx
patch: @@ -47,8 +47,11 @@ export function io(expression: string, type: ApiType) {
 
           const errorWithStack = new Error(message)
 
-          if (process.env.NODE_ENV !== 'production') {
-            const ownerStack = workUnitStore.captureOwnerStack!()
+          if (
+            process.env.NODE_ENV !== 'production' &&
+            workUnitStore.captureOwnerStack
+          ) {
+            const ownerStack = workUnitStore.captureOwnerStack()
 
             if (ownerStack) {
               // TODO: Instead of stitching the stacks here, we should log the
Repository: denoland/deno
Pull request: fix: move otel logic into otel

cleanup https://github.com/denoland/deno/commit/229228ae0d7c58e1d78dc1777e5f43afe4a58d33

Changed files:
filename: cli/main.rs
patch: @@ -51,7 +51,6 @@ use deno_runtime::tokio_util::create_and_run_current_thread_with_maybe_metrics;
 use deno_runtime::WorkerExecutionMode;
 pub use deno_runtime::UNSTABLE_FEATURES;
 use deno_telemetry::OtelConfig;
-use deno_telemetry::OtelConsoleConfig;
 use deno_terminal::colors;
 use factory::CliFactory;
 
@@ -490,15 +489,10 @@ fn resolve_flags_and_init(
 
   let otel_config = flags.otel_config();
   init_logging(flags.log_level, Some(otel_config.clone()));
-  if otel_config.metrics_enabled
-    || otel_config.tracing_enabled
-    || !matches!(otel_config.console, OtelConsoleConfig::Ignore)
-  {
-    deno_telemetry::init(
-      deno_lib::version::otel_runtime_config(),
-      otel_config.clone(),
-    )?;
-  }
+  deno_telemetry::init(
+    deno_lib::version::otel_runtime_config(),
+    otel_config.clone(),
+  )?;
 
   // TODO(bartlomieju): remove in Deno v2.5 and hard error then.
   if flags.unstable_config.legacy_flag_enabled {

filename: ext/telemetry/lib.rs
patch: @@ -162,7 +162,7 @@ pub enum OtelPropagators {
   None = 2,
 }
 
-#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
 #[repr(u8)]
 pub enum OtelConsoleConfig {
   Ignore = 0,
@@ -636,6 +636,13 @@ pub fn init(
   rt_config: OtelRuntimeConfig,
   config: OtelConfig,
 ) -> deno_core::anyhow::Result<()> {
+  if !config.metrics_enabled
+    && !config.tracing_enabled
+    && config.console == OtelConsoleConfig::Ignore
+  {
+    return Ok(());
+  }
+
   // Parse the `OTEL_EXPORTER_OTLP_PROTOCOL` variable. The opentelemetry_*
   // crates don't do this automatically.
   // TODO(piscisaureus): enable GRPC support.
Repository: electron/electron
Pull request: fix: win.closeFilePreview recreates panel when called twice

Backport of #45319

See that PR for details.


Notes: Fixed file preview window reappearing when calling `win.closeFilePreview` twice on macOS.


Changed files:
filename: shell/browser/native_window_mac.mm
patch: @@ -1556,8 +1556,11 @@ static bool FromV8(v8::Isolate* isolate,
 }
 
 void NativeWindowMac::CloseFilePreview() {
-  if ([QLPreviewPanel sharedPreviewPanelExists]) {
+  // Need to be careful about checking [QLPreviewPanel sharedPreviewPanel] as
+  // simply accessing it will cause it to reinitialize and reappear.
+  if ([QLPreviewPanel sharedPreviewPanelExists] && preview_item_) {
     [[QLPreviewPanel sharedPreviewPanel] close];
+    preview_item_ = nil;
   }
 }
 

filename: spec/api-browser-window-spec.ts
patch: @@ -6255,6 +6255,7 @@ describe('BrowserWindow module', () => {
       w.previewFile(__filename);
       await setTimeout(500);
       expect(showCalled).to.equal(false, 'should not have called show twice');
+      w.closeFilePreview();
     });
   });