Low firefox Logic Error 🔧 Commit mapped

Overview

Low
Severity
—
CVSS
No
Exploited ITW
Fixed
Fix Status
Impactlow
DescriptionClickjacking issue in the Widget component
ComponentWidget
Bug ClassLogic Error
Tracker2036097
Fix commitdc7f8a547186 (firefox) +56/-355
CISA KEVNot listed
Creditedhafidzaulia28
Disclosed2026-08-18

Background

Clickjacking
an attack in which a page tricks the user into activating a UI control (here a native dialog’s confirm button) they did not intend to click.
Native file picker
the OS-provided open/save dialog (NSSavePanel on macOS, GtkFileChooser on GTK) that Gecko drives through nsFilePicker to let the user choose a file.
Input-protection time range
a short window after a security-sensitive dialog appears during which confirmations are ignored, governed by the security.notification_enable_delay pref (500ms).
`panel:validateURL:error:`
the NSOpenSavePanelDelegate callback Cocoa invokes before accepting a selection, where returning NO keeps the panel open.

Root Cause Analysis

When nsFilePicker::BeginPanelAsync (macOS) or nsFilePicker::OpenNonPortal (GTK) displayed a native picker, the dialog’s confirm action was live the instant the window appeared, so a confirmation arriving in the same tick as the picker’s presentation would be accepted. This violated the invariant that a security-sensitive confirmation must not be actionable until a minimum delay has elapsed after the dialog is shown — the same guarantee security.dialog_enable_delay already provided for in-content dialogs. A malicious page could exploit the gap with clickjacking or a double-click (GTK emits GTK_RESPONSE_ACCEPT on a double-click) so that a click meant for the page landed on the picker’s OK/Accept control the moment it appeared.

The fix records the show time via RecordLastShownTime and computes protection with nsBaseFilePicker::IsWithinInputProtectionTimeRange / IsPickerInputProtected, then vetoes early confirmations: on macOS the MOZFilePickerInputProtector delegate returns NO from panel:validateURL:error: (leaving outError nil so no alert shows), and on GTK nsFilePicker::DoneNonPortal returns without consuming an early GTK_RESPONSE_OK/GTK_RESPONSE_ACCEPT. Because the panel is kept open rather than closed, an ignored early click cannot pin a stale selection and the user must click again once the window has elapsed.

Key insight
The core mistake was applying no enable-delay to native file pickers, leaving their confirm action hot the moment the dialog appeared; the fix reuses the notification enable-delay to treat any confirmation inside that window as untrusted and keep the picker open.

Attack Path

  1. Bait the click A malicious page presents UI that induces the user to click or double-click at a predictable screen location.
  2. Summon the picker Script triggers a file input or other flow that opens the native file/save picker so it surfaces under or near the cursor.
  3. Race the confirmation The queued or second (double-click) event reaches the picker’s OK/Accept button the instant it appears, before the user perceives the dialog.
  4. Silent acceptance Lacking any enable-delay, the picker accepts the early confirmation and returns the selected file or save location.
  5. Exfiltrate or overwrite The unintended selection lets the page read/upload a chosen file or steer a save target without deliberate user consent.

Impact Assessment

An attacker gains the ability to make a user confirm a native file picker without intentional consent, potentially selecting a file for upload or a save destination, from web content in the browser/parent-process UI. Preconditions are user interaction (a mistimed or double click) plus a page that can open a picker and align a click with its appearance. Severity and impact are low, reflecting the requirement for user interaction and limited leverage.

Changed Functions

FunctionChangeNotes
if
widget/cocoa/nsFilePicker.mm
modified
if
widget/nsBaseFilePicker.cpp
modified
FileDialogInputProtector
widget/windows/filedialog/WinFileDialogCommands.cpp
modified

Files Changed

  • modules/libpref/init/StaticPrefList.yaml
  • modules/libpref/init/all.js
  • widget/cocoa/nsFilePicker.h
  • widget/cocoa/nsFilePicker.mm
  • widget/gtk/nsFilePicker.cpp
  • widget/nsBaseFilePicker.cpp
  • widget/nsBaseFilePicker.h
  • widget/tests/gtest/TestFilePickerInputProtection.cpp
  • widget/tests/gtest/moz.build
  • widget/windows/filedialog/PWinFileDialog.ipdl
  • widget/windows/filedialog/WinFileDialogChild.cpp
  • widget/windows/filedialog/WinFileDialogChild.h
  • widget/windows/filedialog/WinFileDialogCommands.cpp
  • widget/windows/filedialog/WinFileDialogCommands.h
  • widget/windows/filedialog/WinFileDialogParent.cpp
  • widget/windows/filedialog/WinFileDialogParent.h
  • widget/windows/nsFilePicker.cpp

Audit Directions

  • Enable-delay coverage
    Audit every security-sensitive confirmation surface (native pickers, permission prompts, notifications) to confirm each honors an input-protection delay like security.dialog_enable_delay / security.notification_enable_delay, not just in-content dialogs.
  • Confirm-on-double-click
    Review dialog result handling for backends that emit an accept response on a double-click (as GTK does), since a single user gesture can produce an immediate confirmation.
  • Show-time bookkeeping
    Verify RecordLastShownTime is called on every code path that presents a picker and that the timestamp is consulted before consuming a result, so no presentation path bypasses the window check.
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
index dd122a67544..4843edb3fbe 100644
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -18792,16 +18792,6 @@
   value: false
   mirror: always
 
