Backed out 2 changesets (bug 1774317) for causing top-crash (bug 1792767) CLOSED TREE
authorSandor Molnar <smolnar@mozilla.com>
Thu, 29 Sep 2022 04:48:26 +0300
changeset 636564 59ab3186dfd4016b98a1dc97ea9ba146cb9f7abc
parent 636563 1f5cc8351a057bd87772aca83bbd6510f2a97eee
child 636591 2219f5609aef219a2c8c4aea4d02fb8c4ea98045
push id40273
push usersmolnar@mozilla.com
push dateThu, 29 Sep 2022 01:49:28 +0000
treeherdermozilla-central@59ab3186dfd4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1774317, 1792767
milestone107.0a1
backs out418dec4ac3f99323de6d6957282e8d26bd44ea19
329666086b40fbda851a61c063b7a717838a2c30
first release with
nightly linux32
59ab3186dfd4 / 107.0a1 / 20220929014928 / files
nightly linux64
59ab3186dfd4 / 107.0a1 / 20220929014928 / files
nightly mac
59ab3186dfd4 / 107.0a1 / 20220929014928 / files
nightly win32
59ab3186dfd4 / 107.0a1 / 20220929014928 / files
nightly win64
59ab3186dfd4 / 107.0a1 / 20220929014928 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 2 changesets (bug 1774317) for causing top-crash (bug 1792767) CLOSED TREE Backed out changeset 418dec4ac3f9 (bug 1774317) Backed out changeset 329666086b40 (bug 1774317)
dom/base/nsDOMWindowUtils.cpp
dom/events/IMEStateManager.cpp
dom/interfaces/base/nsIDOMWindowUtils.idl
modules/libpref/init/StaticPrefList.yaml
widget/IMEData.h
widget/nsGUIEventIPC.h
widget/tests/browser/browser.ini
widget/tests/browser/browser_test_InputContextURI.js
widget/windows/TSFTextStore.cpp
widget/windows/TSFTextStore.h
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -2134,30 +2134,16 @@ nsDOMWindowUtils::GetIMEStatus(uint32_t*
   if (!widget) return NS_ERROR_FAILURE;
 
   InputContext context = widget->GetInputContext();
   *aState = static_cast<uint32_t>(context.mIMEState.mEnabled);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMWindowUtils::GetInputContextURI(nsIURI** aURI) {
-  NS_ENSURE_ARG_POINTER(aURI);
-
-  nsCOMPtr<nsIWidget> widget = GetWidget();
-  if (!widget) {
-    return NS_ERROR_FAILURE;
-  }
-
-  nsCOMPtr<nsIURI> documentURI = widget->GetInputContext().mURI;
-  documentURI.forget(aURI);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 nsDOMWindowUtils::GetInputContextOrigin(uint32_t* aOrigin) {
   NS_ENSURE_ARG_POINTER(aOrigin);
 
   nsCOMPtr<nsIWidget> widget = GetWidget();
   if (!widget) {
     return NS_ERROR_FAILURE;
   }
 
--- a/dom/events/IMEStateManager.cpp
+++ b/dom/events/IMEStateManager.cpp
@@ -36,17 +36,16 @@
 #include "nsCOMPtr.h"
 #include "nsContentUtils.h"
 #include "nsFocusManager.h"
 #include "nsIContent.h"
 #include "nsIContentInlines.h"
 #include "nsIFormControl.h"
 #include "nsINode.h"
 #include "nsISupports.h"
-#include "nsIURI.h"
 #include "nsPresContext.h"
 
 namespace mozilla {
 
 using namespace dom;
 using namespace widget;
 
 /**
@@ -1517,37 +1516,16 @@ void IMEStateManager::SetIMEState(const 
            "mFocusChange=%s }, aOrigin=%s)",
            ToString(aState).c_str(), aPresContext, aElement,
            BrowserParent::GetFrom(aElement), &aWidget,
            ToString(aAction.mCause).c_str(),
            ToString(aAction.mFocusChange).c_str(), ToChar(aOrigin)));
 
   InputContext context;
   context.mIMEState = aState;
-  if (aPresContext) {
-    if (nsIURI* uri = aPresContext->Document()->GetDocumentURI()) {
-      // We don't need to and should not expose special URLs such as:
-      // about: Any apps like IME should work normally and constantly in any
-      //        default pages such as about:blank, about:home, etc in either
-      //        the main process or a content process.
-      // blob: This may contain big data.  If we copy it to the main process,
-      //       it may make the heap dirty which makes the process slower.
-      // chrome: Same as about, any apps should work normally and constantly in
-      //         any chrome documents.
-      // data: Any native apps in the environment shouldn't change the behavior
-      //       with the data URL's content and it may contain too big data.
-      // file: The file path may contain private things and we shouldn't let
-      //       other apps like IME know which one is touched by the user because
-      //       malicious text services may like files which are explicitly used
-      //       by the user better.
-      if (uri->SchemeIs("http") || uri->SchemeIs("https")) {
-        context.mURI = uri;
-      }
-    }
-  }
   context.mOrigin = aOrigin;
   context.mMayBeIMEUnaware =
       context.mIMEState.IsEditable() &&
       StaticPrefs::
           intl_ime_hack_on_ime_unaware_apps_fire_key_events_for_composition() &&
       MayBeIMEUnawareWebApp(aElement);
 
   context.mHasHandledUserInput =
--- a/dom/interfaces/base/nsIDOMWindowUtils.idl
+++ b/dom/interfaces/base/nsIDOMWindowUtils.idl
@@ -1150,21 +1150,16 @@ interface nsIDOMWindowUtils : nsISupport
   const unsigned long IME_STATUS_PASSWORD = 2;
 
   /**
    * Get IME status, see above IME_STATUS_* definitions.
    */
   readonly attribute unsigned long IMEStatus;
 
   /**
-   * Get the document URI which may be retrieved by native IME.
-   */
-  readonly attribute nsIURI inputContextURI;
-
-  /**
    * Get whether current input context (including IME status) in the widget
    * is set by content or not.
    */
   const unsigned long INPUT_CONTEXT_ORIGIN_MAIN = 0;
   const unsigned long INPUT_CONTEXT_ORIGIN_CONTENT = 1;
   readonly attribute unsigned long inputContextOrigin;
 
   /**
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -6839,33 +6839,16 @@
 #ifdef XP_WIN
   # If true, automatically extend selection to cluster boundaries when
   # TSF/TIP requests to select from/by middle of a cluster.
 -   name: intl.tsf.hack.extend_setting_selection_range_to_cluster_boundaries
     type: bool
     value: @IS_NOT_EARLY_BETA_OR_EARLIER@
     mirror: always
 
-  # If true, TSF and TIP (IME) can retrieve URL of the document containing
-  # the focused element.  When this is set to true, Gecko exposes the spec
-  # of the URL.
-  # And Gecko exposes only "http" and "https" URLs.  E.g., "data", "blob",
-  # "file" URLs are never exposed.
--  name: intl.tsf.expose_url.allowed
-   type: bool
-   value: true
-   mirror: always
-
-  # If true, TSF and TIP (IME) can retrieve URL of the document containing
-  # the focused element in the private browsing mode too.
--  name: intl.tsf.expose_url_in_private_browsing.allowed
-   type: bool
-   value: false
-   mirror: always
-
 #if defined(ENABLE_TESTS)
   # If true, NS_GetComplexLineBreaks compares the line breaks produced in the
   # content process using the Uniscribe line breaker, with those from a
   # brokered call to the parent.
 -   name: intl.compare_against_brokered_complex_line_breaks
     type: bool
     value: false
     mirror: always
--- a/widget/IMEData.h
+++ b/widget/IMEData.h
@@ -6,18 +6,16 @@
 #ifndef mozilla_widget_IMEData_h_
 #define mozilla_widget_IMEData_h_
 
 #include "mozilla/CheckedInt.h"
 #include "mozilla/EventForwards.h"
 #include "mozilla/NativeKeyBindingsType.h"
 #include "mozilla/ToString.h"
 
-#include "nsCOMPtr.h"
-#include "nsIURI.h"
 #include "nsPoint.h"
 #include "nsRect.h"
 #include "nsString.h"
 #include "nsXULAppAPI.h"
 #include "Units.h"
 
 class nsIWidget;
 
@@ -408,17 +406,16 @@ struct InputContext final {
         mMayBeIMEUnaware(false),
         mHasHandledUserInput(false),
         mInPrivateBrowsing(false) {}
 
   // If InputContext instance is a static variable, any heap allocated stuff
   // of its members need to be deleted at XPCOM shutdown.  Otherwise, it's
   // detected as memory leak.
   void ShutDown() {
-    mURI = nullptr;
     mHTMLInputType.Truncate();
     mHTMLInputInputmode.Truncate();
     mActionHint.Truncate();
     mAutocapitalize.Truncate();
   }
 
   bool IsPasswordEditor() const {
     return mHTMLInputType.LowerCaseEqualsLiteral("password");
@@ -458,19 +455,16 @@ struct InputContext final {
            // enterkeyhint is only supported by Android IME API.
            mActionHint != aOldContext.mActionHint ||
 #endif
            false;
   }
 
   IMEState mIMEState;
 
-  // The URI of the document which has the editable element.
-  nsCOMPtr<nsIURI> mURI;
-
   /* The type of the input if the input is a html input field */
   nsString mHTMLInputType;
 
   /* The type of the inputmode */
   nsString mHTMLInputInputmode;
 
   /* A hint for the action that is performed when the input is submitted */
   nsString mActionHint;
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -6,18 +6,16 @@
 #ifndef nsGUIEventIPC_h__
 #define nsGUIEventIPC_h__
 
 #include "ipc/EnumSerializer.h"
 #include "ipc/IPCMessageUtils.h"
 #include "mozilla/ContentCache.h"
 #include "mozilla/GfxMessageUtils.h"
 #include "mozilla/dom/Touch.h"
-#include "mozilla/ipc/IPDLParamTraits.h"  // for ReadIPDLParam and WriteIPDLParam
-#include "mozilla/ipc/URIUtils.h"         // for IPDLParamTraits<nsIURI*>
 #include "mozilla/layers/LayersMessageUtils.h"
 #include "mozilla/MiscEvents.h"
 #include "mozilla/MouseEvents.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/TouchEvents.h"
 #include "mozilla/WheelHandlingHelper.h"  // for WheelDeltaAdjustmentStrategy
 #include "mozilla/dom/Selection.h"
 #include "InputData.h"
@@ -815,31 +813,28 @@ struct ParamTraits<mozilla::widget::Inpu
     WriteParam(aWriter, aParam.mHTMLInputType);
     WriteParam(aWriter, aParam.mHTMLInputInputmode);
     WriteParam(aWriter, aParam.mActionHint);
     WriteParam(aWriter, aParam.mAutocapitalize);
     WriteParam(aWriter, aParam.mOrigin);
     WriteParam(aWriter, aParam.mMayBeIMEUnaware);
     WriteParam(aWriter, aParam.mHasHandledUserInput);
     WriteParam(aWriter, aParam.mInPrivateBrowsing);
-    mozilla::ipc::WriteIPDLParam(aWriter, aWriter->GetActor(), aParam.mURI);
   }
 
   static bool Read(MessageReader* aReader, paramType* aResult) {
     return ReadParam(aReader, &aResult->mIMEState) &&
            ReadParam(aReader, &aResult->mHTMLInputType) &&
            ReadParam(aReader, &aResult->mHTMLInputInputmode) &&
            ReadParam(aReader, &aResult->mActionHint) &&
            ReadParam(aReader, &aResult->mAutocapitalize) &&
            ReadParam(aReader, &aResult->mOrigin) &&
            ReadParam(aReader, &aResult->mMayBeIMEUnaware) &&
            ReadParam(aReader, &aResult->mHasHandledUserInput) &&
-           ReadParam(aReader, &aResult->mInPrivateBrowsing) &&
-           mozilla::ipc::ReadIPDLParam(aReader, aReader->GetActor(),
-                                       address_of(aResult->mURI));
+           ReadParam(aReader, &aResult->mInPrivateBrowsing);
   }
 };
 
 template <>
 struct ParamTraits<mozilla::widget::InputContextAction::Cause>
     : ContiguousEnumSerializerInclusive<
           mozilla::widget::InputContextAction::Cause,
           mozilla::widget::InputContextAction::Cause::CAUSE_UNKNOWN,
--- a/widget/tests/browser/browser.ini
+++ b/widget/tests/browser/browser.ini
@@ -1,15 +1,13 @@
 [browser_test_clipboardcache.js]
 skip-if = 
   os == 'android' || (os == 'linux' && ccov) || tsan # Bug 1613516, the test consistently timeouts on Linux coverage builds.
   os == "win" && bits == 32 && !debug # Bug 1759422
 [browser_test_ContentCache.js]
 skip-if = os == 'android'
-[browser_test_InputContextURI.js]
-skip-if = os == 'android'
 [browser_test_swipe_gesture.js]
 run-if = (os == 'mac' || os == 'win' || os == 'linux')
 skip-if =
   os == "win" && bits == 32 && !debug # Bug 1759422
 support-files =
   !/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js
   !/gfx/layers/apz/test/mochitest/apz_test_utils.js
deleted file mode 100644
--- a/widget/tests/browser/browser_test_InputContextURI.js
+++ /dev/null
@@ -1,118 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-const { ContentTaskUtils } = ChromeUtils.import(
-  "resource://testing-common/ContentTaskUtils.jsm"
-);
-const gDOMWindowUtils = EventUtils._getDOMWindowUtils(window);
-
-function promiseURLBarFocus() {
-  const waitForFocusInURLBar = BrowserTestUtils.waitForEvent(gURLBar, "focus");
-  gURLBar.blur();
-  gURLBar.focus();
-  return Promise.all([
-    waitForFocusInURLBar,
-    TestUtils.waitForCondition(
-      () =>
-        gDOMWindowUtils.IMEStatus === Ci.nsIDOMWindowUtils.IME_STATUS_ENABLED &&
-        gDOMWindowUtils.inputContextOrigin ===
-          Ci.nsIDOMWindowUtils.INPUT_CONTEXT_ORIGIN_MAIN
-    ),
-  ]);
-}
-
-function promiseIMEStateEnabledByRemote() {
-  return TestUtils.waitForCondition(
-    () =>
-      gDOMWindowUtils.IMEStatus === Ci.nsIDOMWindowUtils.IME_STATUS_ENABLED &&
-      gDOMWindowUtils.inputContextOrigin ===
-        Ci.nsIDOMWindowUtils.INPUT_CONTEXT_ORIGIN_CONTENT
-  );
-}
-
-async function test_url_bar_url(aDesc) {
-  await promiseURLBarFocus();
-
-  is(
-    gDOMWindowUtils.inputContextURI,
-    null,
-    `When the search bar has focus, input context URI should be null because of in chrome document (${aDesc})`
-  );
-}
-
-async function test_input_in_http_or_https(aIsHTTPS) {
-  await promiseURLBarFocus();
-
-  const scheme = aIsHTTPS ? "https" : "http";
-  const url = `${scheme}://example.com/browser/toolkit/content/tests/browser/file_empty.html`;
-  await BrowserTestUtils.withNewTab(url, async browser => {
-    ok(browser.isRemoteBrowser, "This test passes only in e10s mode");
-
-    await SpecialPowers.spawn(browser, [], async () => {
-      content.document.body.innerHTML = "<input>";
-      const input = content.document.querySelector("input");
-      input.focus();
-
-      // Wait for a tick for flushing IMEContentObserver's pending notifications.
-      await new Promise(resolve =>
-        content.requestAnimationFrame(() =>
-          content.requestAnimationFrame(resolve)
-        )
-      );
-    });
-
-    await promiseIMEStateEnabledByRemote();
-    if (!gDOMWindowUtils.inputContextURI) {
-      ok(
-        false,
-        `Input context should have valid URI when the scheme of focused tab's URL is ${scheme}`
-      );
-      return;
-    }
-    is(
-      gDOMWindowUtils.inputContextURI.spec,
-      url,
-      `Input context should have the document URI when the scheme of focused tab's URL is ${scheme}`
-    );
-  });
-}
-
-add_task(async () => {
-  await test_url_bar_url("first check");
-});
-add_task(async () => {
-  await test_input_in_http_or_https(true);
-});
-add_task(async () => {
-  await test_url_bar_url("check after remote content sets the URI");
-});
-add_task(async () => {
-  await test_input_in_http_or_https(false);
-});
-
-add_task(async function test_input_in_data() {
-  await BrowserTestUtils.withNewTab("data:text/html,<input>", async browser => {
-    ok(browser.isRemoteBrowser, "This test passes only in e10s mode");
-
-    await SpecialPowers.spawn(browser, [], async () => {
-      const input = content.document.querySelector("input");
-      input.focus();
-
-      // Wait for a tick for flushing IMEContentObserver's pending notifications.
-      await new Promise(resolve =>
-        content.requestAnimationFrame(() =>
-          content.requestAnimationFrame(resolve)
-        )
-      );
-    });
-
-    await promiseIMEStateEnabledByRemote();
-    is(
-      gDOMWindowUtils.inputContextURI,
-      null,
-      "Input context should not have data URI"
-    );
-  });
-});
--- a/widget/windows/TSFTextStore.cpp
+++ b/widget/windows/TSFTextStore.cpp
@@ -2,20 +2,18 @@
 /* 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/. */
 
 #define INPUTSCOPE_INIT_GUID
 #define TEXTATTRS_INIT_GUID
 #include "TSFTextStore.h"
 
+#include <olectl.h>
 #include <algorithm>
-#include <comutil.h>  // for _bstr_t
-#include <oleauto.h>  // for SysAllocString
-#include <olectl.h>
 #include "nscore.h"
 
 #include "IMMHandler.h"
 #include "KeyboardLayout.h"
 #include "WinIMEHandler.h"
 #include "WinUtils.h"
 #include "mozilla/AutoRestore.h"
 #include "mozilla/Logging.h"
@@ -23,37 +21,28 @@
 #include "mozilla/StaticPrefs_intl.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/TextEventDispatcher.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/ToString.h"
 #include "mozilla/WindowsVersion.h"
 #include "nsWindow.h"
 #include "nsPrintfCString.h"
-#include "nsReadableUtils.h"  // for VoidString()
 
 // Workaround for mingw32
 #ifndef TS_SD_INPUTPANEMANUALDISPLAYENABLE
 #  define TS_SD_INPUTPANEMANUALDISPLAYENABLE 0x40
 #endif
 
 // For collecting other people's log, tell `MOZ_LOG=IMEHandler:4,sync`
 // rather than `MOZ_LOG=IMEHandler:5,sync` since using `5` may create too
 // big file.
 // Therefore you shouldn't use `LogLevel::Verbose` for logging usual behavior.
 mozilla::LazyLogModule gIMELog("IMEHandler");
 
-// TODO: GUID_PROP_URL has not been declared in the SDK yet.  We should drop the
-//       `s` prefix after it's released by a new SDK and define it with #if.
-static const GUID sGUID_PROP_URL = {
-    0xd5138268,
-    0xa1bf,
-    0x4308,
-    {0xbc, 0xbf, 0x2e, 0x73, 0x93, 0x98, 0xe2, 0x34}};
-
 namespace mozilla {
 namespace widget {
 
 static const char* kPrefNameEnableTSF = "intl.tsf.enable";
 
 /**
  * TSF related code should log its behavior even on release build especially
  * in the interface methods.
@@ -234,17 +223,16 @@ static nsCString GetGUIDNameStr(REFGUID 
 
 static nsCString GetGUIDNameStrWithTable(REFGUID aGUID) {
 #define RETURN_GUID_NAME(aNamedGUID)      \
   if (IsEqualGUID(aGUID, aNamedGUID)) {   \
     return nsLiteralCString(#aNamedGUID); \
   }
 
   RETURN_GUID_NAME(GUID_PROP_INPUTSCOPE)
-  RETURN_GUID_NAME(sGUID_PROP_URL)
   RETURN_GUID_NAME(TSATTRID_OTHERS)
   RETURN_GUID_NAME(TSATTRID_Font)
   RETURN_GUID_NAME(TSATTRID_Font_FaceName)
   RETURN_GUID_NAME(TSATTRID_Font_SizePts)
   RETURN_GUID_NAME(TSATTRID_Font_Style)
   RETURN_GUID_NAME(TSATTRID_Font_Style_Bold)
   RETURN_GUID_NAME(TSATTRID_Font_Style_Italic)
   RETURN_GUID_NAME(TSATTRID_Font_Style_SmallCaps)
@@ -1814,17 +1802,32 @@ bool TSFTextStore::sIsKeyboardEventDispa
 
 #define TEXTSTORE_DEFAULT_VIEW (1)
 
 TSFTextStore::TSFTextStore()
     : mEditCookie(0),
       mSinkMask(0),
       mLock(0),
       mLockQueued(0),
-      mHandlingKeyMessage(0) {
+      mHandlingKeyMessage(0),
+      mRequestedAttrValues(false),
+      mIsRecordingActionsWithoutLock(false),
+      mHasReturnedNoLayoutError(false),
+      mWaitingQueryLayout(false),
+      mPendingDestroy(false),
+      mDeferClearingContentForTSF(false),
+      mDeferNotifyingTSF(false),
+      mDeferCommittingComposition(false),
+      mDeferCancellingComposition(false),
+      mDestroyed(false),
+      mBeingDestroyed(false) {
+  for (int32_t i = 0; i < NUM_OF_SUPPORTED_ATTRS; i++) {
+    mRequestedAttrs[i] = false;
+  }
+
   // We hope that 5 or more actions don't occur at once.
   mPendingActions.SetCapacity(5);
 
   MOZ_LOG(gIMELog, LogLevel::Info,
           ("0x%p TSFTextStore::TSFTextStore() SUCCEEDED", this));
 }
 
 TSFTextStore::~TSFTextStore() {
@@ -1863,26 +1866,18 @@ bool TSFTextStore::Init(nsWindow* aWidge
   if (NS_WARN_IF(!mDispatcher)) {
     MOZ_LOG(gIMELog, LogLevel::Error,
             ("0x%p   TSFTextStore::Init() FAILED "
              "due to aWidget->GetTextEventDispatcher() failure",
              this));
     return false;
   }
 
-  mInPrivateBrowsing = aContext.mInPrivateBrowsing;
-  SetInputScope(aContext.mHTMLInputType, aContext.mHTMLInputInputmode);
-
-  if (aContext.mURI) {
-    // We don't need the document URL if it fails, let's ignore the error.
-    nsAutoCString spec;
-    if (NS_SUCCEEDED(aContext.mURI->GetSpec(spec))) {
-      CopyUTF8toUTF16(spec, mDocumentURL);
-    }
-  }
+  SetInputScope(aContext.mHTMLInputType, aContext.mHTMLInputInputmode,
+                aContext.mInPrivateBrowsing);
 
   // Create document manager
   RefPtr<ITfThreadMgr> threadMgr = sThreadMgr;
   RefPtr<ITfDocumentMgr> documentMgr;
   HRESULT hr = threadMgr->CreateDocumentMgr(getter_AddRefs(documentMgr));
   if (NS_WARN_IF(FAILED(hr))) {
     MOZ_LOG(gIMELog, LogLevel::Error,
             ("0x%p   TSFTextStore::Init() FAILED to create ITfDocumentMgr "
@@ -2000,17 +1995,16 @@ void TSFTextStore::Destroy() {
 }
 
 void TSFTextStore::ReleaseTSFObjects() {
   MOZ_ASSERT(!mHandlingKeyMessage);
 
   MOZ_LOG(gIMELog, LogLevel::Info,
           ("0x%p TSFTextStore::ReleaseTSFObjects()", this));
 
-  mDocumentURL.Truncate();
   mContext = nullptr;
   if (mDocumentMgr) {
     RefPtr<ITfDocumentMgr> documentMgr = mDocumentMgr.forget();
     documentMgr->Pop(TF_POPF_ALL);
   }
   mSink = nullptr;
   mWidget = nullptr;
   mDispatcher = nullptr;
@@ -3912,52 +3906,48 @@ bool TSFTextStore::ShouldSetInputScopeOf
     case TextInputProcessorID::eMicrosoftIMEForKorean:
       return IsWin8OrLater();
     default:
       return false;
   }
 }
 
 void TSFTextStore::SetInputScope(const nsString& aHTMLInputType,
-                                 const nsString& aHTMLInputInputMode) {
+                                 const nsString& aHTMLInputInputMode,
+                                 bool aInPrivateBrowsing) {
   mInputScopes.Clear();
 
   // IME may refer only first input scope, but we will append inputmode's
   // input scopes too like Chrome since IME may refer it.
   IMEHandler::AppendInputScopeFromType(aHTMLInputType, mInputScopes);
   IMEHandler::AppendInputScopeFromInputmode(aHTMLInputInputMode, mInputScopes);
 
-  if (mInPrivateBrowsing) {
+  if (aInPrivateBrowsing) {
     mInputScopes.AppendElement(IS_PRIVATE);
   }
 }
 
 int32_t TSFTextStore::GetRequestedAttrIndex(const TS_ATTRID& aAttrID) {
   if (IsEqualGUID(aAttrID, GUID_PROP_INPUTSCOPE)) {
     return eInputScope;
   }
-  if (IsEqualGUID(aAttrID, sGUID_PROP_URL)) {
-    return eDocumentURL;
-  }
   if (IsEqualGUID(aAttrID, TSATTRID_Text_VerticalWriting)) {
     return eTextVerticalWriting;
   }
   if (IsEqualGUID(aAttrID, TSATTRID_Text_Orientation)) {
     return eTextOrientation;
   }
   return eNotSupported;
 }
 
 TS_ATTRID
 TSFTextStore::GetAttrID(int32_t aIndex) {
   switch (aIndex) {
     case eInputScope:
       return GUID_PROP_INPUTSCOPE;
-    case eDocumentURL:
-      return sGUID_PROP_URL;
     case eTextVerticalWriting:
       return TSATTRID_Text_VerticalWriting;
     case eTextOrientation:
       return TSATTRID_Text_Orientation;
     default:
       MOZ_CRASH("Invalid index? Or not implemented yet?");
       return GUID_NULL;
   }
@@ -4054,19 +4044,16 @@ TSFTextStore::FindNextAttrTransition(LON
            this));
 
   // no per character attributes defined
   *pacpNext = *plFoundOffset = acpHalt;
   *pfFound = FALSE;
   return S_OK;
 }
 
-// To test the document URL result, define this to out put it to the stdout
-// #define DEBUG_PRINT_DOCUMENT_URL
-
 STDMETHODIMP
 TSFTextStore::RetrieveRequestedAttrs(ULONG ulCount, TS_ATTRVAL* paAttrVals,
                                      ULONG* pcFetched) {
   if (!pcFetched || !paAttrVals) {
     MOZ_LOG(gIMELog, LogLevel::Error,
             ("0x%p TSFTextStore::RetrieveRequestedAttrs() FAILED due to "
              "null argument",
              this));
@@ -4087,42 +4074,16 @@ TSFTextStore::RetrieveRequestedAttrs(ULO
     return E_INVALIDARG;
   }
 
   MOZ_LOG(gIMELog, LogLevel::Info,
           ("0x%p TSFTextStore::RetrieveRequestedAttrs() called "
            "ulCount=%lu, mRequestedAttrValues=%s",
            this, ulCount, GetBoolName(mRequestedAttrValues)));
 
-  auto GetExposingURL = [&]() -> BSTR {
-    const bool allowed =
-        StaticPrefs::intl_tsf_expose_url_allowed() &&
-        (!mInPrivateBrowsing ||
-         StaticPrefs::intl_tsf_expose_url_in_private_browsing_allowed());
-    if (!allowed) {
-      MOZ_ASSERT(EmptyString().get());
-      return ::SysAllocString(EmptyString().get());
-    }
-    if (mDocumentURL.IsEmpty()) {
-      MOZ_ASSERT(EmptyString().get());
-      return ::SysAllocString(EmptyString().get());
-    }
-    return ::SysAllocString(mDocumentURL.get());
-  };
-
-#ifdef DEBUG_PRINT_DOCUMENT_URL
-  {
-    BSTR exposingURL = GetExposingURL();
-    printf("TSFTextStore::RetrieveRequestedAttrs: DocumentURL=\"%s\"\n",
-           NS_ConvertUTF16toUTF8(static_cast<char16ptr_t>(_bstr_t(exposingURL)))
-               .get());
-    ::SysFreeString(exposingURL);
-  }
-#endif  // #ifdef DEBUG_PRINT_DOCUMENT_URL
-
   int32_t count = 0;
   for (int32_t i = 0; i < NUM_OF_SUPPORTED_ATTRS; i++) {
     if (!mRequestedAttrs[i]) {
       continue;
     }
     mRequestedAttrs[i] = false;
 
     TS_ATTRID attrID = GetAttrID(i);
@@ -4139,21 +4100,16 @@ TSFTextStore::RetrieveRequestedAttrs(ULO
     } else {
       switch (i) {
         case eInputScope: {
           paAttrVals[count].varValue.vt = VT_UNKNOWN;
           RefPtr<IUnknown> inputScope = new InputScopeImpl(mInputScopes);
           paAttrVals[count].varValue.punkVal = inputScope.forget().take();
           break;
         }
-        case eDocumentURL: {
-          paAttrVals[count].varValue.vt = VT_BSTR;
-          paAttrVals[count].varValue.bstrVal = GetExposingURL();
-          break;
-        }
         case eTextVerticalWriting: {
           Maybe<Selection>& selectionForTSF = SelectionForTSF();
           paAttrVals[count].varValue.vt = VT_BOOL;
           paAttrVals[count].varValue.boolVal =
               selectionForTSF.isSome() &&
                       selectionForTSF->WritingModeRef().IsVertical()
                   ? VARIANT_TRUE
                   : VARIANT_FALSE;
@@ -4190,18 +4146,16 @@ TSFTextStore::RetrieveRequestedAttrs(ULO
            this));
 
   paAttrVals->dwOverlapId = 0;
   paAttrVals->varValue.vt = VT_EMPTY;
   *pcFetched = 0;
   return S_OK;
 }
 
-#undef DEBUG_PRINT_DOCUMENT_URL
-
 STDMETHODIMP
 TSFTextStore::GetEndACP(LONG* pacp) {
   MOZ_LOG(gIMELog, LogLevel::Info,
           ("0x%p TSFTextStore::GetEndACP(pacp=0x%p)", this, pacp));
 
   if (!IsReadLocked()) {
     MOZ_LOG(gIMELog, LogLevel::Error,
             ("0x%p   TSFTextStore::GetEndACP() FAILED due to "
@@ -6693,29 +6647,19 @@ void TSFTextStore::SetInputContext(nsWin
       // In these cases, `NOTIFY_IME_OF_FOCUS` won't be sent.  Therefore,
       // we need to reset text store for new state right now.
       break;
     default:
       NS_WARNING_ASSERTION(IsInTSFMode(),
                            "Why is this called when TSF is disabled?");
       if (sEnabledTextStore) {
         RefPtr<TSFTextStore> textStore(sEnabledTextStore);
-        textStore->mInPrivateBrowsing = aContext.mInPrivateBrowsing;
         textStore->SetInputScope(aContext.mHTMLInputType,
-                                 aContext.mHTMLInputInputmode);
-        if (aContext.mURI) {
-          nsAutoCString spec;
-          if (NS_SUCCEEDED(aContext.mURI->GetSpec(spec))) {
-            CopyUTF8toUTF16(spec, textStore->mDocumentURL);
-          } else {
-            textStore->mDocumentURL.Truncate();
-          }
-        } else {
-          textStore->mDocumentURL.Truncate();
-        }
+                                 aContext.mHTMLInputInputmode,
+                                 aContext.mInPrivateBrowsing);
       }
       return;
   }
 
   // If focus isn't actually changed but the enabled state is changed,
   // emulate the focus move.
   if (!ThinksHavingFocus() && aContext.mIMEState.IsEditable()) {
     MOZ_LOG(gIMELog, LogLevel::Debug,
--- a/widget/windows/TSFTextStore.h
+++ b/widget/windows/TSFTextStore.h
@@ -377,17 +377,18 @@ class TSFTextStore final : public ITextS
   void NotifyTSFOfTextChange();
   void NotifyTSFOfSelectionChange();
   bool NotifyTSFOfLayoutChange();
   void NotifyTSFOfLayoutChangeAgain();
 
   HRESULT HandleRequestAttrs(DWORD aFlags, ULONG aFilterCount,
                              const TS_ATTRID* aFilterAttrs);
   void SetInputScope(const nsString& aHTMLInputType,
-                     const nsString& aHTMLInputInputMode);
+                     const nsString& aHTMLInputInputmode,
+                     bool aInPrivateBrowsing);
 
   // Creates native caret over our caret.  This method only works on desktop
   // application.  Otherwise, this does nothing.
   void CreateNativeCaret();
   // Destroys native caret if there is.
   void MaybeDestroyNativeCaret();
 
   /**
@@ -1012,80 +1013,74 @@ class TSFTextStore final : public ITextS
   };
   // mMouseTrackers is an array to store each information of installed
   // ITfMouseSink instance.
   nsTArray<MouseTracker> mMouseTrackers;
 
   // The input scopes for this context, defaults to IS_DEFAULT.
   nsTArray<InputScope> mInputScopes;
 
-  // The URL cache of the focused document.
-  nsString mDocumentURL;
-
   // Support retrieving attributes.
   // TODO: We should support RightToLeft, perhaps.
   enum {
     // Used for result of GetRequestedAttrIndex()
     eNotSupported = -1,
 
     // Supported attributes
     eInputScope = 0,
-    eDocumentURL,
     eTextVerticalWriting,
     eTextOrientation,
 
     // Count of the supported attributes
     NUM_OF_SUPPORTED_ATTRS
   };
-  bool mRequestedAttrs[NUM_OF_SUPPORTED_ATTRS]{false};
+  bool mRequestedAttrs[NUM_OF_SUPPORTED_ATTRS];
 
   int32_t GetRequestedAttrIndex(const TS_ATTRID& aAttrID);
   TS_ATTRID GetAttrID(int32_t aIndex);
 
-  bool mRequestedAttrValues = false;
+  bool mRequestedAttrValues;
 
   // If edit actions are being recorded without document lock, this is true.
   // Otherwise, false.
-  bool mIsRecordingActionsWithoutLock = false;
+  bool mIsRecordingActionsWithoutLock;
   // If GetTextExt() or GetACPFromPoint() is called and the layout hasn't been
   // calculated yet, these methods return TS_E_NOLAYOUT.  At that time,
   // mHasReturnedNoLayoutError is set to true.
-  bool mHasReturnedNoLayoutError = false;
+  bool mHasReturnedNoLayoutError;
   // Before calling ITextStoreACPSink::OnLayoutChange() and
   // ITfContextOwnerServices::OnLayoutChange(), mWaitingQueryLayout is set to
   // true.  This is set to  false when GetTextExt() or GetACPFromPoint() is
   // called.
-  bool mWaitingQueryLayout = false;
-  // During the document is locked, we shouldn't destroy the instance.
+  bool mWaitingQueryLayout;
+  // During the documet is locked, we shouldn't destroy the instance.
   // If this is true, the instance will be destroyed after unlocked.
   bool mPendingDestroy;
   // If this is false, MaybeFlushPendingNotifications() will clear the
   // mContentForTSF.
-  bool mDeferClearingContentForTSF = false;
+  bool mDeferClearingContentForTSF;
   // While the instance is dispatching events, the event may not be handled
   // synchronously in e10s mode.  So, in such case, in strictly speaking,
   // we shouldn't query layout information.  However, TS_E_NOLAYOUT bugs of
   // ITextStoreAPC::GetTextExt() blocks us to behave ideally.
   // For preventing it to be called, we should put off notifying TSF of
   // anything until layout information becomes available.
-  bool mDeferNotifyingTSF = false;
+  bool mDeferNotifyingTSF;
   // While the document is locked, committing composition always fails since
   // TSF needs another document lock for modifying the composition, selection
   // and etc.  So, committing composition should be performed after the
   // document is unlocked.
-  bool mDeferCommittingComposition = false;
-  bool mDeferCancellingComposition = false;
+  bool mDeferCommittingComposition;
+  bool mDeferCancellingComposition;
   // Immediately after a call of Destroy(), mDestroyed becomes true.  If this
   // is true, the instance shouldn't grant any requests from the TIP anymore.
-  bool mDestroyed = false;
+  bool mDestroyed;
   // While the instance is being destroyed, this is set to true for avoiding
   // recursive Destroy() calls.
-  bool mBeingDestroyed = false;
-  // Whether we're in the private browsing mode.
-  bool mInPrivateBrowsing = true;
+  bool mBeingDestroyed;
 
   // TSF thread manager object for the current application
   static StaticRefPtr<ITfThreadMgr> sThreadMgr;
   static already_AddRefed<ITfThreadMgr> GetThreadMgr();
   // sMessagePump is QI'ed from sThreadMgr
   static StaticRefPtr<ITfMessagePump> sMessagePump;
 
  public: