diff options
Diffstat (limited to 'docshell')
75 files changed, 210 insertions, 222 deletions
diff --git a/docshell/base/BaseHistory.cpp b/docshell/base/BaseHistory.cpp index 3932711b5b..84e257a54c 100644 --- a/docshell/base/BaseHistory.cpp +++ b/docshell/base/BaseHistory.cpp @@ -94,8 +94,15 @@ void BaseHistory::RegisterVisitedCallback(nsIURI* aURI, Link* aLink) { mTrackedURIs.WithEntryHandle(aURI, [&](auto&& entry) -> ObservingLinks* { MOZ_DIAGNOSTIC_ASSERT(!entry || !entry->mLinks.IsEmpty(), "An empty key was kept around in our hashtable!"); + if (!entry) { - ScheduleVisitedQuery(aURI, nullptr); + // If the URI has userpass, skip the visit query scheduling, because + // these URIs are not stored by history, and their status is only + // updated at the time of a visit. + bool hasUserPass; + if (NS_FAILED(aURI->GetHasUserPass(&hasUserPass)) || !hasUserPass) { + ScheduleVisitedQuery(aURI, nullptr); + } } return &entry.OrInsertWith([] { return ObservingLinks{}; }); diff --git a/docshell/base/BrowsingContext.cpp b/docshell/base/BrowsingContext.cpp index 141036a86c..6e1a1b6893 100644 --- a/docshell/base/BrowsingContext.cpp +++ b/docshell/base/BrowsingContext.cpp @@ -20,6 +20,7 @@ #endif #include "mozilla/AppShutdown.h" #include "mozilla/dom/CanonicalBrowsingContext.h" +#include "mozilla/dom/BindingIPCUtils.h" #include "mozilla/dom/BrowserHost.h" #include "mozilla/dom/BrowserChild.h" #include "mozilla/dom/BrowserParent.h" @@ -96,23 +97,17 @@ namespace IPC { // Allow serialization and deserialization of OrientationType over IPC template <> struct ParamTraits<mozilla::dom::OrientationType> - : public ContiguousEnumSerializer< - mozilla::dom::OrientationType, - mozilla::dom::OrientationType::Portrait_primary, - mozilla::dom::OrientationType::EndGuard_> {}; + : public mozilla::dom::WebIDLEnumSerializer<mozilla::dom::OrientationType> { +}; template <> struct ParamTraits<mozilla::dom::DisplayMode> - : public ContiguousEnumSerializer<mozilla::dom::DisplayMode, - mozilla::dom::DisplayMode::Browser, - mozilla::dom::DisplayMode::EndGuard_> {}; + : public mozilla::dom::WebIDLEnumSerializer<mozilla::dom::DisplayMode> {}; template <> struct ParamTraits<mozilla::dom::PrefersColorSchemeOverride> - : public ContiguousEnumSerializer< - mozilla::dom::PrefersColorSchemeOverride, - mozilla::dom::PrefersColorSchemeOverride::None, - mozilla::dom::PrefersColorSchemeOverride::EndGuard_> {}; + : public mozilla::dom::WebIDLEnumSerializer< + mozilla::dom::PrefersColorSchemeOverride> {}; template <> struct ParamTraits<mozilla::dom::ExplicitActiveStatus> @@ -124,10 +119,8 @@ struct ParamTraits<mozilla::dom::ExplicitActiveStatus> // Allow serialization and deserialization of TouchEventsOverride over IPC template <> struct ParamTraits<mozilla::dom::TouchEventsOverride> - : public ContiguousEnumSerializer< - mozilla::dom::TouchEventsOverride, - mozilla::dom::TouchEventsOverride::Disabled, - mozilla::dom::TouchEventsOverride::EndGuard_> {}; + : public mozilla::dom::WebIDLEnumSerializer< + mozilla::dom::TouchEventsOverride> {}; template <> struct ParamTraits<mozilla::dom::EmbedderColorSchemes> { @@ -168,6 +161,9 @@ static StaticAutoPtr<BrowsingContextMap> sBrowsingContexts; // Top-level Content BrowsingContexts only, indexed by BrowserId instead of Id static StaticAutoPtr<BrowsingContextMap> sCurrentTopByBrowserId; +static bool gIPCEnabledAnnotation = false; +static bool gFissionEnabledAnnotation = false; + static void UnregisterBrowserId(BrowsingContext* aBrowsingContext) { if (!aBrowsingContext->IsTopContent() || !sCurrentTopByBrowserId) { return; @@ -255,6 +251,11 @@ void BrowsingContext::Init() { sCurrentTopByBrowserId = new BrowsingContextMap(); ClearOnShutdown(&sBrowsingContexts); ClearOnShutdown(&sCurrentTopByBrowserId); + CrashReporter::RegisterAnnotationBool( + CrashReporter::Annotation::DOMIPCEnabled, &gIPCEnabledAnnotation); + CrashReporter::RegisterAnnotationBool( + CrashReporter::Annotation::DOMFissionEnabled, + &gFissionEnabledAnnotation); } } @@ -1665,11 +1666,8 @@ NS_IMETHODIMP BrowsingContext::SetRemoteTabs(bool aUseRemoteTabs) { return NS_ERROR_FAILURE; } - static bool annotated = false; - if (aUseRemoteTabs && !annotated) { - annotated = true; - CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::DOMIPCEnabled, - true); + if (aUseRemoteTabs && !gIPCEnabledAnnotation) { + gIPCEnabledAnnotation = true; } // Don't allow non-remote tabs with remote subframes. @@ -1693,11 +1691,8 @@ NS_IMETHODIMP BrowsingContext::SetRemoteSubframes(bool aUseRemoteSubframes) { return NS_ERROR_FAILURE; } - static bool annotated = false; - if (aUseRemoteSubframes && !annotated) { - annotated = true; - CrashReporter::AnnotateCrashReport( - CrashReporter::Annotation::DOMFissionEnabled, true); + if (aUseRemoteSubframes && !gFissionEnabledAnnotation) { + gFissionEnabledAnnotation = true; } // Don't allow non-remote tabs with remote subframes. diff --git a/docshell/base/CanonicalBrowsingContext.cpp b/docshell/base/CanonicalBrowsingContext.cpp index 33ed5aab28..84f2d2960a 100644 --- a/docshell/base/CanonicalBrowsingContext.cpp +++ b/docshell/base/CanonicalBrowsingContext.cpp @@ -1220,7 +1220,8 @@ Maybe<int32_t> CanonicalBrowsingContext::HistoryGo( // Check for user interaction if desired, except for the first and last // history entries. We compare with >= to account for the case where // aOffset >= length. - if (!aRequireUserInteraction || index.value() >= shistory->Length() - 1 || + if (!StaticPrefs::browser_navigation_requireUserInteraction() || + !aRequireUserInteraction || index.value() >= shistory->Length() - 1 || index.value() <= 0) { break; } @@ -2579,11 +2580,6 @@ nsresult CanonicalBrowsingContext::WriteSessionStorageToSessionStore( void CanonicalBrowsingContext::UpdateSessionStoreSessionStorage( const std::function<void()>& aDone) { - if (!StaticPrefs::browser_sessionstore_collect_session_storage_AtStartup()) { - aDone(); - return; - } - using DataPromise = BackgroundSessionStorageManager::DataPromise; BackgroundSessionStorageManager::GetData( this, StaticPrefs::browser_sessionstore_dom_storage_limit(), @@ -2612,7 +2608,7 @@ void CanonicalBrowsingContext::UpdateSessionStoreForStorage( } void CanonicalBrowsingContext::MaybeScheduleSessionStoreUpdate() { - if (!StaticPrefs::browser_sessionstore_platform_collection_AtStartup()) { + if (!SessionStorePlatformCollection()) { return; } diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index f2a9e0fa59..3404597343 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -5666,7 +5666,7 @@ nsDocShell::OnStateChange(nsIWebProgress* aProgress, nsIRequest* aRequest, mBusyFlags = (BusyFlags)(BUSY_FLAGS_BUSY | BUSY_FLAGS_BEFORE_PAGE_LOAD); if ((aStateFlags & STATE_RESTORING) == 0) { - if (StaticPrefs::browser_sessionstore_platform_collection_AtStartup()) { + if (SessionStorePlatformCollection()) { if (IsForceReloadType(mLoadType)) { if (WindowContext* windowContext = mBrowsingContext->GetCurrentWindowContext()) { @@ -6393,7 +6393,7 @@ nsresult nsDocShell::EndPageLoad(nsIWebProgress* aProgress, // incorrectly overrides session store data from the following load. return NS_OK; } - if (StaticPrefs::browser_sessionstore_platform_collection_AtStartup()) { + if (SessionStorePlatformCollection()) { if (WindowContext* windowContext = mBrowsingContext->GetCurrentWindowContext()) { using Change = SessionStoreChangeListener::Change; @@ -6475,6 +6475,9 @@ nsresult nsDocShell::CreateAboutBlankDocumentViewer( nsCOMPtr<nsIDocumentViewer> viewer; nsresult rv = NS_ERROR_FAILURE; + PROFILER_MARKER_UNTYPED("CreateAboutBlankDocumentViewer", DOM, + MarkerStack::Capture()); + MOZ_ASSERT_IF(aActor, aActor->DocumentPrincipal() == aPrincipal); /* mCreatingDocument should never be true at this point. However, it's @@ -10590,7 +10593,8 @@ static nsresult AppendSegmentToString(nsIInputStream* aIn, void* aClosure, } /* static */ uint32_t nsDocShell::ComputeURILoaderFlags( - BrowsingContext* aBrowsingContext, uint32_t aLoadType) { + BrowsingContext* aBrowsingContext, uint32_t aLoadType, + bool aIsDocumentLoad) { MOZ_ASSERT(aBrowsingContext); uint32_t openFlags = 0; @@ -10601,6 +10605,13 @@ static nsresult AppendSegmentToString(nsIInputStream* aIn, void* aClosure, openFlags |= nsIURILoader::DONT_RETARGET; } + // Unless the pref is set, object/embed loads always specify DONT_RETARGET. + // See bug 1868001 for details. + if (!aIsDocumentLoad && + !StaticPrefs::dom_navigation_object_embed_allow_retargeting()) { + openFlags |= nsIURILoader::DONT_RETARGET; + } + return openFlags; } @@ -11376,11 +11387,14 @@ nsresult nsDocShell::UpdateURLAndHistory(Document* aDocument, nsIURI* aNewURI, if (mozilla::SessionHistoryInParent()) { MOZ_LOG(gSHLog, LogLevel::Debug, ("nsDocShell %p UpdateActiveEntry (not replacing)", this)); + nsString title(mActiveEntry->GetTitle()); + nsCOMPtr<nsIReferrerInfo> referrerInfo = mActiveEntry->GetReferrerInfo(); + UpdateActiveEntry(false, /* aPreviousScrollPos = */ Some(scrollPos), aNewURI, /* aOriginalURI = */ nullptr, - /* aReferrerInfo = */ nullptr, + /* aReferrerInfo = */ referrerInfo, /* aTriggeringPrincipal = */ aDocument->NodePrincipal(), csp, title, scrollRestorationIsManual, aData, uriWasModified); @@ -11399,12 +11413,14 @@ nsresult nsDocShell::UpdateURLAndHistory(Document* aDocument, nsIURI* aNewURI, // mode from the current entry. newSHEntry->SetScrollRestorationIsManual(scrollRestorationIsManual); + // Set the new SHEntry's title (bug 655273). nsString title; mOSHE->GetTitle(title); - - // Set the new SHEntry's title (bug 655273). newSHEntry->SetTitle(title); + nsCOMPtr<nsIReferrerInfo> referrerInfo = mOSHE->GetReferrerInfo(); + newSHEntry->SetReferrerInfo(referrerInfo); + // Link the new SHEntry to the old SHEntry's BFCache entry, since the // two entries correspond to the same document. NS_ENSURE_SUCCESS(newSHEntry->AdoptBFCacheEntry(oldOSHE), @@ -11453,6 +11469,8 @@ nsresult nsDocShell::UpdateURLAndHistory(Document* aDocument, nsIURI* aNewURI, mOSHE = newSHEntry; } + nsCOMPtr<nsIReferrerInfo> referrerInfo = mOSHE->GetReferrerInfo(); + newSHEntry->SetURI(aNewURI); newSHEntry->SetOriginalURI(aNewURI); // We replaced the URI of the entry, clear the unstripped URI as it @@ -11463,6 +11481,7 @@ nsresult nsDocShell::UpdateURLAndHistory(Document* aDocument, nsIURI* aNewURI, // in our case. We could also set it to aNewURI, with the same result. newSHEntry->SetResultPrincipalURI(nullptr); newSHEntry->SetLoadReplace(false); + newSHEntry->SetReferrerInfo(referrerInfo); } if (!mozilla::SessionHistoryInParent()) { diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index 9f2d9a17dc..82ac6c9ab9 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -489,7 +489,8 @@ class nsDocShell final : public nsDocLoader, bool HasDocumentViewer() const { return !!mDocumentViewer; } static uint32_t ComputeURILoaderFlags( - mozilla::dom::BrowsingContext* aBrowsingContext, uint32_t aLoadType); + mozilla::dom::BrowsingContext* aBrowsingContext, uint32_t aLoadType, + bool aIsDocumentLoad = true); void SetLoadingSessionHistoryInfo( const mozilla::dom::LoadingSessionHistoryInfo& aLoadingInfo, diff --git a/docshell/base/nsDocShellTreeOwner.cpp b/docshell/base/nsDocShellTreeOwner.cpp index 9f1ab23a6c..6d8eb11cc6 100644 --- a/docshell/base/nsDocShellTreeOwner.cpp +++ b/docshell/base/nsDocShellTreeOwner.cpp @@ -18,7 +18,7 @@ #include "nsAtom.h" #include "nsReadableUtils.h" #include "nsUnicharUtils.h" -#include "mozilla/LookAndFeel.h" +#include "mozilla/StaticPrefs_ui.h" // Interfaces needed to be included #include "nsPresContext.h" @@ -1177,16 +1177,15 @@ nsresult ChromeTooltipListener::MouseMove(Event* aMouseEvent) { } if (!mShowingTooltip) { - if (nsCOMPtr<EventTarget> eventTarget = aMouseEvent->GetComposedTarget()) { + if (nsCOMPtr<EventTarget> eventTarget = aMouseEvent->GetOriginalTarget()) { mPossibleTooltipNode = nsINode::FromEventTarget(eventTarget); } if (mPossibleTooltipNode) { nsresult rv = NS_NewTimerWithFuncCallback( getter_AddRefs(mTooltipTimer), sTooltipCallback, this, - LookAndFeel::GetInt(LookAndFeel::IntID::TooltipDelay, 500), - nsITimer::TYPE_ONE_SHOT, "ChromeTooltipListener::MouseMove", - GetMainThreadSerialEventTarget()); + StaticPrefs::ui_tooltip_delay_ms(), nsITimer::TYPE_ONE_SHOT, + "ChromeTooltipListener::MouseMove", GetMainThreadSerialEventTarget()); if (NS_FAILED(rv)) { mPossibleTooltipNode = nullptr; NS_WARNING("Could not create a timer for tooltip tracking"); diff --git a/docshell/shistory/ChildSHistory.cpp b/docshell/shistory/ChildSHistory.cpp index 9148491718..3e3cf09493 100644 --- a/docshell/shistory/ChildSHistory.cpp +++ b/docshell/shistory/ChildSHistory.cpp @@ -156,7 +156,8 @@ void ChildSHistory::Go(int32_t aOffset, bool aRequireUserInteraction, // Check for user interaction if desired, except for the first and last // history entries. We compare with >= to account for the case where // aOffset >= Count(). - if (!aRequireUserInteraction || index.value() >= Count() - 1 || + if (!StaticPrefs::browser_navigation_requireUserInteraction() || + !aRequireUserInteraction || index.value() >= Count() - 1 || index.value() <= 0) { break; } diff --git a/docshell/shistory/SessionHistoryEntry.cpp b/docshell/shistory/SessionHistoryEntry.cpp index 692ab4fe44..4f5b760c8a 100644 --- a/docshell/shistory/SessionHistoryEntry.cpp +++ b/docshell/shistory/SessionHistoryEntry.cpp @@ -20,7 +20,7 @@ #include "nsXULAppAPI.h" #include "mozilla/PresState.h" #include "mozilla/StaticPrefs_fission.h" - +#include "mozilla/dom/BindingIPCUtils.h" #include "mozilla/dom/BrowserParent.h" #include "mozilla/dom/CanonicalBrowsingContext.h" #include "mozilla/dom/ContentChild.h" @@ -1797,10 +1797,8 @@ namespace IPC { // Allow sending mozilla::dom::WireframeRectType enums over IPC. template <> struct ParamTraits<mozilla::dom::WireframeRectType> - : public ContiguousEnumSerializer< - mozilla::dom::WireframeRectType, - mozilla::dom::WireframeRectType::Image, - mozilla::dom::WireframeRectType::EndGuard_> {}; + : public mozilla::dom::WebIDLEnumSerializer< + mozilla::dom::WireframeRectType> {}; template <> struct ParamTraits<mozilla::dom::WireframeTaggedRect> { diff --git a/docshell/test/browser/Bug422543Child.sys.mjs b/docshell/test/browser/Bug422543Child.sys.mjs index 524ac33ffd..5870c1d9a7 100644 --- a/docshell/test/browser/Bug422543Child.sys.mjs +++ b/docshell/test/browser/Bug422543Child.sys.mjs @@ -4,7 +4,7 @@ class SHistoryListener { this.last = "initial"; } - OnHistoryNewEntry(aNewURI) { + OnHistoryNewEntry() { this.last = "newentry"; } diff --git a/docshell/test/browser/browser_browsingContext-02.js b/docshell/test/browser/browser_browsingContext-02.js index 8439b869b0..480e8f5494 100644 --- a/docshell/test/browser/browser_browsingContext-02.js +++ b/docshell/test/browser/browser_browsingContext-02.js @@ -178,7 +178,7 @@ add_task(async function () { } let topBrowserId = topBC.browserId; - ok(topBrowserId > 0, "Should have a browser ID."); + Assert.greater(topBrowserId, 0, "Should have a browser ID."); for (let [name, bc] of Object.entries({ first, second, @@ -193,7 +193,7 @@ add_task(async function () { ); } - ok(sixth.browserId > 0, "sixth should have a browserId."); + Assert.greater(sixth.browserId, 0, "sixth should have a browserId."); isnot( sixth.browserId, topBrowserId, diff --git a/docshell/test/browser/browser_browsingContext-webProgress.js b/docshell/test/browser/browser_browsingContext-webProgress.js index 225242be60..d4b566d9d3 100644 --- a/docshell/test/browser/browser_browsingContext-webProgress.js +++ b/docshell/test/browser/browser_browsingContext-webProgress.js @@ -209,7 +209,7 @@ function waitForNextDocumentStart(webProgress) { "nsIWebProgressListener", "nsISupportsWeakReference", ]), - onStateChange(progress, request, flags, status) { + onStateChange(progress, request, flags) { if ( flags & Ci.nsIWebProgressListener.STATE_IS_DOCUMENT && flags & Ci.nsIWebProgressListener.STATE_START diff --git a/docshell/test/browser/browser_bug1206879.js b/docshell/test/browser/browser_bug1206879.js index 38e17633b8..114a3c448b 100644 --- a/docshell/test/browser/browser_bug1206879.js +++ b/docshell/test/browser/browser_bug1206879.js @@ -14,7 +14,7 @@ add_task(async function () { let webprogress = content.docShell.QueryInterface(Ci.nsIWebProgress); let locationChangeCount = 0; let listener = { - onLocationChange(aWebProgress, aRequest, aLocation, aFlags) { + onLocationChange(aWebProgress, aRequest, aLocation) { info("onLocationChange: " + aLocation.spec); locationChangeCount++; this.resolve(); @@ -24,7 +24,7 @@ add_task(async function () { "nsISupportsWeakReference", ]), }; - let locationPromise = new Promise((resolve, reject) => { + let locationPromise = new Promise(resolve => { listener.resolve = resolve; }); webprogress.addProgressListener( diff --git a/docshell/test/browser/browser_bug1594938.js b/docshell/test/browser/browser_bug1594938.js index 569afe6901..30c8de5cb9 100644 --- a/docshell/test/browser/browser_bug1594938.js +++ b/docshell/test/browser/browser_bug1594938.js @@ -24,7 +24,7 @@ add_task(async function test() { let listenerCalled = false; let listener = { - OnHistoryNewEntry: aNewURI => {}, + OnHistoryNewEntry: () => {}, OnHistoryReload: () => { listenerCalled = true; this.content.setTimeout(() => { @@ -64,7 +64,7 @@ add_task(async function test() { let listenerCalled = false; let listener = { - OnHistoryNewEntry: aNewURI => {}, + OnHistoryNewEntry: () => {}, OnHistoryReload: () => { listenerCalled = true; setTimeout(() => { diff --git a/docshell/test/browser/browser_bug1691153.js b/docshell/test/browser/browser_bug1691153.js index ed4969dae8..4e03ef29e2 100644 --- a/docshell/test/browser/browser_bug1691153.js +++ b/docshell/test/browser/browser_bug1691153.js @@ -28,7 +28,7 @@ add_task(async () => { browser, [], async function () { - let blobPromise = new Promise((resolve, reject) => { + let blobPromise = new Promise(resolve => { content.addEventListener("message", event => { if (event.data.bloburl) { info("Sanity check: recvd blob URL as " + event.data.bloburl); diff --git a/docshell/test/browser/browser_bug422543.js b/docshell/test/browser/browser_bug422543.js index d2b6370d03..64160a0be5 100644 --- a/docshell/test/browser/browser_bug422543.js +++ b/docshell/test/browser/browser_bug422543.js @@ -172,7 +172,7 @@ class SHistoryListener { this.last = "initial"; } - OnHistoryNewEntry(aNewURI) { + OnHistoryNewEntry() { this.last = "newentry"; } diff --git a/docshell/test/browser/browser_bug554155.js b/docshell/test/browser/browser_bug554155.js index 223f6241de..748d5056e7 100644 --- a/docshell/test/browser/browser_bug554155.js +++ b/docshell/test/browser/browser_bug554155.js @@ -6,7 +6,7 @@ add_task(async function test() { let numLocationChanges = 0; let listener = { - onLocationChange(browser, webProgress, request, uri, flags) { + onLocationChange(browser, webProgress, request, uri) { info("location change: " + (uri && uri.spec)); numLocationChanges++; }, diff --git a/docshell/test/browser/browser_bug670318.js b/docshell/test/browser/browser_bug670318.js index 6fad3d39e6..12854c0402 100644 --- a/docshell/test/browser/browser_bug670318.js +++ b/docshell/test/browser/browser_bug670318.js @@ -101,7 +101,7 @@ add_task(async function test() { return new Promise(resolve => { addEventListener( "load", - evt => { + () => { let history = docShell.QueryInterface( Ci.nsIWebNavigation ).sessionHistory; diff --git a/docshell/test/browser/browser_bug673467.js b/docshell/test/browser/browser_bug673467.js index 507410254c..6a771866dd 100644 --- a/docshell/test/browser/browser_bug673467.js +++ b/docshell/test/browser/browser_bug673467.js @@ -32,7 +32,7 @@ function test() { let iframe = content.document.getElementById("iframe"); iframe.addEventListener( "load", - function listener(aEvent) { + function listener() { // Wait for the iframe to load the new document, not about:blank. if (!iframe.src) { return; diff --git a/docshell/test/browser/browser_bug852909.js b/docshell/test/browser/browser_bug852909.js index 108baa0626..d148a830d5 100644 --- a/docshell/test/browser/browser_bug852909.js +++ b/docshell/test/browser/browser_bug852909.js @@ -10,7 +10,7 @@ function test() { BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(image); } -function image(event) { +function image() { ok( !gBrowser.selectedTab.mayEnableCharacterEncodingMenu, "Docshell should say the menu should be disabled for images." @@ -24,7 +24,7 @@ function image(event) { BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(pdf); } -function pdf(event) { +function pdf() { ok( !gBrowser.selectedTab.mayEnableCharacterEncodingMenu, "Docshell should say the menu should be disabled for PDF.js." diff --git a/docshell/test/browser/browser_click_link_within_view_source.js b/docshell/test/browser/browser_click_link_within_view_source.js index 73542f977a..96082798b1 100644 --- a/docshell/test/browser/browser_click_link_within_view_source.js +++ b/docshell/test/browser/browser_click_link_within_view_source.js @@ -18,7 +18,7 @@ add_task(async function test_click_link_within_view_source() { DUMMY_FILE_URI.append(DUMMY_FILE); DUMMY_FILE_URI = Services.io.newFileURI(DUMMY_FILE_URI).spec; - await BrowserTestUtils.withNewTab(TEST_FILE_URI, async function (aBrowser) { + await BrowserTestUtils.withNewTab(TEST_FILE_URI, async function () { let tabSpec = gBrowser.selectedBrowser.currentURI.spec; info("loading: " + tabSpec); ok( diff --git a/docshell/test/browser/browser_cross_process_csp_inheritance.js b/docshell/test/browser/browser_cross_process_csp_inheritance.js index 76be61d0f9..beba5bae91 100644 --- a/docshell/test/browser/browser_cross_process_csp_inheritance.js +++ b/docshell/test/browser/browser_cross_process_csp_inheritance.js @@ -79,7 +79,7 @@ function verifyResult( } async function simulateCspInheritanceForNewTab(aTestName, aSamePID) { - await BrowserTestUtils.withNewTab(TEST_URI, async function (browser) { + await BrowserTestUtils.withNewTab(TEST_URI, async function () { // do some sanity checks let currentURI = await getCurrentURI(gBrowser.selectedBrowser); is(currentURI, TEST_URI, aTestName + ": correct test uri loaded"); diff --git a/docshell/test/browser/browser_csp_sandbox_no_script_js_uri.js b/docshell/test/browser/browser_csp_sandbox_no_script_js_uri.js index d0b92084ec..b5ee19c98e 100644 --- a/docshell/test/browser/browser_csp_sandbox_no_script_js_uri.js +++ b/docshell/test/browser/browser_csp_sandbox_no_script_js_uri.js @@ -20,8 +20,9 @@ add_task(async function test_csp_sandbox_no_script_js_uri() { let observerPromise = SpecialPowers.spawn(browser, [], () => { return new Promise(resolve => { SpecialPowers.addObserver(function obs(subject) { - ok( - subject == content, + Assert.equal( + subject, + content, "Should block script spawned via javascript uri" ); SpecialPowers.removeObserver( diff --git a/docshell/test/browser/browser_csp_uir.js b/docshell/test/browser/browser_csp_uir.js index 2eb36d3d4d..7a7bb55994 100644 --- a/docshell/test/browser/browser_csp_uir.js +++ b/docshell/test/browser/browser_csp_uir.js @@ -40,7 +40,7 @@ add_task(async function test_csp_inheritance_regular_click() { }); add_task(async function test_csp_inheritance_ctrl_click() { - await BrowserTestUtils.withNewTab(TEST_URI, async function (browser) { + await BrowserTestUtils.withNewTab(TEST_URI, async function () { let loadPromise = BrowserTestUtils.waitForNewTab( gBrowser, RESULT_URI, @@ -61,7 +61,7 @@ add_task(async function test_csp_inheritance_ctrl_click() { add_task( async function test_csp_inheritance_right_click_open_link_in_new_tab() { - await BrowserTestUtils.withNewTab(TEST_URI, async function (browser) { + await BrowserTestUtils.withNewTab(TEST_URI, async function () { let loadPromise = BrowserTestUtils.waitForNewTab(gBrowser, RESULT_URI); // set the data href + simulate right-click open link in tab BrowserTestUtils.waitForEvent(document, "popupshown", false, event => { diff --git a/docshell/test/browser/browser_data_load_inherit_csp.js b/docshell/test/browser/browser_data_load_inherit_csp.js index b2bc86e0ea..d638d601a3 100644 --- a/docshell/test/browser/browser_data_load_inherit_csp.js +++ b/docshell/test/browser/browser_data_load_inherit_csp.js @@ -59,7 +59,7 @@ add_task(async function test_data_csp_inheritance_regular_click() { }); add_task(async function test_data_csp_inheritance_ctrl_click() { - await BrowserTestUtils.withNewTab(HTML_URI, async function (browser) { + await BrowserTestUtils.withNewTab(HTML_URI, async function () { let loadPromise = BrowserTestUtils.waitForNewTab(gBrowser, DATA_URI, true); // set the data href + simulate ctrl+click await setDataHrefOnLink(gBrowser.selectedBrowser, DATA_URI); @@ -77,7 +77,7 @@ add_task(async function test_data_csp_inheritance_ctrl_click() { add_task( async function test_data_csp_inheritance_right_click_open_link_in_new_tab() { - await BrowserTestUtils.withNewTab(HTML_URI, async function (browser) { + await BrowserTestUtils.withNewTab(HTML_URI, async function () { let loadPromise = BrowserTestUtils.waitForNewTab( gBrowser, DATA_URI, diff --git a/docshell/test/browser/browser_onbeforeunload_navigation.js b/docshell/test/browser/browser_onbeforeunload_navigation.js index 23dc3b528e..ee49923e68 100644 --- a/docshell/test/browser/browser_onbeforeunload_navigation.js +++ b/docshell/test/browser/browser_onbeforeunload_navigation.js @@ -15,7 +15,7 @@ var tabStateListener = { resolveLoad: null, expectLoad: null, - onStateChange(webprogress, request, flags, status) { + onStateChange(webprogress, request, flags) { const WPL = Ci.nsIWebProgressListener; if (flags & WPL.STATE_IS_WINDOW) { if (flags & WPL.STATE_START) { diff --git a/docshell/test/browser/browser_onbeforeunload_parent.js b/docshell/test/browser/browser_onbeforeunload_parent.js index 72c5004334..f4441b38a7 100644 --- a/docshell/test/browser/browser_onbeforeunload_parent.js +++ b/docshell/test/browser/browser_onbeforeunload_parent.js @@ -22,7 +22,7 @@ add_task(async function () { ); info(`Testing tab close from parent process`); - await doTest(actions, -1, (tab, frames) => { + await doTest(actions, -1, tab => { let eventLoopSpun = false; Services.tm.dispatchToMainThread(() => { eventLoopSpun = true; diff --git a/docshell/test/browser/browser_targetTopLevelLinkClicksToBlank.js b/docshell/test/browser/browser_targetTopLevelLinkClicksToBlank.js index 9d5a91bef9..3bd8815e81 100644 --- a/docshell/test/browser/browser_targetTopLevelLinkClicksToBlank.js +++ b/docshell/test/browser/browser_targetTopLevelLinkClicksToBlank.js @@ -246,7 +246,7 @@ add_task(async function skip_blank_target_for_some_loads() { await SpecialPowers.spawn(currentBrowser, [TEST_PAGE], async newPageURL => { let anchor = content.document.querySelector(`a[href=".."]`); anchor.href = "javascript:void(0);"; - anchor.addEventListener("click", e => { + anchor.addEventListener("click", () => { content.location.href = newPageURL; }); let userInput = content.windowUtils.setHandlingUserInput(true); @@ -268,7 +268,7 @@ add_task(async function skip_blank_target_for_some_loads() { await SpecialPowers.spawn(currentBrowser, [TEST_PAGE], async newPageURL => { let anchor = content.document.querySelector(`a[href=".."]`); anchor.href = `javascript:"string-to-navigate-to"`; - anchor.addEventListener("click", e => { + anchor.addEventListener("click", () => { content.location.href = newPageURL; }); let userInput = content.windowUtils.setHandlingUserInput(true); diff --git a/docshell/test/browser/file_bug1328501_framescript.js b/docshell/test/browser/file_bug1328501_framescript.js index 19c86c75e7..1f20f631df 100644 --- a/docshell/test/browser/file_bug1328501_framescript.js +++ b/docshell/test/browser/file_bug1328501_framescript.js @@ -4,13 +4,13 @@ addEventListener( "frames-loaded", - e => sendAsyncMessage("test:frames-loaded"), + () => sendAsyncMessage("test:frames-loaded"), true, true ); let requestObserver = { - observe(subject, topic, data) { + observe(subject, topic) { if (topic == "http-on-opening-request") { // Get DOMWindow on all child docshells to force about:blank // content viewers being created. diff --git a/docshell/test/browser/head_browser_onbeforeunload.js b/docshell/test/browser/head_browser_onbeforeunload.js index 6bb334b793..3ba0bf54ac 100644 --- a/docshell/test/browser/head_browser_onbeforeunload.js +++ b/docshell/test/browser/head_browser_onbeforeunload.js @@ -4,19 +4,12 @@ const BASE_URL = "http://mochi.test:8888/browser/docshell/test/browser/"; const TEST_PAGE = BASE_URL + "file_onbeforeunload_0.html"; -const CONTENT_PROMPT_SUBDIALOG = Services.prefs.getBoolPref( - "prompts.contentPromptSubDialog", - false -); - const { PromptTestUtils } = ChromeUtils.importESModule( "resource://testing-common/PromptTestUtils.sys.mjs" ); async function withTabModalPromptCount(expected, task) { - const DIALOG_TOPIC = CONTENT_PROMPT_SUBDIALOG - ? "common-dialog-loaded" - : "tabmodal-dialog-loaded"; + const DIALOG_TOPIC = "common-dialog-loaded"; let count = 0; function observer() { diff --git a/docshell/test/chrome/DocShellHelpers.sys.mjs b/docshell/test/chrome/DocShellHelpers.sys.mjs index 5f4eee8724..f57cdee321 100644 --- a/docshell/test/chrome/DocShellHelpers.sys.mjs +++ b/docshell/test/chrome/DocShellHelpers.sys.mjs @@ -31,7 +31,7 @@ export class DocShellHelpersChild extends JSWindowActorChild { constructor() { super(); } - receiveMessage({ name, data }) { + receiveMessage({ name }) { if (name == "docshell_helpers:preventBFCache") { // Add an RTCPeerConnection to prevent the page from being bfcached. let win = this.contentWindow; diff --git a/docshell/test/chrome/bug113934_window.xhtml b/docshell/test/chrome/bug113934_window.xhtml index c5b676b6b8..8666b60e17 100644 --- a/docshell/test/chrome/bug113934_window.xhtml +++ b/docshell/test/chrome/bug113934_window.xhtml @@ -92,7 +92,7 @@ var strs = { "f1": "", "f3" : "" }; function attachListener(node, type) { - var listener = function(e) { + var listener = function() { if (strs[node.id]) strs[node.id] += " "; strs[node.id] += node.id + ".page" + type; } diff --git a/docshell/test/chrome/bug215405_window.xhtml b/docshell/test/chrome/bug215405_window.xhtml index ddbe2630b9..af5ecdde48 100644 --- a/docshell/test/chrome/bug215405_window.xhtml +++ b/docshell/test/chrome/bug215405_window.xhtml @@ -58,7 +58,7 @@ }); } - function onLoad(e) { + function onLoad() { gBrowser = document.getElementById("content"); gBrowser.addEventListener("pageshow", eventListener, true); @@ -66,7 +66,7 @@ nextTest(); } - function eventListener(event) { + function eventListener() { setTimeout(nextTest, 0); } diff --git a/docshell/test/chrome/bug293235_window.xhtml b/docshell/test/chrome/bug293235_window.xhtml index 8bb050cebb..e631b3b09b 100644 --- a/docshell/test/chrome/bug293235_window.xhtml +++ b/docshell/test/chrome/bug293235_window.xhtml @@ -67,7 +67,7 @@ // Because adding visits is async, we will not be notified immediately. let visitObserver = { - observe(aSubject, aTopic, aData) + observe(aSubject, aTopic) { if (!testURI.equals(aSubject.QueryInterface(Ci.nsIURI))) { return; diff --git a/docshell/test/chrome/bug301397_window.xhtml b/docshell/test/chrome/bug301397_window.xhtml index cbfa77f7fd..4a6efc8622 100644 --- a/docshell/test/chrome/bug301397_window.xhtml +++ b/docshell/test/chrome/bug301397_window.xhtml @@ -18,7 +18,7 @@ // content. // async function verifyIframeInnerHtml(string) { - var iframeInnerHtml = await SpecialPowers.spawn(document.getElementById("content"), [string], (string) => + var iframeInnerHtml = await SpecialPowers.spawn(document.getElementById("content"), [string], () => content.document.getElementById("iframe").contentDocument.body.innerHTML); ok(iframeInnerHtml.includes(string), "iframe contains wrong document: " + iframeInnerHtml); diff --git a/docshell/test/chrome/bug449778_window.xhtml b/docshell/test/chrome/bug449778_window.xhtml index 3197b7acf4..0a4a6465a8 100644 --- a/docshell/test/chrome/bug449778_window.xhtml +++ b/docshell/test/chrome/bug449778_window.xhtml @@ -42,7 +42,7 @@ function doTheTest() { var strs = { "f1": "", "f2" : "" }; function attachListener(node, type) { - var listener = function(e) { + var listener = function() { if (strs[node.id]) strs[node.id] += " "; strs[node.id] += node.id + ".page" + type; } diff --git a/docshell/test/chrome/docshell_helpers.js b/docshell/test/chrome/docshell_helpers.js index 7f16708087..79d92385a8 100644 --- a/docshell/test/chrome/docshell_helpers.js +++ b/docshell/test/chrome/docshell_helpers.js @@ -230,6 +230,12 @@ function doPageNavigation(params) { observers: observers.keys(), }, allFrames: true, + // We avoid messages from system addons event pages here, as + // the tests test_bug321671.xhtml and test_bug690056.xhtml do + // not expect those events, and so will intermittently fail. + // They require messages from "browsers", "test", and "" to pass. + // See bug 1784831 and bug 1883434 for more context. + messageManagerGroups: ["browsers", "test", ""], }); DocShellHelpersParent.eventsToListenFor = eventsToListenFor; DocShellHelpersParent.observers = observers; @@ -269,11 +275,7 @@ function doPageNavigation(params) { if (cleanup) { // Register a cleanup function on domwindowclosed, to avoid contaminating // other tests if we bail out early because of an error. - Services.ww.registerNotification(function windowClosed( - subject, - topic, - data - ) { + Services.ww.registerNotification(function windowClosed(subject, topic) { if (topic == "domwindowclosed" && subject == window) { Services.ww.unregisterNotification(windowClosed); cleanup(); @@ -596,7 +598,7 @@ function finish() { let SimpleTest = opener.wrappedJSObject.SimpleTest; // Wait for the window to be closed before finishing the test - Services.ww.registerNotification(function observer(subject, topic, data) { + Services.ww.registerNotification(function observer(subject, topic) { if (topic == "domwindowclosed") { Services.ww.unregisterNotification(observer); SimpleTest.waitForFocus(SimpleTest.finish, opener); diff --git a/docshell/test/chrome/mozFrameType_window.xhtml b/docshell/test/chrome/mozFrameType_window.xhtml index e5d0126d22..4264462c32 100644 --- a/docshell/test/chrome/mozFrameType_window.xhtml +++ b/docshell/test/chrome/mozFrameType_window.xhtml @@ -30,7 +30,7 @@ // First focus the parent window and then close this one. SimpleTest.waitForFocus(function() { let ww = SpecialPowers.Services.ww; - ww.registerNotification(function windowObs(subject, topic, data) { + ww.registerNotification(function windowObs(subject, topic) { if (topic == "domwindowclosed") { ww.unregisterNotification(windowObs); diff --git a/docshell/test/chrome/test_bug565388.xhtml b/docshell/test/chrome/test_bug565388.xhtml index 4da580c117..06f2645c5d 100644 --- a/docshell/test/chrome/test_bug565388.xhtml +++ b/docshell/test/chrome/test_bug565388.xhtml @@ -35,7 +35,7 @@ function test() { this.callback(); }, - onStateChange (webProgress, req, flags, status) { + onStateChange (webProgress, req, flags) { if (req.name.startsWith("data:application/vnd.mozilla.xul")) { if (flags & Ci.nsIWebProgressListener.STATE_STOP) this.finish(); diff --git a/docshell/test/chrome/test_bug789773.xhtml b/docshell/test/chrome/test_bug789773.xhtml index 196d40e12d..f378f7a77b 100644 --- a/docshell/test/chrome/test_bug789773.xhtml +++ b/docshell/test/chrome/test_bug789773.xhtml @@ -33,7 +33,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=789773 var calledListenerForBrowserChromeURL = false; var testProgressListener = { START_DOC: Ci.nsIWebProgressListener.STATE_START | Ci.nsIWebProgressListener.STATE_IS_DOCUMENT, - onStateChange(wp, req, stateFlags, status) { + onStateChange(wp, req, stateFlags) { let browserChromeFileName = AppConstants.BROWSER_CHROME_URL.split("/").reverse()[0]; if (req.name.includes(browserChromeFileName)) { wp.DOMWindow; // Force the lazy creation of a DOM window. diff --git a/docshell/test/chrome/test_bug909218.html b/docshell/test/chrome/test_bug909218.html index bcbcc176eb..7b20b3a8ad 100644 --- a/docshell/test/chrome/test_bug909218.html +++ b/docshell/test/chrome/test_bug909218.html @@ -83,7 +83,7 @@ var RequestWatcher = { this.callback(); }, - onStateChange(webProgress, req, flags, status) { + onStateChange(webProgress, req, flags) { // We are checking requests - if there isn't one, ignore it. if (!req) { return; diff --git a/docshell/test/chrome/test_docRedirect.xhtml b/docshell/test/chrome/test_docRedirect.xhtml index 56fdc1c5d2..7cb61cc464 100644 --- a/docshell/test/chrome/test_docRedirect.xhtml +++ b/docshell/test/chrome/test_docRedirect.xhtml @@ -42,7 +42,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1342989 this.callback(success); }, - onStateChange (webProgress, req, flags, status) { + onStateChange (webProgress, req, flags) { if (!(flags & Ci.nsIWebProgressListener.STATE_IS_DOCUMENT) && !(flags & Ci.nsIWebProgressListener.STATE_IS_REDIRECTED_DOCUMENT)) return; diff --git a/docshell/test/chrome/test_viewsource_forbidden_in_iframe.xhtml b/docshell/test/chrome/test_viewsource_forbidden_in_iframe.xhtml index 0cc45c7821..d35d9400ce 100644 --- a/docshell/test/chrome/test_viewsource_forbidden_in_iframe.xhtml +++ b/docshell/test/chrome/test_viewsource_forbidden_in_iframe.xhtml @@ -37,7 +37,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=624883 } }, - onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) { + onStateChange(aWebProgress) { // Wait until the documentURI changes (from about:blank) this should // be the error page URI. var documentURI = frame.contentDocument.documentURI; diff --git a/docshell/test/mochitest/clicker.html b/docshell/test/mochitest/clicker.html index b655e27ea5..476741e649 100644 --- a/docshell/test/mochitest/clicker.html +++ b/docshell/test/mochitest/clicker.html @@ -3,5 +3,5 @@ "use strict"; let target = window.opener ? window.opener : window.parent; - onmessage = ({data}) => target.postMessage({}, "*"); + onmessage = () => target.postMessage({}, "*"); </script> diff --git a/docshell/test/mochitest/double_submit.sjs b/docshell/test/mochitest/double_submit.sjs index 4ca088173c..edbb92a613 100644 --- a/docshell/test/mochitest/double_submit.sjs +++ b/docshell/test/mochitest/double_submit.sjs @@ -13,7 +13,7 @@ const BinaryInputStream = CC( "setInputStream" ); -function log(str) { +function log() { // dump(`LOG: ${str}\n`); } diff --git a/docshell/test/mochitest/file_bug1850335_1.html b/docshell/test/mochitest/file_bug1850335_1.html index f317d2197a..09aa7a42cf 100644 --- a/docshell/test/mochitest/file_bug1850335_1.html +++ b/docshell/test/mochitest/file_bug1850335_1.html @@ -1,5 +1,5 @@ <script> -addEventListener("load", ({ persisted }) => { +addEventListener("load", () => { document.getElementById("input1").value = ""; }); addEventListener("pageshow", ({ persisted }) => { diff --git a/docshell/test/mochitest/file_bug511449.html b/docshell/test/mochitest/file_bug511449.html deleted file mode 100644 index 637732dbbf..0000000000 --- a/docshell/test/mochitest/file_bug511449.html +++ /dev/null @@ -1,6 +0,0 @@ -<!DOCTYPE HTML> -<title>Used in test for bug 511449</title> -<input type="text" id="input"> -<script type="text/javascript"> - document.getElementById("input").focus(); -</script> diff --git a/docshell/test/mochitest/file_content_javascript_loads_root.html b/docshell/test/mochitest/file_content_javascript_loads_root.html index b9f2c1faa7..8475ee979c 100644 --- a/docshell/test/mochitest/file_content_javascript_loads_root.html +++ b/docshell/test/mochitest/file_content_javascript_loads_root.html @@ -10,7 +10,7 @@ window.onload = () => { }; // eslint-disable-next-line no-shadow -function promiseMessage(source, filter = event => true) { +function promiseMessage(source, filter = () => true) { return new Promise(resolve => { function listener(event) { if (event.source == source && filter(event)) { diff --git a/docshell/test/mochitest/form_submit.sjs b/docshell/test/mochitest/form_submit.sjs index 1a1fa5d89c..cb6bb9e60f 100644 --- a/docshell/test/mochitest/form_submit.sjs +++ b/docshell/test/mochitest/form_submit.sjs @@ -13,7 +13,7 @@ const BinaryOutputStream = CC( "setOutputStream" ); -function log(str) { +function log() { // dump(`LOG: ${str}\n`); } diff --git a/docshell/test/mochitest/historyframes.html b/docshell/test/mochitest/historyframes.html index 31f46a5071..da9c3a0936 100644 --- a/docshell/test/mochitest/historyframes.html +++ b/docshell/test/mochitest/historyframes.html @@ -112,7 +112,7 @@ function* test_state_navigation() { is(getURL(), URL2, "URL should be correct"); is(getContent(), "Test2", "Page should be correct"); - window.addEventListener("popstate", (e) => { + window.addEventListener("popstate", () => { continueAsync(); }, {once: true}); window.history.back(); @@ -122,7 +122,7 @@ function* test_state_navigation() { is(getURL(), URL2, "URL should be correct"); is(getContent(), "Test2", "Page should be correct"); - window.addEventListener("popstate", (e) => { + window.addEventListener("popstate", () => { continueAsync(); }, {once: true}); window.history.forward(); @@ -132,13 +132,13 @@ function* test_state_navigation() { is(getURL(), URL2, "URL should be correct"); is(getContent(), "Test2", "Page should be correct"); - window.addEventListener("popstate", (e) => { + window.addEventListener("popstate", () => { continueAsync(); }, {once: true}); window.history.back(); yield; - window.addEventListener("popstate", (e) => { + window.addEventListener("popstate", () => { continueAsync(); }, {once: true}); window.history.back(); diff --git a/docshell/test/mochitest/mochitest.toml b/docshell/test/mochitest/mochitest.toml index 8d593c9e36..93c1d1f9b1 100644 --- a/docshell/test/mochitest/mochitest.toml +++ b/docshell/test/mochitest/mochitest.toml @@ -78,15 +78,6 @@ skip-if = ["true"] # Disabled for too many intermittent failures (bug 719186) ["test_bug509055.html"] -["test_bug511449.html"] -skip-if = [ - "os == 'win'", - "os == 'linux'", - "os == 'android'", - "headless", # Headless: bug 1410525 -] -support-files = ["file_bug511449.html"] - ["test_bug529119-1.html"] ["test_bug529119-2.html"] diff --git a/docshell/test/mochitest/test_bug509055.html b/docshell/test/mochitest/test_bug509055.html index 57ede19b43..9954866fa1 100644 --- a/docshell/test/mochitest/test_bug509055.html +++ b/docshell/test/mochitest/test_bug509055.html @@ -28,14 +28,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=509055 setTimeout(function() { gGen.next(); }, 0, false); } - function onChildHashchange(e) { + function onChildHashchange() { // gGen might be undefined when we refresh the page, so we have to check here dump("onChildHashchange() called.\n"); if (gGen) gGen.next(); } - function onChildLoad(e) { + function onChildLoad() { if (gGen) gGen.next(); } diff --git a/docshell/test/mochitest/test_bug511449.html b/docshell/test/mochitest/test_bug511449.html deleted file mode 100644 index da95909d1c..0000000000 --- a/docshell/test/mochitest/test_bug511449.html +++ /dev/null @@ -1,56 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=511449 ---> -<head> - <title>Test for Bug 511449</title> - <script src="/tests/SimpleTest/SimpleTest.js"></script> - <script src="/tests/SimpleTest/EventUtils.js"></script> - <script src="/tests/SimpleTest/NativeKeyCodes.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> -</head> -<body> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=511449">Mozilla Bug 511449</a> -<p id="display"></p> -<div id="status"></div> -<div id="content"> -</div> -<input type="text" id="input"> -<pre id="test"> -<script type="application/javascript"> - -/** Test for Bug 511449 */ - -SimpleTest.waitForExplicitFinish(); -SimpleTest.requestFlakyTimeout("untriaged"); -window.addEventListener("load", runTest); - -var win = null; - -function runTest() { - document.getElementById("input").focus(); - win = window.open("file_bug511449.html", ""); - SimpleTest.waitForFocus(runNextTest, win); -} - -function runNextTest() { - var didClose = false; - win.onunload = function() { - didClose = true; - }; - synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, MAC_VK_ANSI_W, {metaKey: 1}, "w", "w"); - - setTimeout(function() { - ok(didClose, "Cmd+W should have closed the tab"); - if (!didClose) { - win.close(); - } - SimpleTest.finish(); - }, 1000); -} - -</script> - -</body> -</html> diff --git a/docshell/test/mochitest/test_bug529119-1.html b/docshell/test/mochitest/test_bug529119-1.html index 1c89780fc7..7a7098a0c8 100644 --- a/docshell/test/mochitest/test_bug529119-1.html +++ b/docshell/test/mochitest/test_bug529119-1.html @@ -28,7 +28,7 @@ async function assignToken(tokenToAssign) { newToken => { this.content.token = newToken }); } -async function pollForPage(win) { +async function pollForPage() { while (true) { try { // When we do our navigation, there may be an interstitial about:blank diff --git a/docshell/test/mochitest/test_bug680257.html b/docshell/test/mochitest/test_bug680257.html index 4d5736ac0a..3c9b339550 100644 --- a/docshell/test/mochitest/test_bug680257.html +++ b/docshell/test/mochitest/test_bug680257.html @@ -20,7 +20,7 @@ var popup = window.open("file_bug680257.html"); var gTestContinuation = null; function continueAsync() { popup.addEventListener("hashchange", - function(e) { gTestContinuation.next(); }, { once: true }); + function() { gTestContinuation.next(); }, { once: true }); } // The popup will call into popupLoaded() once it loads. diff --git a/docshell/test/mochitest/test_content_javascript_loads.html b/docshell/test/mochitest/test_content_javascript_loads.html index eabc1d314e..d82cdf35aa 100644 --- a/docshell/test/mochitest/test_content_javascript_loads.html +++ b/docshell/test/mochitest/test_content_javascript_loads.html @@ -13,7 +13,7 @@ <script type="application/javascript"> "use strict"; -function promiseMessage(source, filter = event => true) { +function promiseMessage(source, filter = () => true) { return new Promise(resolve => { function listener(event) { if (event.source == source && filter(event)) { diff --git a/docshell/test/moz.build b/docshell/test/moz.build index 0cdf1633c1..36113f295c 100644 --- a/docshell/test/moz.build +++ b/docshell/test/moz.build @@ -74,9 +74,6 @@ with Files("mochitest/*402210*"): with Files("mochitest/*509055*"): BUG_COMPONENT = ("Firefox", "Bookmarks & History") -with Files("mochitest/*511449*"): - BUG_COMPONENT = ("Core", "Widget: Cocoa") - with Files("mochitest/*551225*"): BUG_COMPONENT = ("Core", "DOM: Core & HTML") diff --git a/docshell/test/navigation/file_bug1326251.html b/docshell/test/navigation/file_bug1326251.html index 57a81f46f1..35645d031e 100644 --- a/docshell/test/navigation/file_bug1326251.html +++ b/docshell/test/navigation/file_bug1326251.html @@ -171,9 +171,9 @@ ]; function awaitOnload(frame, occurances = 1) { - return new Promise(function(resolve, reject) { + return new Promise(function(resolve) { let count = 0; - frame.addEventListener("load", function listener(e) { + frame.addEventListener("load", function listener() { if (++count == occurances) { frame.removeEventListener("load", listener); setTimeout(resolve, 0); diff --git a/docshell/test/navigation/file_bug1375833.html b/docshell/test/navigation/file_bug1375833.html index 373a7fe08e..6d39f30281 100644 --- a/docshell/test/navigation/file_bug1375833.html +++ b/docshell/test/navigation/file_bug1375833.html @@ -10,7 +10,7 @@ function test() { let iframe = document.querySelector("#testFrame"); setTimeout(function() { iframe.src = "file_bug1375833-frame1.html"; }, 0); - iframe.onload = function(e) { + iframe.onload = function() { setTimeout(function() { iframe.src = "file_bug1375833-frame2.html"; }, 0); iframe.onload = function() { opener.postMessage(iframe.contentWindow.location.href, "*"); diff --git a/docshell/test/navigation/file_bug1609475.html b/docshell/test/navigation/file_bug1609475.html index 7699d46b08..fd2a061e88 100644 --- a/docshell/test/navigation/file_bug1609475.html +++ b/docshell/test/navigation/file_bug1609475.html @@ -3,7 +3,7 @@ <script> var loadCount = 0; - function loadListener(event) { + function loadListener() { ++loadCount; if (loadCount == 2) { // Use a timer to ensure we don't get extra load events. diff --git a/docshell/test/navigation/file_scrollRestoration_part3_nobfcache.html b/docshell/test/navigation/file_scrollRestoration_part3_nobfcache.html index ffc68d6ccc..abeff1330d 100644 --- a/docshell/test/navigation/file_scrollRestoration_part3_nobfcache.html +++ b/docshell/test/navigation/file_scrollRestoration_part3_nobfcache.html @@ -16,7 +16,7 @@ // If onpopstate event takes place, check if we need to call 'test()' var callTest = false; var nextCase = 0; - window.onpopstate = (e) => { + window.onpopstate = () => { if (callTest) { callTest = false; setTimeout(() => { diff --git a/docshell/test/navigation/file_session_history_on_redirect.html b/docshell/test/navigation/file_session_history_on_redirect.html index df7e99a1dd..e7dce7c4a1 100644 --- a/docshell/test/navigation/file_session_history_on_redirect.html +++ b/docshell/test/navigation/file_session_history_on_redirect.html @@ -6,7 +6,7 @@ opener.is(event.persisted, false, "Should have disabled bfcache for this test."); } - window.onpageshow = function(event) { + window.onpageshow = function() { opener.pageshow(); } </script> diff --git a/docshell/test/navigation/file_session_history_on_redirect_2.html b/docshell/test/navigation/file_session_history_on_redirect_2.html index df7e99a1dd..e7dce7c4a1 100644 --- a/docshell/test/navigation/file_session_history_on_redirect_2.html +++ b/docshell/test/navigation/file_session_history_on_redirect_2.html @@ -6,7 +6,7 @@ opener.is(event.persisted, false, "Should have disabled bfcache for this test."); } - window.onpageshow = function(event) { + window.onpageshow = function() { opener.pageshow(); } </script> diff --git a/docshell/test/navigation/mochitest.toml b/docshell/test/navigation/mochitest.toml index ce0fa0d18f..811ad7c89d 100644 --- a/docshell/test/navigation/mochitest.toml +++ b/docshell/test/navigation/mochitest.toml @@ -132,7 +132,10 @@ skip-if = ["os == 'android'"] ["test_bug430723.html"] skip-if = [ - "!debug && (os == 'mac' || os == 'win')", # Bug 874423 + "win10_2009 && !debug", # Bug 874423 + "win11_2009 && !debug", # Bug 874423 + "apple_silicon && !debug", # Bug 874423 + "apple_catalina && !debug", # Bug 874423 "http3", "http2", ] @@ -284,7 +287,7 @@ support-files = ["file_same_url.html"] ["test_session_history_on_redirect.html"] ["test_sessionhistory.html"] -skip-if = ["verify && os == 'mac' && debug"] # Hit MOZ_CRASH(Shutdown too long, probably frozen, causing a crash.) bug 1677545 +skip-if = ["os == 'mac' && debug && verify"] # Hit MOZ_CRASH(Shutdown too long, probably frozen, causing a crash.) bug 1677545 ["test_sessionhistory_document_write.html"] diff --git a/docshell/test/navigation/test_blockBFCache.html b/docshell/test/navigation/test_blockBFCache.html index 5cfbdb38f7..c8f3ccc2e4 100644 --- a/docshell/test/navigation/test_blockBFCache.html +++ b/docshell/test/navigation/test_blockBFCache.html @@ -164,7 +164,7 @@ function executeTest() { let bc = new BroadcastChannel("bfcache_blocking"); function promiseMessage(type) { - return new Promise((resolve, reject) => { + return new Promise((resolve) => { bc.addEventListener("message", (e) => { if (e.data.type == type) { resolve(e.data); @@ -177,11 +177,11 @@ function executeTest() { return promiseMessage("pageshow").then(data => data.persisted == shouldBePersisted); } - function promisePageShowFromBFCache(e) { + function promisePageShowFromBFCache() { return promisePageShow(true); } - function promisePageShowNotFromBFCache(e) { + function promisePageShowNotFromBFCache() { return promisePageShow(false); } diff --git a/docshell/test/navigation/test_bug13871.html b/docshell/test/navigation/test_bug13871.html index 0532bc7b56..b3d1f3b05d 100644 --- a/docshell/test/navigation/test_bug13871.html +++ b/docshell/test/navigation/test_bug13871.html @@ -57,7 +57,7 @@ var window2 = window.open("http://test1.example.org:80/tests/docshell/test/navig var window3 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/parent.html", "window3", "width=10,height=10"); function waitForLoad(w) { - return new Promise(function(resolve, reject) { + return new Promise(function(resolve) { // If we already got the "ready" message, resolve immediately. if (windows.has(w)) { resolve(); diff --git a/docshell/test/navigation/test_bug1699721.html b/docshell/test/navigation/test_bug1699721.html index c6ae8e88d3..92642ac886 100644 --- a/docshell/test/navigation/test_bug1699721.html +++ b/docshell/test/navigation/test_bug1699721.html @@ -52,7 +52,7 @@ info("wait for message from popup"); let messagePromise = new Promise(resolve => { - addEventListener("message", evt => { + addEventListener("message", () => { resolve(); }, { once: true }); }); @@ -93,7 +93,7 @@ }); let messagePromise2 = new Promise(resolve => { - addEventListener("message", evt => { + addEventListener("message", () => { resolve(); }, { once: true }); }); diff --git a/docshell/test/navigation/test_contentpolicy_block_window.html b/docshell/test/navigation/test_contentpolicy_block_window.html index 7dc73e8574..96d98d8308 100644 --- a/docshell/test/navigation/test_contentpolicy_block_window.html +++ b/docshell/test/navigation/test_contentpolicy_block_window.html @@ -78,7 +78,7 @@ var policy = { return Ci.nsIContentPolicy.REJECT_REQUEST; }, - shouldProcess(contentLocation, loadInfo) { + shouldProcess() { return Ci.nsIContentPolicy.ACCEPT; }, }; diff --git a/docshell/test/navigation/test_load_history_entry.html b/docshell/test/navigation/test_load_history_entry.html index 8ca3fcb913..64aad33818 100644 --- a/docshell/test/navigation/test_load_history_entry.html +++ b/docshell/test/navigation/test_load_history_entry.html @@ -163,7 +163,7 @@ async function waitForPopstate(win) { return new Promise(resolve => { - win.addEventListener("popstate", (e) => { + win.addEventListener("popstate", () => { setTimeout(resolve, 0); }, {once: true}); }); diff --git a/docshell/test/unit/head_docshell.js b/docshell/test/unit/head_docshell.js index 1d74bd61c7..3295a44266 100644 --- a/docshell/test/unit/head_docshell.js +++ b/docshell/test/unit/head_docshell.js @@ -42,6 +42,36 @@ const SEARCH_CONFIG = [ }, ]; +const CONFIG_V2 = [ + { + recordType: "engine", + identifier: "test_urifixup_search_engine_app_provided", + base: { + name: "test_urifixup_search_engine_app_provided", + urls: { + search: { + base: "https://www.example.org/", + searchTermParamName: "search", + }, + }, + }, + variants: [ + { + environment: { allRegionsAndLocales: true }, + }, + ], + }, + { + recordType: "defaultEngines", + globalDefault: "test_urifixup_search_engine_app_provided", + specificDefaults: [], + }, + { + recordType: "engineOrders", + orders: [], + }, +]; + async function setupSearchService() { SearchTestUtils.init(this); @@ -54,7 +84,11 @@ async function setupSearchService() { "42" ); - await SearchTestUtils.useTestEngines(".", null, SEARCH_CONFIG); + await SearchTestUtils.useTestEngines( + ".", + null, + SearchUtils.newSearchConfigEnabled ? CONFIG_V2 : SEARCH_CONFIG + ); await AddonTestUtils.promiseStartupManager(); await Services.search.init(); } diff --git a/docshell/test/unit/test_URIFixup.js b/docshell/test/unit/test_URIFixup.js index 794ee8cfa2..54e717244d 100644 --- a/docshell/test/unit/test_URIFixup.js +++ b/docshell/test/unit/test_URIFixup.js @@ -1,3 +1,7 @@ +const { PromiseTestUtils } = ChromeUtils.importESModule( + "resource://testing-common/PromiseTestUtils.sys.mjs" +); + var pref = "browser.fixup.typo.scheme"; var data = [ @@ -103,11 +107,20 @@ var dontFixURIs = [ var len = data.length; add_task(async function setup() { - await setupSearchService(); - // Now we've initialised the search service, we force remove the engines - // it has, so they don't interfere with this test. + // Force search service to fail, so we do not have any engines that can + // interfere with this test. // Search engine integration is tested in test_URIFixup_search.js. - Services.search.wrappedJSObject._engines.clear(); + Services.search.wrappedJSObject.errorToThrowInTest = "Settings"; + + // When search service fails, we want the promise rejection to be uncaught + // so we can continue running the test. + PromiseTestUtils.expectUncaughtRejection( + /Fake Settings error during search service initialization./ + ); + + try { + await setupSearchService(); + } catch {} }); // Make sure we fix what needs fixing when there is no pref set. diff --git a/docshell/test/unit/test_URIFixup_check_host.js b/docshell/test/unit/test_URIFixup_check_host.js index 132d74ca9b..8d75fcc032 100644 --- a/docshell/test/unit/test_URIFixup_check_host.js +++ b/docshell/test/unit/test_URIFixup_check_host.js @@ -161,7 +161,7 @@ add_task(async function test_ip_address() { let didResolve = false; let topic = "uri-fixup-check-dns"; let observer = { - observe(aSubject, aTopicInner, aData) { + observe(aSubject, aTopicInner) { if (aTopicInner == topic) { didResolve = true; } diff --git a/docshell/test/unit/test_pb_notification.js b/docshell/test/unit/test_pb_notification.js index 51cd3b95ff..ea6824e983 100644 --- a/docshell/test/unit/test_pb_notification.js +++ b/docshell/test/unit/test_pb_notification.js @@ -8,7 +8,7 @@ function destroy_transient_docshell() { function run_test() { var obs = { - observe(aSubject, aTopic, aData) { + observe(aSubject, aTopic) { Assert.equal(aTopic, "last-pb-context-exited"); do_test_finished(); }, diff --git a/docshell/test/unit/test_privacy_transition.js b/docshell/test/unit/test_privacy_transition.js index ae1bf71284..3fe9ad116d 100644 --- a/docshell/test/unit/test_privacy_transition.js +++ b/docshell/test/unit/test_privacy_transition.js @@ -6,7 +6,7 @@ var observer = { "nsISupportsWeakReference", ]), - privateModeChanged(enabled) { + privateModeChanged() { gNotifications++; }, }; diff --git a/docshell/test/unit/test_subframe_stop_after_parent_error.js b/docshell/test/unit/test_subframe_stop_after_parent_error.js index ee1876b4b9..b7ae25ee84 100644 --- a/docshell/test/unit/test_subframe_stop_after_parent_error.js +++ b/docshell/test/unit/test_subframe_stop_after_parent_error.js @@ -50,7 +50,7 @@ let thunks = new Set(); function promiseStateStop(webProgress) { return new Promise(resolve => { let listener = { - onStateChange(aWebProgress, request, stateFlags, status) { + onStateChange(aWebProgress, request, stateFlags) { if (stateFlags & Ci.nsIWebProgressListener.STATE_STOP) { webProgress.removeProgressListener(listener); diff --git a/docshell/test/unit_ipc/test_pb_notification_ipc.js b/docshell/test/unit_ipc/test_pb_notification_ipc.js index 6408e7753e..413037b36a 100644 --- a/docshell/test/unit_ipc/test_pb_notification_ipc.js +++ b/docshell/test/unit_ipc/test_pb_notification_ipc.js @@ -1,7 +1,7 @@ function run_test() { var notifications = 0; var obs = { - observe(aSubject, aTopic, aData) { + observe(aSubject, aTopic) { Assert.equal(aTopic, "last-pb-context-exited"); notifications++; }, |