From a24ad1c55b4120b8ffacf2311e967eda50173a40 Mon Sep 17 00:00:00 2001 From: Butkovits Atila Date: Wed, 5 Aug 2020 22:19:30 +0300 Subject: [PATCH] Backed out changeset 6d39aab86966 (bug 1633710) for failure at test_disabled_hosts.js. CLOSED TREE --- .../res/containers/completion-error-page.js | 2 +- .../payments/res/containers/payment-dialog.js | 2 +- .../mochitest/test_completion_error_page.html | 2 +- caps/BasePrincipal.cpp | 32 ------------------- caps/BasePrincipal.h | 3 -- caps/nsIPrincipal.idl | 22 ------------- .../geckoview/GeckoViewPermission.jsm | 2 +- .../modules/geckoview/LoadURIDelegate.jsm | 8 ++--- .../components/passwordmgr/LoginManager.jsm | 2 +- 9 files changed, 9 insertions(+), 66 deletions(-) diff --git a/browser/components/payments/res/containers/completion-error-page.js b/browser/components/payments/res/containers/completion-error-page.js index e6b3d5c3e197..9e8f7ce9f7b1 100644 --- a/browser/components/payments/res/containers/completion-error-page.js +++ b/browser/components/payments/res/containers/completion-error-page.js @@ -51,7 +51,7 @@ export default class CompletionErrorPage extends HandleEventMixin( } let { request } = this.requestStore.getState(); - let { displayHost } = request.topLevelPrincipal; + let { displayHost } = request.topLevelPrincipal.URI; for (let key of [ "pageTitle", "suggestion-heading", diff --git a/browser/components/payments/res/containers/payment-dialog.js b/browser/components/payments/res/containers/payment-dialog.js index f2083b47b781..7bf094e26711 100644 --- a/browser/components/payments/res/containers/payment-dialog.js +++ b/browser/components/payments/res/containers/payment-dialog.js @@ -514,7 +514,7 @@ export default class PaymentDialog extends HandleEventMixin( render(state) { let request = state.request; let paymentDetails = request.paymentDetails; - this._hostNameEl.textContent = request.topLevelPrincipal.displayHost; + this._hostNameEl.textContent = request.topLevelPrincipal.URI.displayHost; let displayItems = request.paymentDetails.displayItems || []; let additionalItems = this._getAdditionalDisplayItems(state); diff --git a/browser/components/payments/test/mochitest/test_completion_error_page.html b/browser/components/payments/test/mochitest/test_completion_error_page.html index d3cf005c9717..cb8e8097587a 100644 --- a/browser/components/payments/test/mochitest/test_completion_error_page.html +++ b/browser/components/payments/test/mochitest/test_completion_error_page.html @@ -62,7 +62,7 @@ add_task(async function test_no_values() { }); await asyncElementRendered(); - is(page.requestStore.getState().request.topLevelPrincipal.displayHost, displayHost, + is(page.requestStore.getState().request.topLevelPrincipal.URI.displayHost, displayHost, "State should have the displayHost set properly"); is(page.querySelector("h2").textContent, `Oh noes! ${displayHost} is having an issue`, diff --git a/caps/BasePrincipal.cpp b/caps/BasePrincipal.cpp index fd69616022e3..0eb5d79746a2 100644 --- a/caps/BasePrincipal.cpp +++ b/caps/BasePrincipal.cpp @@ -801,38 +801,6 @@ BasePrincipal::GetExposableSpec(nsACString& aSpec) { return clone->GetAsciiSpec(aSpec); } -NS_IMETHODIMP -BasePrincipal::GetDisplaySpec(nsACString& aSpec) { - aSpec.Truncate(); - nsCOMPtr prinURI; - nsresult rv = GetURI(getter_AddRefs(prinURI)); - if (NS_FAILED(rv) || !prinURI) { - return NS_OK; - } - return prinURI->GetDisplaySpec(aSpec); -} - -NS_IMETHODIMP -BasePrincipal::GetDisplayHost(nsACString& aHost) { - aHost.Truncate(); - nsCOMPtr prinURI; - nsresult rv = GetURI(getter_AddRefs(prinURI)); - if (NS_FAILED(rv) || !prinURI) { - return NS_OK; - } - return prinURI->GetDisplayHost(aHost); -} -NS_IMETHODIMP -BasePrincipal::GetDisplayPrePath(nsACString& aPrepath) { - aPrepath.Truncate(); - nsCOMPtr prinURI; - nsresult rv = GetURI(getter_AddRefs(prinURI)); - if (NS_FAILED(rv) || !prinURI) { - return NS_OK; - } - return prinURI->GetDisplayPrePath(aPrepath); -} - NS_IMETHODIMP BasePrincipal::GetPrepath(nsACString& aPath) { aPath.Truncate(); diff --git a/caps/BasePrincipal.h b/caps/BasePrincipal.h index c3ebac94af7c..ddc0372e06cc 100644 --- a/caps/BasePrincipal.h +++ b/caps/BasePrincipal.h @@ -134,9 +134,6 @@ class BasePrincipal : public nsJSPrincipals { NS_IMETHOD GetSpec(nsACString& aSpec) override; NS_IMETHOD GetExposablePrePath(nsACString& aResult) override; NS_IMETHOD GetExposableSpec(nsACString& aSpec) override; - NS_IMETHOD GetDisplaySpec(nsACString& aSpec) override; - NS_IMETHOD GetDisplayHost(nsACString& aSpec) override; - NS_IMETHOD GetDisplayPrePath(nsACString& aSpec) override; NS_IMETHOD GetHostPort(nsACString& aRes) override; NS_IMETHOD GetHost(nsACString& aRes) override; NS_IMETHOD GetPrepath(nsACString& aResult) override; diff --git a/caps/nsIPrincipal.idl b/caps/nsIPrincipal.idl index 74038d2ca285..c2f1bc59679e 100644 --- a/caps/nsIPrincipal.idl +++ b/caps/nsIPrincipal.idl @@ -298,28 +298,6 @@ interface nsIPrincipal : nsISerializable */ readonly attribute ACString exposableSpec; - /** - * Returns the same as calling .spec, only with a UTF8 encoded hostname - * if that hostname doesn't contain blacklisted characters, and - * the network.IDN_show_punycode pref is false - */ - readonly attribute ACString displaySpec; - - /** - * Returns the same as calling .host, only with a UTF8 encoded hostname - * if that hostname doesn't contain blacklisted characters, and - * the network.IDN_show_punycode pref is false - */ - readonly attribute ACString displayHost; - - /** - * Returns the same as calling .prepath, only with a UTF8 encoded hostname - * if that hostname doesn't contain blacklisted characters, and - * the network.IDN_show_punycode pref is false - */ - readonly attribute ACString displayPrePath; - - /** * Return the scheme of the principals URI */ diff --git a/mobile/android/components/geckoview/GeckoViewPermission.jsm b/mobile/android/components/geckoview/GeckoViewPermission.jsm index f70419ec95c4..b71194742d35 100644 --- a/mobile/android/components/geckoview/GeckoViewPermission.jsm +++ b/mobile/android/components/geckoview/GeckoViewPermission.jsm @@ -253,7 +253,7 @@ class GeckoViewPermission { dispatcher .sendRequestForResult({ type: "GeckoView:ContentPermission", - uri: aRequest.principal.displaySpec, + uri: aRequest.principal.URI.displaySpec, perm: perm.type, }) .then(granted => { diff --git a/mobile/android/modules/geckoview/LoadURIDelegate.jsm b/mobile/android/modules/geckoview/LoadURIDelegate.jsm index 63deac174f6d..4729c5801f6a 100644 --- a/mobile/android/modules/geckoview/LoadURIDelegate.jsm +++ b/mobile/android/modules/geckoview/LoadURIDelegate.jsm @@ -27,16 +27,16 @@ const LoadURIDelegate = { return false; } - const triggerUri = aTriggeringPrincipal.isNullPrincipal - ? null - : aTriggeringPrincipal.displaySpec; + const triggerUri = + aTriggeringPrincipal && + (aTriggeringPrincipal.isNullPrincipal ? null : aTriggeringPrincipal.URI); const message = { type: "GeckoView:OnLoadRequest", uri: aUri ? aUri.displaySpec : "", where: aWhere, flags: aFlags, - triggerUri, + triggerUri: triggerUri && triggerUri.displaySpec, hasUserGesture: aWindow.document.hasValidTransientUserGestureActivation, }; diff --git a/toolkit/components/passwordmgr/LoginManager.jsm b/toolkit/components/passwordmgr/LoginManager.jsm index 932c2c77a7dc..53448037b3d1 100644 --- a/toolkit/components/passwordmgr/LoginManager.jsm +++ b/toolkit/components/passwordmgr/LoginManager.jsm @@ -460,7 +460,7 @@ LoginManager.prototype = { perm.type == PERMISSION_SAVE_LOGINS && perm.capability == Services.perms.DENY_ACTION ) { - disabledHosts.push(perm.principal.displayPrePath); + disabledHosts.push(perm.principal.URI.displayPrePath); } }