diff options
author | wicknix <39230578+wicknix@users.noreply.github.com> | 2019-04-15 18:58:07 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-15 18:58:07 -0500 |
commit | 5a1843c9f9e323627f9c35529e6a8c853d4dbb0d (patch) | |
tree | 62de3cd7cb8a6f75e568863bb73ca2deb80d87a9 /docshell | |
parent | 065f6f9e5ebc1ed6cfaadaf7851b6021fa94a013 (diff) | |
parent | 095ea556855b38138e39e713f482eb440f7da9b2 (diff) | |
download | UXP-5a1843c9f9e323627f9c35529e6a8c853d4dbb0d.tar UXP-5a1843c9f9e323627f9c35529e6a8c853d4dbb0d.tar.gz UXP-5a1843c9f9e323627f9c35529e6a8c853d4dbb0d.tar.lz UXP-5a1843c9f9e323627f9c35529e6a8c853d4dbb0d.tar.xz UXP-5a1843c9f9e323627f9c35529e6a8c853d4dbb0d.zip |
Merge pull request #1 from MoonchildProductions/master
keep up with mc
Diffstat (limited to 'docshell')
-rw-r--r-- | docshell/base/SerializedLoadContext.cpp | 1 | ||||
-rw-r--r-- | docshell/base/moz.build | 2 | ||||
-rw-r--r-- | docshell/base/nsAboutRedirector.cpp | 1 | ||||
-rw-r--r-- | docshell/base/nsDSURIContentListener.cpp | 1 | ||||
-rw-r--r-- | docshell/base/nsDefaultURIFixup.cpp | 29 | ||||
-rw-r--r-- | docshell/base/nsDocShell.cpp | 131 | ||||
-rw-r--r-- | docshell/base/nsDocShell.h | 1 | ||||
-rw-r--r-- | docshell/base/nsDocShellEditorData.cpp | 1 | ||||
-rw-r--r-- | docshell/base/nsDocShellLoadInfo.cpp | 17 | ||||
-rw-r--r-- | docshell/base/nsDocShellLoadInfo.h | 4 | ||||
-rw-r--r-- | docshell/base/nsIDocShell.idl | 5 | ||||
-rw-r--r-- | docshell/base/nsIDocShellLoadInfo.idl | 6 | ||||
-rw-r--r-- | docshell/base/timeline/ObservedDocShell.h | 1 | ||||
-rw-r--r-- | docshell/base/timeline/TimelineConsumers.h | 3 | ||||
-rw-r--r-- | docshell/base/timeline/TimelineMarker.cpp | 2 | ||||
-rw-r--r-- | docshell/base/timeline/moz.build | 2 | ||||
-rw-r--r-- | docshell/shistory/moz.build | 2 | ||||
-rw-r--r-- | docshell/shistory/nsSHEntry.cpp | 1 | ||||
-rw-r--r-- | docshell/shistory/nsSHEntryShared.h | 1 | ||||
-rw-r--r-- | docshell/test/unit/test_nsDefaultURIFixup_info.js | 8 |
20 files changed, 106 insertions, 113 deletions
diff --git a/docshell/base/SerializedLoadContext.cpp b/docshell/base/SerializedLoadContext.cpp index b8e3eb929..281fd7bd6 100644 --- a/docshell/base/SerializedLoadContext.cpp +++ b/docshell/base/SerializedLoadContext.cpp @@ -7,6 +7,7 @@ #include "SerializedLoadContext.h" #include "nsNetUtil.h" #include "nsIChannel.h" +#include "nsILoadContext.h" #include "nsIPrivateBrowsingChannel.h" #include "nsIWebSocketChannel.h" diff --git a/docshell/base/moz.build b/docshell/base/moz.build index 6ea3e6d28..120465bac 100644 --- a/docshell/base/moz.build +++ b/docshell/base/moz.build @@ -50,7 +50,7 @@ EXPORTS.mozilla += [ 'LoadContext.h', ] -UNIFIED_SOURCES += [ +SOURCES += [ 'LoadContext.cpp', 'nsAboutRedirector.cpp', 'nsDefaultURIFixup.cpp', diff --git a/docshell/base/nsAboutRedirector.cpp b/docshell/base/nsAboutRedirector.cpp index 4dba7f261..f57d6c002 100644 --- a/docshell/base/nsAboutRedirector.cpp +++ b/docshell/base/nsAboutRedirector.cpp @@ -8,6 +8,7 @@ #include "nsNetUtil.h" #include "nsAboutProtocolUtils.h" #include "mozilla/ArrayUtils.h" +#include "nsIChannel.h" #include "nsIProtocolHandler.h" NS_IMPL_ISUPPORTS(nsAboutRedirector, nsIAboutModule) diff --git a/docshell/base/nsDSURIContentListener.cpp b/docshell/base/nsDSURIContentListener.cpp index ee6a4dd62..3f52251cc 100644 --- a/docshell/base/nsDSURIContentListener.cpp +++ b/docshell/base/nsDSURIContentListener.cpp @@ -24,6 +24,7 @@ #include "nsDocShellLoadTypes.h" #include "nsIMultiPartChannel.h" #include "mozilla/dom/nsCSPUtils.h" +#include "nsIStreamListener.h" using namespace mozilla; diff --git a/docshell/base/nsDefaultURIFixup.cpp b/docshell/base/nsDefaultURIFixup.cpp index e519720ab..d2876181a 100644 --- a/docshell/base/nsDefaultURIFixup.cpp +++ b/docshell/base/nsDefaultURIFixup.cpp @@ -154,6 +154,15 @@ HasUserPassword(const nsACString& aStringURI) return false; } +// Assume that 1 tab is accidental, but more than 1 implies this is +// supposed to be tab-separated content. +static bool +MaybeTabSeparatedContent(const nsCString& aStringURI) +{ + auto firstTab = aStringURI.FindChar('\t'); + return firstTab != kNotFound && aStringURI.RFindChar('\t') != firstTab; +} + NS_IMETHODIMP nsDefaultURIFixup::GetFixupURIInfo(const nsACString& aStringURI, uint32_t aFixupFlags, @@ -168,8 +177,8 @@ nsDefaultURIFixup::GetFixupURIInfo(const nsACString& aStringURI, // Eliminate embedded newlines, which single-line text fields now allow: uriString.StripChars("\r\n"); - // Cleanup the empty spaces that might be on each end: - uriString.Trim(" "); + // Cleanup the empty spaces and tabs that might be on each end: + uriString.Trim(" \t"); NS_ENSURE_TRUE(!uriString.IsEmpty(), NS_ERROR_FAILURE); @@ -367,12 +376,16 @@ nsDefaultURIFixup::GetFixupURIInfo(const nsACString& aStringURI, inputHadDuffProtocol = true; } - // NB: this rv gets returned at the end of this method if we never - // do a keyword fixup after this (because the pref or the flags passed - // might not let us). - rv = FixupURIProtocol(uriString, info, getter_AddRefs(uriWithProtocol)); - if (uriWithProtocol) { - info->mFixedURI = uriWithProtocol; + // Note: this rv gets returned at the end of this method if we don't fix up + // the protocol and don't do a keyword fixup after this (because the pref + // or the flags passed might not let us). + rv = NS_OK; + // Avoid fixing up content that looks like tab-separated values + if (!MaybeTabSeparatedContent(uriString)) { + rv = FixupURIProtocol(uriString, info, getter_AddRefs(uriWithProtocol)); + if (uriWithProtocol) { + info->mFixedURI = uriWithProtocol; + } } // See if it is a keyword diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 8eca47495..d67780317 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -27,7 +27,6 @@ #include "mozilla/Preferences.h" #include "mozilla/Services.h" #include "mozilla/StartupTimeline.h" -#include "mozilla/Telemetry.h" #include "mozilla/Unused.h" #include "Navigator.h" #include "URIUtils.h" @@ -40,6 +39,7 @@ #include "nsIDOMDocument.h" #include "nsIDOMElement.h" +#include "nsAboutProtocolUtils.h" #include "nsArray.h" #include "nsArrayUtils.h" #include "nsContentSecurityManager.h" @@ -194,7 +194,6 @@ #include "nsSandboxFlags.h" #include "nsXULAppAPI.h" #include "nsDOMNavigationTiming.h" -#include "nsISecurityUITelemetry.h" #include "nsIAppsService.h" #include "nsDSURIContentListener.h" #include "nsDocShellLoadTypes.h" @@ -1263,6 +1262,7 @@ nsDocShell::LoadURI(nsIURI* aURI, nsCOMPtr<nsIURI> referrer; nsCOMPtr<nsIURI> originalURI; bool loadReplace = false; + bool isFromProcessingFrameAttributes = false; nsCOMPtr<nsIInputStream> postStream; nsCOMPtr<nsIInputStream> headersStream; nsCOMPtr<nsIPrincipal> triggeringPrincipal; @@ -1292,6 +1292,7 @@ nsDocShell::LoadURI(nsIURI* aURI, aLoadInfo->GetReferrer(getter_AddRefs(referrer)); aLoadInfo->GetOriginalURI(getter_AddRefs(originalURI)); aLoadInfo->GetLoadReplace(&loadReplace); + aLoadInfo->GetIsFromProcessingFrameAttributes(&isFromProcessingFrameAttributes); nsDocShellInfoLoadType lt = nsIDocShellLoadInfo::loadNormal; aLoadInfo->GetLoadType(<); // Get the appropriate loadType from nsIDocShellLoadInfo type @@ -1571,6 +1572,7 @@ nsDocShell::LoadURI(nsIURI* aURI, return InternalLoad(aURI, originalURI, loadReplace, + isFromProcessingFrameAttributes, referrer, referrerPolicy, triggeringPrincipal, @@ -1972,71 +1974,7 @@ nsDocShell::GetCharset(nsACString& aCharset) NS_IMETHODIMP nsDocShell::GatherCharsetMenuTelemetry() { - nsCOMPtr<nsIContentViewer> viewer; - GetContentViewer(getter_AddRefs(viewer)); - if (!viewer) { - return NS_OK; - } - - nsIDocument* doc = viewer->GetDocument(); - if (!doc || doc->WillIgnoreCharsetOverride()) { - return NS_OK; - } - - Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_USED, true); - - bool isFileURL = false; - nsIURI* url = doc->GetOriginalURI(); - if (url) { - url->SchemeIs("file", &isFileURL); - } - - int32_t charsetSource = doc->GetDocumentCharacterSetSource(); - switch (charsetSource) { - case kCharsetFromTopLevelDomain: - // Unlabeled doc on a domain that we map to a fallback encoding - Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_SITUATION, 7); - break; - case kCharsetFromFallback: - case kCharsetFromDocTypeDefault: - case kCharsetFromCache: - case kCharsetFromParentFrame: - case kCharsetFromHintPrevDoc: - // Changing charset on an unlabeled doc. - if (isFileURL) { - Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_SITUATION, 0); - } else { - Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_SITUATION, 1); - } - break; - case kCharsetFromAutoDetection: - // Changing charset on unlabeled doc where chardet fired - if (isFileURL) { - Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_SITUATION, 2); - } else { - Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_SITUATION, 3); - } - break; - case kCharsetFromMetaPrescan: - case kCharsetFromMetaTag: - case kCharsetFromChannel: - // Changing charset on a doc that had a charset label. - Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_SITUATION, 4); - break; - case kCharsetFromParentForced: - case kCharsetFromUserForced: - // Changing charset on a document that already had an override. - Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_SITUATION, 5); - break; - case kCharsetFromIrreversibleAutoDetection: - case kCharsetFromOtherComponent: - case kCharsetFromByteOrderMark: - case kCharsetUninitialized: - default: - // Bug. This isn't supposed to happen. - Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_SITUATION, 6); - break; - } + /* STUB */ return NS_OK; } @@ -5046,15 +4984,6 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI, cssClass.AssignLiteral("badStsCert"); } - uint32_t bucketId; - if (isStsHost) { - // measuring STS separately allows us to measure click through - // rates easily - bucketId = nsISecurityUITelemetry::WARNING_BAD_CERT_TOP_STS; - } else { - bucketId = nsISecurityUITelemetry::WARNING_BAD_CERT_TOP; - } - // See if an alternate cert error page is registered nsAdoptingCString alternateErrorPage = Preferences::GetCString("security.alternate_certificate_error_page"); @@ -5062,10 +4991,6 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI, errorPage.Assign(alternateErrorPage); } - if (!IsFrame() && errorPage.EqualsIgnoreCase("certerror")) { - Telemetry::Accumulate(mozilla::Telemetry::SECURITY_UI, bucketId); - } - } else { error.AssignLiteral("nssFailure2"); } @@ -5086,27 +5011,12 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI, errorPage.Assign(alternateErrorPage); } - uint32_t bucketId; - bool sendTelemetry = false; if (NS_ERROR_PHISHING_URI == aError) { - sendTelemetry = true; error.AssignLiteral("deceptiveBlocked"); - bucketId = IsFrame() ? nsISecurityUITelemetry::WARNING_PHISHING_PAGE_FRAME - : nsISecurityUITelemetry::WARNING_PHISHING_PAGE_TOP; } else if (NS_ERROR_MALWARE_URI == aError) { - sendTelemetry = true; error.AssignLiteral("malwareBlocked"); - bucketId = IsFrame() ? nsISecurityUITelemetry::WARNING_MALWARE_PAGE_FRAME - : nsISecurityUITelemetry::WARNING_MALWARE_PAGE_TOP; } else if (NS_ERROR_UNWANTED_URI == aError) { - sendTelemetry = true; error.AssignLiteral("unwantedBlocked"); - bucketId = IsFrame() ? nsISecurityUITelemetry::WARNING_UNWANTED_PAGE_FRAME - : nsISecurityUITelemetry::WARNING_UNWANTED_PAGE_TOP; - } - - if (sendTelemetry && errorPage.EqualsIgnoreCase("blocked")) { - Telemetry::Accumulate(Telemetry::SECURITY_UI, bucketId); } cssClass.AssignLiteral("blacklist"); @@ -5412,8 +5322,8 @@ nsDocShell::LoadErrorPage(nsIURI* aURI, const char16_t* aURL, rv = NS_NewURI(getter_AddRefs(errorPageURI), errorPageUrl); NS_ENSURE_SUCCESS(rv, rv); - return InternalLoad(errorPageURI, nullptr, false, nullptr, - mozilla::net::RP_Default, + return InternalLoad(errorPageURI, nullptr, false, false, + nullptr, mozilla::net::RP_Default, nsContentUtils::GetSystemPrincipal(), nullptr, INTERNAL_LOAD_FLAGS_NONE, EmptyString(), nullptr, NullString(), nullptr, nullptr, LOAD_ERROR_PAGE, @@ -5499,6 +5409,7 @@ nsDocShell::Reload(uint32_t aReloadFlags) rv = InternalLoad(currentURI, originalURI, loadReplace, + false, // Is from processing frame attributes referrerURI, referrerPolicy, triggeringPrincipal, @@ -7622,8 +7533,6 @@ nsDocShell::EndPageLoad(nsIWebProgress* aProgress, TimeStamp channelCreationTime; rv = timingChannel->GetChannelCreation(&channelCreationTime); if (NS_SUCCEEDED(rv) && !channelCreationTime.IsNull()) { - Telemetry::AccumulateTimeDelta(Telemetry::TOTAL_CONTENT_PAGE_LOAD_TIME, - channelCreationTime); nsCOMPtr<nsPILoadGroupInternal> internalLoadGroup = do_QueryInterface(mLoadGroup); if (internalLoadGroup) { @@ -9652,6 +9561,7 @@ class InternalLoadEvent : public Runnable public: InternalLoadEvent(nsDocShell* aDocShell, nsIURI* aURI, nsIURI* aOriginalURI, bool aLoadReplace, + bool aIsFromProcessingFrameAttributes, nsIURI* aReferrer, uint32_t aReferrerPolicy, nsIPrincipal* aTriggeringPrincipal, nsIPrincipal* aPrincipalToInherit, uint32_t aFlags, @@ -9665,6 +9575,7 @@ public: , mURI(aURI) , mOriginalURI(aOriginalURI) , mLoadReplace(aLoadReplace) + , mIsFromProcessingFrameAttributes(aIsFromProcessingFrameAttributes) , mReferrer(aReferrer) , mReferrerPolicy(aReferrerPolicy) , mTriggeringPrincipal(aTriggeringPrincipal) @@ -9689,6 +9600,7 @@ public: { return mDocShell->InternalLoad(mURI, mOriginalURI, mLoadReplace, + mIsFromProcessingFrameAttributes, mReferrer, mReferrerPolicy, mTriggeringPrincipal, mPrincipalToInherit, @@ -9709,6 +9621,7 @@ private: nsCOMPtr<nsIURI> mURI; nsCOMPtr<nsIURI> mOriginalURI; bool mLoadReplace; + bool mIsFromProcessingFrameAttributes; nsCOMPtr<nsIURI> mReferrer; uint32_t mReferrerPolicy; nsCOMPtr<nsIPrincipal> mTriggeringPrincipal; @@ -9777,6 +9690,7 @@ NS_IMETHODIMP nsDocShell::InternalLoad(nsIURI* aURI, nsIURI* aOriginalURI, bool aLoadReplace, + bool aIsFromProcessingFrameAttributes, nsIURI* aReferrer, uint32_t aReferrerPolicy, nsIPrincipal* aTriggeringPrincipal, @@ -10079,6 +9993,7 @@ nsDocShell::InternalLoad(nsIURI* aURI, INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER)); loadInfo->SetOriginalURI(aOriginalURI); loadInfo->SetLoadReplace(aLoadReplace); + loadInfo->SetIsFromProcessingFrameAttributes(aIsFromProcessingFrameAttributes); loadInfo->SetTriggeringPrincipal(aTriggeringPrincipal); loadInfo->SetInheritPrincipal( aFlags & INTERNAL_LOAD_FLAGS_INHERIT_PRINCIPAL); @@ -10127,6 +10042,7 @@ nsDocShell::InternalLoad(nsIURI* aURI, rv = targetDocShell->InternalLoad(aURI, aOriginalURI, aLoadReplace, + aIsFromProcessingFrameAttributes, aReferrer, aReferrerPolicy, aTriggeringPrincipal, @@ -10209,6 +10125,7 @@ nsDocShell::InternalLoad(nsIURI* aURI, // Do this asynchronously nsCOMPtr<nsIRunnable> ev = new InternalLoadEvent(this, aURI, aOriginalURI, aLoadReplace, + aIsFromProcessingFrameAttributes, aReferrer, aReferrerPolicy, aTriggeringPrincipal, principalToInherit, aFlags, aTypeHint, aPostData, aHeadersData, @@ -10735,7 +10652,8 @@ nsDocShell::InternalLoad(nsIURI* aURI, nsINetworkPredictor::PREDICT_LOAD, this, nullptr); nsCOMPtr<nsIRequest> req; - rv = DoURILoad(aURI, aOriginalURI, aLoadReplace, loadFromExternal, + rv = DoURILoad(aURI, aOriginalURI, aLoadReplace, + aIsFromProcessingFrameAttributes, loadFromExternal, (aFlags & INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI), aReferrer, !(aFlags & INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER), @@ -10817,6 +10735,7 @@ nsresult nsDocShell::DoURILoad(nsIURI* aURI, nsIURI* aOriginalURI, bool aLoadReplace, + bool aIsFromProcessingFrameAttributes, bool aLoadFromExternal, bool aForceAllowDataURI, nsIURI* aReferrerURI, @@ -10977,7 +10896,7 @@ nsDocShell::DoURILoad(nsIURI* aURI, securityFlags |= nsILoadInfo::SEC_SANDBOXED; } - nsCOMPtr<nsILoadInfo> loadInfo = + RefPtr<LoadInfo> loadInfo = (aContentPolicyType == nsIContentPolicy::TYPE_DOCUMENT) ? new LoadInfo(loadingWindow, aTriggeringPrincipal, topLevelLoadingContext, securityFlags) : @@ -11003,6 +10922,10 @@ nsDocShell::DoURILoad(nsIURI* aURI, return rv; } + if (aIsFromProcessingFrameAttributes) { + loadInfo->SetIsFromProcessingFrameAttributes(); + } + if (!isSrcdoc) { rv = NS_NewChannelInternal(getter_AddRefs(channel), aURI, @@ -12281,7 +12204,9 @@ nsDocShell::ShouldAddToSessionHistory(nsIURI* aURI) return false; } - if (buf.EqualsLiteral("blank") || buf.EqualsLiteral("newtab")) { + if (buf.EqualsLiteral("blank") || buf.EqualsLiteral("logopage") || + (buf.EqualsLiteral("newtab") && + !Preferences::GetBool("browser.newtabpage.add_to_session_history", false))) { return false; } } @@ -12653,6 +12578,7 @@ nsDocShell::LoadHistoryEntry(nsISHEntry* aEntry, uint32_t aLoadType) rv = InternalLoad(uri, originalURI, loadReplace, + false, // Is from processing frame attributes referrerURI, referrerPolicy, triggeringPrincipal, @@ -14156,6 +14082,7 @@ nsDocShell::OnLinkClickSync(nsIContent* aContent, nsresult rv = InternalLoad(clonedURI, // New URI nullptr, // Original URI false, // LoadReplace + false, // From frame attributes referer, // Referer URI refererPolicy, // Referer policy triggeringPrincipal, diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index f510a15b0..8de3995fc 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -371,6 +371,7 @@ protected: nsresult DoURILoad(nsIURI* aURI, nsIURI* aOriginalURI, bool aLoadReplace, + bool aIsFromProcessingFrameAttributes, bool aLoadFromExternal, bool aForceAllowDataURI, nsIURI* aReferrer, diff --git a/docshell/base/nsDocShellEditorData.cpp b/docshell/base/nsDocShellEditorData.cpp index 7e4068eb9..80c8c6ec3 100644 --- a/docshell/base/nsDocShellEditorData.cpp +++ b/docshell/base/nsDocShellEditorData.cpp @@ -8,6 +8,7 @@ #include "nsIInterfaceRequestorUtils.h" #include "nsComponentManagerUtils.h" #include "nsPIDOMWindow.h" +#include "nsIDocument.h" #include "nsIDOMDocument.h" #include "nsIEditor.h" #include "nsIEditingSession.h" diff --git a/docshell/base/nsDocShellLoadInfo.cpp b/docshell/base/nsDocShellLoadInfo.cpp index b00e8e360..b1a990267 100644 --- a/docshell/base/nsDocShellLoadInfo.cpp +++ b/docshell/base/nsDocShellLoadInfo.cpp @@ -20,6 +20,7 @@ nsDocShellLoadInfo::nsDocShellLoadInfo() , mReferrerPolicy(mozilla::net::RP_Default) , mLoadType(nsIDocShellLoadInfo::loadNormal) , mIsSrcdocLoad(false) + , mIsFromProcessingFrameAttributes(false) { } @@ -310,3 +311,19 @@ nsDocShellLoadInfo::SetBaseURI(nsIURI* aBaseURI) mBaseURI = aBaseURI; return NS_OK; } + +NS_IMETHODIMP +nsDocShellLoadInfo::GetIsFromProcessingFrameAttributes(bool* aIsFromProcessingFrameAttributes) +{ + NS_ENSURE_ARG_POINTER(aIsFromProcessingFrameAttributes); + + *aIsFromProcessingFrameAttributes = mIsFromProcessingFrameAttributes; + return NS_OK; +} + +NS_IMETHODIMP +nsDocShellLoadInfo::SetIsFromProcessingFrameAttributes(bool aIsFromProcessingFrameAttributes) +{ + mIsFromProcessingFrameAttributes = aIsFromProcessingFrameAttributes; + return NS_OK; +} diff --git a/docshell/base/nsDocShellLoadInfo.h b/docshell/base/nsDocShellLoadInfo.h index f3ddcca1e..09479683b 100644 --- a/docshell/base/nsDocShellLoadInfo.h +++ b/docshell/base/nsDocShellLoadInfo.h @@ -49,6 +49,10 @@ protected: nsString mSrcdocData; nsCOMPtr<nsIDocShell> mSourceDocShell; nsCOMPtr<nsIURI> mBaseURI; + + // This will be true if this load is triggered by attribute changes. + // See nsILoadInfo.isFromProcessingFrameAttributes + bool mIsFromProcessingFrameAttributes; }; #endif /* nsDocShellLoadInfo_h__ */ diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl index e34e6adfd..d205e5b0c 100644 --- a/docshell/base/nsIDocShell.idl +++ b/docshell/base/nsIDocShell.idl @@ -133,6 +133,10 @@ interface nsIDocShell : nsIDocShellTreeItem * @param aLoadReplace - If set LOAD_REPLACE flag will be set on the * channel. aOriginalURI is null, this argument is * ignored. + * @param aIsFromProcessingFrameAttributes + * - If this is a load triggered by changing frame + * attributes. + * See nsILoadInfo.isFromProcessingFrameAttributes * @param aReferrer - Referring URI * @param aReferrerPolicy - Referrer policy * @param aTriggeringPrincipal - A non-null principal that initiated that load. @@ -178,6 +182,7 @@ interface nsIDocShell : nsIDocShellTreeItem [noscript]void internalLoad(in nsIURI aURI, in nsIURI aOriginalURI, in boolean aLoadReplace, + in boolean aIsFromProcessingFrameAttributes, in nsIURI aReferrer, in unsigned long aReferrerPolicy, in nsIPrincipal aTriggeringPrincipal, diff --git a/docshell/base/nsIDocShellLoadInfo.idl b/docshell/base/nsIDocShellLoadInfo.idl index 8804f63a3..2f52ef0aa 100644 --- a/docshell/base/nsIDocShellLoadInfo.idl +++ b/docshell/base/nsIDocShellLoadInfo.idl @@ -128,4 +128,10 @@ interface nsIDocShellLoadInfo : nsISupports * URI as this information isn't embedded in the load's URI. */ attribute nsIURI baseURI; + + /** + * This will be true if this load is triggered by attribute changes. + * See nsILoadInfo.isFromProcessingFrameAttributes + */ + attribute boolean isFromProcessingFrameAttributes; }; diff --git a/docshell/base/timeline/ObservedDocShell.h b/docshell/base/timeline/ObservedDocShell.h index 05eafbd0c..b437de769 100644 --- a/docshell/base/timeline/ObservedDocShell.h +++ b/docshell/base/timeline/ObservedDocShell.h @@ -11,6 +11,7 @@ #include "mozilla/RefPtr.h" #include "mozilla/UniquePtr.h" #include "nsTArray.h" +#include "nsIDocShell.h" class nsIDocShell; diff --git a/docshell/base/timeline/TimelineConsumers.h b/docshell/base/timeline/TimelineConsumers.h index 04099e1b9..2a77b83ac 100644 --- a/docshell/base/timeline/TimelineConsumers.h +++ b/docshell/base/timeline/TimelineConsumers.h @@ -7,11 +7,14 @@ #define mozilla_TimelineConsumers_h_ #include "nsIObserver.h" +#include "nsIDocShell.h" #include "mozilla/StaticPtr.h" #include "mozilla/UniquePtr.h" #include "mozilla/LinkedList.h" #include "mozilla/StaticMutex.h" #include "TimelineMarkerEnums.h" // for MarkerTracingType +#include "mozilla/dom/ProfileTimelineMarkerBinding.h" +#include "nsTArray.h" class nsDocShell; class nsIDocShell; diff --git a/docshell/base/timeline/TimelineMarker.cpp b/docshell/base/timeline/TimelineMarker.cpp index b83e9ceb4..0bf248313 100644 --- a/docshell/base/timeline/TimelineMarker.cpp +++ b/docshell/base/timeline/TimelineMarker.cpp @@ -5,6 +5,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "TimelineMarker.h" +#include "mozilla/dom/ProfileTimelineMarkerBinding.h" +#include "nsContentUtils.h" namespace mozilla { diff --git a/docshell/base/timeline/moz.build b/docshell/base/timeline/moz.build index 824e37466..61cc4ec08 100644 --- a/docshell/base/timeline/moz.build +++ b/docshell/base/timeline/moz.build @@ -25,7 +25,7 @@ EXPORTS.mozilla += [ 'WorkerTimelineMarker.h', ] -UNIFIED_SOURCES += [ +SOURCES += [ 'AbstractTimelineMarker.cpp', 'AutoGlobalTimelineMarker.cpp', 'AutoTimelineMarker.cpp', diff --git a/docshell/shistory/moz.build b/docshell/shistory/moz.build index c85c3a3cb..3d3fb51a2 100644 --- a/docshell/shistory/moz.build +++ b/docshell/shistory/moz.build @@ -23,7 +23,7 @@ EXPORTS += [ 'nsSHEntryShared.h', ] -UNIFIED_SOURCES += [ +SOURCES += [ 'nsSHEntry.cpp', 'nsSHEntryShared.cpp', 'nsSHistory.cpp', diff --git a/docshell/shistory/nsSHEntry.cpp b/docshell/shistory/nsSHEntry.cpp index 6b0b066d9..89ba2ebeb 100644 --- a/docshell/shistory/nsSHEntry.cpp +++ b/docshell/shistory/nsSHEntry.cpp @@ -15,6 +15,7 @@ #include "nsIInputStream.h" #include "nsIURI.h" #include "mozilla/net/ReferrerPolicy.h" +#include "nsArray.h" #include <algorithm> namespace dom = mozilla::dom; diff --git a/docshell/shistory/nsSHEntryShared.h b/docshell/shistory/nsSHEntryShared.h index 0a40691ff..afeb33863 100644 --- a/docshell/shistory/nsSHEntryShared.h +++ b/docshell/shistory/nsSHEntryShared.h @@ -12,6 +12,7 @@ #include "nsCOMArray.h" #include "nsIBFCacheEntry.h" #include "nsIMutationObserver.h" +#include "nsISHEntry.h" #include "nsExpirationTracker.h" #include "nsRect.h" #include "nsString.h" diff --git a/docshell/test/unit/test_nsDefaultURIFixup_info.js b/docshell/test/unit/test_nsDefaultURIFixup_info.js index c606ac32e..748aaab93 100644 --- a/docshell/test/unit/test_nsDefaultURIFixup_info.js +++ b/docshell/test/unit/test_nsDefaultURIFixup_info.js @@ -469,6 +469,14 @@ var testcases = [ { keywordLookup: true, protocolChange: true, affectedByDNSForSingleHosts: true, + }, { + input: " \t mozilla.org/\t \t ", + fixedURI: "http://mozilla.org/", + alternateURI: "http://www.mozilla.org/", + protocolChange: true, + }, { + input: " moz\ti\tlla.org ", + keywordLookup: true, }]; if (Services.appinfo.OS.toLowerCase().startsWith("win")) { |