-# How long (in milliseconds) security-sensitive notifications delay before
-# their buttons become enabled, to guard against clickjacking. Native file
-# pickers reuse this value to ignore a confirmation that arrives too soon after
-# the picker is shown, keeping the picker open instead of accepting it. Set to
-# 0 to disable.
-- name: security.notification_enable_delay
-  type: RelaxedAtomicUint32
-  value: 500
-  mirror: always
-
 # Whether or not to import and trust third party root certificates from the OS.
 - name: security.enterprise_roots.enabled
   type: RelaxedAtomicBool
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
index dadb6a117b4..b1f9b54bf54 100644
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -1735,6 +1735,7 @@ pref("font.blacklist.underline_offset", "FangSong,Gulim,GulimChe,MingLiU,MingLiU
 
 // security-sensitive dialogs should delay button enabling. In milliseconds.
 pref("security.dialog_enable_delay", 1000);
+pref("security.notification_enable_delay", 500);
 
 #ifdef NIGHTLY_BUILD
   // Disallow web documents loaded with the SystemPrincipal
diff --git a/widget/cocoa/nsFilePicker.h b/widget/cocoa/nsFilePicker.h
index 288a8c7c607..1b592b1e5bf 100644
--- a/widget/cocoa/nsFilePicker.h
+++ b/widget/cocoa/nsFilePicker.h
@@ -44,11 +44,6 @@ class nsFilePicker final : public nsBaseFilePicker {
    */
   NSArray* GetFilterList();
 
-  // Exposed for the panel delegate (MOZFilePickerInputProtector), which lives
-  // outside the class, so it can veto confirmations that arrive before the
-  // input-protection window elapses.
-  using nsBaseFilePicker::IsPickerInputProtected;
-
  protected:
   virtual ~nsFilePicker();
 
diff --git a/widget/cocoa/nsFilePicker.mm b/widget/cocoa/nsFilePicker.mm
index 02287820c3b..fdf05b6ffd5 100644
--- a/widget/cocoa/nsFilePicker.mm
+++ b/widget/cocoa/nsFilePicker.mm
@@ -49,42 +49,6 @@ const char kShowHiddenFilesPref[] = "filepicker.showHiddenFiles";
 - (void)menuChangedItem:(NSNotification*)aSender;
 @end
 
-// Panel delegate that ignores confirmations that arrive before the file
-// picker's input-protection time range has passed. Returning NO from
-// panel:validateURL:error: to keep the panel open is the documented purpose
-// of the method; leaving the error nil so no alert is shown is undocumented,
-// but observed to hold (including for the out-of-process panel). If a future
-// macOS changes this, the worst case is a stray alert or the check quietly
-// doing nothing, and it can be turned off with
-// security.notification_enable_delay.
-@interface MOZFilePickerInputProtector : NSObject <NSOpenSavePanelDelegate> {
-  RefPtr<nsFilePicker> mFilePicker;
-}
-- (id)initWithFilePicker:(nsFilePicker*)aFilePicker;
-@end
-
-@implementation MOZFilePickerInputProtector
-- (id)initWithFilePicker:(nsFilePicker*)aFilePicker {
-  if ((self = [super init])) {
-    mFilePicker = aFilePicker;
-  }
-  return self;
-}
-
-- (BOOL)panel:(id)sender validateURL:(NSURL*)url error:(NSError**)outError {
-  // url is intentionally unused: the file we return is read from the panel
-  // when it finally closes, so an ignored early confirmation can't pin a
-  // stale selection.
-  if (mFilePicker && mFilePicker->IsPickerInputProtected()) {
-    if (outError) {
-      *outError = nil;
-    }
-    return NO;
-  }
-  return YES;
-}
-@end
-
 NS_IMPL_ISUPPORTS(nsFilePicker, nsIFilePicker)
 
 static void SetShowHiddenFileState(NSSavePanel* panel) {
@@ -266,25 +230,10 @@ void nsFilePicker::BeginPanelAsync(NSSavePanel* aPanel,
     parentWindow =
         static_cast<NSWindow*>(mParentWidget->GetNativeData(NS_NATIVE_WINDOW));
   }
-
-  // Attach a delegate to ignore confirmations that arrive before the
-  // input-protection time range has passed. The panel does not retain its
-  // delegate, so the completion handler releases it.
-  MOZFilePickerInputProtector* protector =
-      [[MOZFilePickerInputProtector alloc] initWithFilePicker:this];
-  [aPanel setDelegate:protector];
-
-  void (^handler)(NSModalResponse) = ^(NSModalResponse result) {
-    aHandler(result);
-    [aPanel setDelegate:nil];
-    [protector release];
-  };
-
-  RecordLastShownTime();
   if (parentWindow) {
-    [aPanel beginSheetModalForWindow:parentWindow completionHandler:handler];
+    [aPanel beginSheetModalForWindow:parentWindow completionHandler:aHandler];
   } else {
-    [aPanel beginWithCompletionHandler:handler];
+    [aPanel beginWithCompletionHandler:aHandler];
   }
 }
 
diff --git a/widget/gtk/nsFilePicker.cpp b/widget/gtk/nsFilePicker.cpp
index f473b2420ad..56d33ae6cba 100644
--- a/widget/gtk/nsFilePicker.cpp
+++ b/widget/gtk/nsFilePicker.cpp
@@ -796,7 +796,6 @@ void nsFilePicker::OpenNonPortal() {
                    this);
   g_signal_connect(file_chooser, "destroy", G_CALLBACK(OnNonPortalDestroy),
                    this);
-  RecordLastShownTime();
   gtk_widget_show(GTK_WIDGET(file_chooser));
 }
 
@@ -873,15 +872,6 @@ bool nsFilePicker::WarnForNonReadableFile() {
 }
 
 void nsFilePicker::DoneNonPortal(GtkWidget* file_chooser, gint response) {
-  // Ignore a confirmation that arrives before the input-protection time range
-  // has passed, leaving the dialog open. (GTK emits GTK_RESPONSE_ACCEPT on a
-  // double-click.)
-  if ((response == GTK_RESPONSE_OK || response == GTK_RESPONSE_ACCEPT ||
-       response == kFilePickerAccept) &&
-      IsPickerInputProtected()) {
-    return;
-  }
-
   mFileChooser = nullptr;
 
   nsIFilePicker::ResultCode result;
diff --git a/widget/nsBaseFilePicker.cpp b/widget/nsBaseFilePicker.cpp
index 060a3ed187c..1be546a755d 100644
--- a/widget/nsBaseFilePicker.cpp
+++ b/widget/nsBaseFilePicker.cpp
@@ -6,9 +6,7 @@
 #include "nsBaseFilePicker.h"
 
 #include "WidgetUtils.h"
-#include "mozilla/BasePrincipal.h"
 #include "mozilla/Components.h"
-#include "mozilla/StaticPrefs_security.h"
 #include "mozilla/StaticPrefs_widget.h"
 #include "mozilla/dom/BrowsingContext.h"
 #include "mozilla/dom/CanonicalBrowsingContext.h"
@@ -16,8 +14,16 @@
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/File.h"
 #include "mozilla/dom/Promise.h"
-#include "mozilla/dom/WindowGlobalParent.h"
 #include "nsArrayEnumerator.h"
+#include "nsCOMArray.h"
+#include "nsCOMPtr.h"
+#include "nsContentUtils.h"
+#include "nsEnumeratorUtils.h"
+#include "nsIFile.h"
+#include "nsIInterfaceRequestorUtils.h"
+#include "nsIStringBundle.h"
+#include "nsIWidget.h"
+#include "nsPIDOMWindow.h"
 #include "nsSimpleEnumerator.h"
 #include "nsString.h"
 #include "nsThreadUtils.h"
@@ -374,49 +380,6 @@ bool nsBaseFilePicker::MaybeBlockFilePicker(
   return true;
 }
 
-// static
-bool nsBaseFilePicker::IsWithinInputProtectionTimeRange(
-    mozilla::TimeStamp aShowTime, mozilla::TimeStamp aNow,
-    uint32_t aProtectionMs) {
-  if (!aProtectionMs || aShowTime.IsNull()) {
-    return false;
-  }
-  // TimeStamp only moves forward, so the current time should never be earlier
-  // than the shown time. We do not expect this to happen; if it ever does we
-  // want to find out and decide how to handle it, so assert on debug and
-  // Nightly builds. On other builds, fall back to "not protected" so we never
-  // block the user from confirming.
-  MOZ_DIAGNOSTIC_ASSERT(aNow >= aShowTime,
-                        "file picker shown time is in the future");
-  if (aNow < aShowTime) {
-    return false;
-  }
-  return (aNow - aShowTime).ToMilliseconds() < double(aProtectionMs);
-}
-
-bool nsBaseFilePicker::IsContentInitiated() const {
-  if (!mBrowsingContext || !mBrowsingContext->IsContent()) {
-    return false;
-  }
-  // Only web content is subject to input protection. Exempt trusted documents
-  // (system principal and about: pages), which run in a content browsing
-  // context but are not untrusted web content.
-  if (mozilla::dom::WindowGlobalParent* wgp =
-          mBrowsingContext->Canonical()->GetCurrentWindowGlobal()) {
-    if (nsIPrincipal* principal = wgp->DocumentPrincipal()) {
-      return !principal->IsSystemPrincipal() && !principal->SchemeIs("about");
-    }
-  }
-  return true;
-}
-
-bool nsBaseFilePicker::IsPickerInputProtected() const {
-  return IsContentInitiated() &&
-         IsWithinInputProtectionTimeRange(
-             mShowTime, mozilla::TimeStamp::Now(),
-             mozilla::StaticPrefs::security_notification_enable_delay());
-}
-
 nsresult nsBaseFilePicker::ResolveSpecialDirectory(
     const nsAString& aSpecialDirectory) {
   // Only perform special-directory name resolution in the parent process.
diff --git a/widget/nsBaseFilePicker.h b/widget/nsBaseFilePicker.h
index 69e08f05ec1..98997ec4505 100644
--- a/widget/nsBaseFilePicker.h
+++ b/widget/nsBaseFilePicker.h
@@ -6,7 +6,6 @@
 #ifndef nsBaseFilePicker_h_
 #define nsBaseFilePicker_h_
 
-#include "mozilla/TimeStamp.h"
 #include "nsCOMPtr.h"
 #include "nsIFilePicker.h"
 #include "nsISupports.h"
@@ -57,13 +56,6 @@ class nsBaseFilePicker : public nsIFilePicker {
 
   nsIGlobalObject* GetRelevantGlobal() const;
 
-  // This is split out (and public) only so the logic can be unit-tested
-  // without a live picker, pref, or clock; callers should use
-  // IsPickerInputProtected() instead.
-  static bool IsWithinInputProtectionTimeRange(mozilla::TimeStamp aShowTime,
-                                               mozilla::TimeStamp aNow,
-                                               uint32_t aProtectionMs);
-
  protected:
   virtual ~nsBaseFilePicker();
 
@@ -72,24 +64,6 @@ class nsBaseFilePicker : public nsIFilePicker {
   virtual nsresult ResolveSpecialDirectory(const nsAString& aSpecialDirectory);
   bool MaybeBlockFilePicker(nsIFilePickerShownCallback* aCallback);
 
-  // Records the time the native picker was shown to the user. Platform
-  // subclasses call this just before showing the picker.
-  void RecordLastShownTime() { mShowTime = mozilla::TimeStamp::Now(); }
-
-  // Returns true while the picker has been showing for less than
-  // security.notification_enable_delay. Platform subclasses use this to
-  // ignore a confirmation that arrives too soon after the picker appeared.
-  // Only content-initiated pickers (e.g. <input type=file>) are protected;
-  // see IsContentInitiated().
-  bool IsPickerInputProtected() const;
-
-  // True when this picker was opened by untrusted web content rather than by
-  // the browser UI. We only apply input protection to these so that chrome
-  // pickers like "Save As" keep working normally. Pickers in a content
-  // browsing context that host a trusted document (system principal or an
-  // about: page) are also excluded.
-  bool IsContentInitiated() const;
-
   bool mAddToRecentDocs = true;
   nsCOMPtr<nsIFile> mDisplayDirectory;
   nsString mDisplaySpecialDirectory;
@@ -99,7 +73,6 @@ class nsBaseFilePicker : public nsIFilePicker {
   nsIFilePicker::Mode mMode = nsIFilePicker::modeOpen;
   nsString mOkButtonLabel;
   nsTArray<nsString> mRawFilters;
-  mozilla::TimeStamp mShowTime;
 };
 
 #endif  // nsBaseFilePicker_h_
diff --git a/widget/windows/filedialog/PWinFileDialog.ipdl b/widget/windows/filedialog/PWinFileDialog.ipdl
index 6c8dfcd48b7..c34941c2a02 100644
--- a/widget/windows/filedialog/PWinFileDialog.ipdl
+++ b/widget/windows/filedialog/PWinFileDialog.ipdl
@@ -30,9 +30,9 @@ child:
   // Each will return `Ok(Nothing)` if the operation was canceled by the user,
   // or `Err(...)` if the operation actually failed.
 
-  async ShowFileDialog(WindowsHandle parentHwnd, FileDialogType type, Command[] commands, bool needsInputProtection)
+  async ShowFileDialog(WindowsHandle parentHwnd, FileDialogType type, Command[] commands)
     returns (FileResult result);
-  async ShowFolderDialog(WindowsHandle parentHwnd, Command[] commands, bool needsInputProtection)
+  async ShowFolderDialog(WindowsHandle parentHwnd, Command[] commands)
     returns (FolderResult result);
 };
 
diff --git a/widget/windows/filedialog/WinFileDialogChild.cpp b/widget/windows/filedialog/WinFileDialogChild.cpp
index 2a7e58a1e75..eb306d86071 100644
--- a/widget/windows/filedialog/WinFileDialogChild.cpp
+++ b/widget/windows/filedialog/WinFileDialogChild.cpp
@@ -46,11 +46,10 @@ WinFileDialogChild::IPCResult WinFileDialogChild::MakeIpcFailure(
 
 WinFileDialogChild::IPCResult WinFileDialogChild::RecvShowFileDialog(
     uintptr_t parentHwnd, FileDialogType type, nsTArray<Command> commands,
-    bool needsInputProtection, FileResolver&& resolver) {
+    FileResolver&& resolver) {
   MOZ_ABORT_IF_ALREADY_USED();
 
-  auto promise = SpawnFilePicker(HWND(parentHwnd), type, std::move(commands),
-                                 needsInputProtection);
+  auto promise = SpawnFilePicker(HWND(parentHwnd), type, std::move(commands));
   using RRV = std::decay_t<decltype(*promise)>::ResolveOrRejectValue;
 
   promise->Then(GetMainThreadSerialEventTarget(), __PRETTY_FUNCTION__,
@@ -67,12 +66,11 @@ WinFileDialogChild::IPCResult WinFileDialogChild::RecvShowFileDialog(
 }
 
 WinFileDialogChild::IPCResult WinFileDialogChild::RecvShowFolderDialog(
-    uintptr_t parentHwnd, nsTArray<Command> commands, bool needsInputProtection,
+    uintptr_t parentHwnd, nsTArray<Command> commands,
     FolderResolver&& resolver) {
   MOZ_ABORT_IF_ALREADY_USED();
 
-  auto promise = SpawnFolderPicker(HWND(parentHwnd), std::move(commands),
-                                   needsInputProtection);
+  auto promise = SpawnFolderPicker(HWND(parentHwnd), std::move(commands));
   using RRV = std::decay_t<decltype(*promise)>::ResolveOrRejectValue;
 
   promise->Then(GetMainThreadSerialEventTarget(), __PRETTY_FUNCTION__,
diff --git a/widget/windows/filedialog/WinFileDialogChild.h b/widget/windows/filedialog/WinFileDialogChild.h
index 95df1207162..67fefc7fd12 100644
--- a/widget/windows/filedialog/WinFileDialogChild.h
+++ b/widget/windows/filedialog/WinFileDialogChild.h
@@ -23,12 +23,11 @@ class WinFileDialogChild : public PWinFileDialogChild {
  public:
   using FileResolver = PWinFileDialogChild::ShowFileDialogResolver;
   IPCResult RecvShowFileDialog(uintptr_t parentHwnd, FileDialogType,
-                               nsTArray<Command>, bool needsInputProtection,
-                               FileResolver&&);
+                               nsTArray<Command>, FileResolver&&);
 
   using FolderResolver = PWinFileDialogChild::ShowFolderDialogResolver;
   IPCResult RecvShowFolderDialog(uintptr_t parentHwnd, nsTArray<Command>,
-                                 bool needsInputProtection, FolderResolver&&);
+                                 FolderResolver&&);
 
  private:
   ~WinFileDialogChild();
diff --git a/widget/windows/filedialog/WinFileDialogCommands.cpp b/widget/windows/filedialog/WinFileDialogCommands.cpp
index b00a7aff48a..f9f599a0fa2 100644
--- a/widget/windows/filedialog/WinFileDialogCommands.cpp
+++ b/widget/windows/filedialog/WinFileDialogCommands.cpp
@@ -8,20 +8,16 @@
 #include <shtypes.h>
 #include <winerror.h>
 
-#include <atomic>
 #include <type_traits>
 
 #include "WinUtils.h"
 #include "mozilla/Logging.h"
 #include "mozilla/RefPtr.h"
-#include "mozilla/StaticPrefs_security.h"
-#include "mozilla/TimeStamp.h"
 #include "mozilla/WinHeaderOnlyUtils.h"
 #include "mozilla/ipc/LaunchError.h"
 #include "mozilla/ipc/ProtocolUtils.h"
 #include "mozilla/ipc/UtilityProcessManager.h"
 #include "mozilla/mscom/ApartmentRegion.h"
-#include "nsBaseFilePicker.h"
 #include "nsThreadUtils.h"
 
 namespace mozilla::widget::filedialog {
@@ -263,65 +259,6 @@ mozilla::Result<nsString, Error> GetFolderResults(::IFileDialog* dialog) {
 #undef MOZ_ENSURE_HRESULT_OK
 
 namespace detail {
-
-// IFileDialogEvents implementation that ignores a confirmation that arrives
-// before the input-protection time range has passed, by returning S_FALSE from
-// OnFileOk, which keeps the dialog open. It uses the shared timing check in
-// nsBaseFilePicker::IsWithinInputProtectionTimeRange.
-class FileDialogInputProtector final : public IFileDialogEvents {
- public:
-  FileDialogInputProtector() : mShowTime(mozilla::TimeStamp::Now()) {}
-
-  // IUnknown
... (file diff truncated)
Loading diff…

Regression Test / PoC

shipped with the fix
diff --git a/widget/tests/gtest/TestFilePickerInputProtection.cpp b/widget/tests/gtest/TestFilePickerInputProtection.cpp
deleted file mode 100644
index 50bf4c5f940..00000000000
--- a/widget/tests/gtest/TestFilePickerInputProtection.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "gtest/gtest.h"
-#include "mozilla/TimeStamp.h"
-#include "nsBaseFilePicker.h"
-
-using mozilla::TimeDuration;
-using mozilla::TimeStamp;
-
-// Tests the shared timing check used by every platform's file picker to
-// ignore confirmations that arrive before the input-protection time range has
-// passed.
-
-TEST(FilePickerInputProtection, WithinTimeRangeIsProtected)
-{
-  TimeStamp show = TimeStamp::Now();
-  TimeStamp now = show + TimeDuration::FromMilliseconds(100);
-  EXPECT_TRUE(
-      nsBaseFilePicker::IsWithinInputProtectionTimeRange(show, now, 500));
-}
-
-TEST(FilePickerInputProtection, PastTimeRangeIsNotProtected)
-{
-  TimeStamp show = TimeStamp::Now();
-  TimeStamp now = show + TimeDuration::FromMilliseconds(600);
-  EXPECT_FALSE(
-      nsBaseFilePicker::IsWithinInputProtectionTimeRange(show, now, 500));
-}
-
-TEST(FilePickerInputProtection, BoundaryIsNotProtected)
-{
-  // The check uses "less than", so a confirmation exactly at the end of the
-  // time range is accepted.
-  TimeStamp show = TimeStamp::Now();
-  TimeStamp now = show + TimeDuration::FromMilliseconds(500);
-  EXPECT_FALSE(
-      nsBaseFilePicker::IsWithinInputProtectionTimeRange(show, now, 500));
-}
-
-TEST(FilePickerInputProtection, ZeroProtectionDisablesTimeRange)
-{
-  TimeStamp show = TimeStamp::Now();
-  TimeStamp now = show + TimeDuration::FromMilliseconds(1);
-  EXPECT_FALSE(
-      nsBaseFilePicker::IsWithinInputProtectionTimeRange(show, now, 0));
-}
-
-TEST(FilePickerInputProtection, NullShowTimeDisablesTimeRange)
-{
-  TimeStamp now = TimeStamp::Now();
-  EXPECT_FALSE(nsBaseFilePicker::IsWithinInputProtectionTimeRange(TimeStamp(),
-                                                                  now, 500));
-}
diff --git a/widget/tests/gtest/moz.build b/widget/tests/gtest/moz.build
index 005ce05e110..4e73b6d15fe 100644
--- a/widget/tests/gtest/moz.build
+++ b/widget/tests/gtest/moz.build
@@ -3,7 +3,6 @@
 # file, you can obtain one at http://mozilla.org/MPL/2.0/.
 
 UNIFIED_SOURCES = [
-    "TestFilePickerInputProtection.cpp",
     "TestGfxInfo.cpp",
     "TestTimeConverter.cpp",
     "TestTouchResampler.cpp",
Loading diff…