mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Backed out 2 changesets (bug 1558915) for causing bustages. CLOSED TREE
Backed out changeset e44c9fd81e5b (bug 1558915) Backed out changeset 3da6e9e86be4 (bug 1558915)
This commit is contained in:
parent
c16799f4af
commit
0cc257addd
@ -76,7 +76,8 @@ bool IsImageExtractionAllowed(Document* aDocument, JSContext* aCx,
|
||||
docURI->GetSpec(docURISpec);
|
||||
|
||||
// Allow local files to extract canvas data.
|
||||
if (docURI->SchemeIs("file")) {
|
||||
bool isFileURL;
|
||||
if (NS_SUCCEEDED(docURI->SchemeIs("file", &isFileURL)) && isFileURL) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,8 @@ class FontTableURIProtocolHandler final
|
||||
};
|
||||
|
||||
inline bool IsFontTableURI(nsIURI* aUri) {
|
||||
return aUri->SchemeIs(FONTTABLEURI_SCHEME);
|
||||
bool isFont;
|
||||
return NS_SUCCEEDED(aUri->SchemeIs(FONTTABLEURI_SCHEME, &isFont)) && isFont;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
|
@ -836,10 +836,18 @@ nsresult Geolocation::Init(nsPIDOMWindowInner* aContentDom) {
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (uri) {
|
||||
bool isHttp;
|
||||
rv = uri->SchemeIs("http", &isHttp);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool isHttps;
|
||||
rv = uri->SchemeIs("https", &isHttps);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Store the protocol to send via telemetry later.
|
||||
if (uri->SchemeIs("http")) {
|
||||
if (isHttp) {
|
||||
mProtocolType = ProtocolType::HTTP;
|
||||
} else if (uri->SchemeIs("https")) {
|
||||
} else if (isHttps) {
|
||||
mProtocolType = ProtocolType::HTTPS;
|
||||
}
|
||||
}
|
||||
|
@ -651,8 +651,9 @@ nsresult HTMLFormElement::SubmitSubmission(
|
||||
// STATE_STOP. As a result, we have to make sure that we simply pretend
|
||||
// we're not submitting when submitting to a JS URL. That's kinda bogus, but
|
||||
// there we are.
|
||||
bool schemeIsJavaScript = actionURI->SchemeIs("javascript");
|
||||
if (schemeIsJavaScript) {
|
||||
bool schemeIsJavaScript = false;
|
||||
if (NS_SUCCEEDED(actionURI->SchemeIs("javascript", &schemeIsJavaScript)) &&
|
||||
schemeIsJavaScript) {
|
||||
mIsSubmitting = false;
|
||||
}
|
||||
|
||||
@ -757,7 +758,12 @@ nsresult HTMLFormElement::DoSecureToInsecureSubmitCheck(nsIURI* aActionURL,
|
||||
if (!principalURI) {
|
||||
principalURI = OwnerDoc()->GetDocumentURI();
|
||||
}
|
||||
bool formIsHTTPS = principalURI->SchemeIs("https");
|
||||
bool formIsHTTPS;
|
||||
rv = principalURI->SchemeIs("https", &formIsHTTPS);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (!formIsHTTPS) {
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1502,7 +1508,9 @@ nsresult HTMLFormElement::GetActionURL(nsIURI** aActionURL,
|
||||
// Potentially the page uses the CSP directive 'upgrade-insecure-requests'. In
|
||||
// such a case we have to upgrade the action url from http:// to https://.
|
||||
// If the actionURL is not http, then there is nothing to do.
|
||||
bool isHttpScheme = actionURL->SchemeIs("http");
|
||||
bool isHttpScheme = false;
|
||||
rv = actionURL->SchemeIs("http", &isHttpScheme);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (isHttpScheme && document->GetUpgradeInsecureRequests(false)) {
|
||||
// let's use the old specification before the upgrade for logging
|
||||
AutoTArray<nsString, 2> params;
|
||||
|
@ -245,7 +245,9 @@ nsresult FSURLEncoded::GetEncodedSubmission(nsIURI* aURI,
|
||||
*aPostDataStream = nullptr;
|
||||
|
||||
if (mMethod == NS_FORM_METHOD_POST) {
|
||||
if (aURI->SchemeIs("mailto")) {
|
||||
bool isMailto = false;
|
||||
aURI->SchemeIs("mailto", &isMailto);
|
||||
if (isMailto) {
|
||||
nsAutoCString path;
|
||||
rv = aURI->GetPathQueryRef(path);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -281,7 +283,10 @@ nsresult FSURLEncoded::GetEncodedSubmission(nsIURI* aURI,
|
||||
|
||||
} else {
|
||||
// Get the full query string
|
||||
if (aURI->SchemeIs("javascript")) {
|
||||
bool schemeIsJavaScript;
|
||||
rv = aURI->SchemeIs("javascript", &schemeIsJavaScript);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (schemeIsJavaScript) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -661,7 +666,9 @@ nsresult FSTextPlain::GetEncodedSubmission(nsIURI* aURI,
|
||||
// XXX HACK We are using the standard URL mechanism to give the body to the
|
||||
// mailer instead of passing the post data stream to it, since that sounds
|
||||
// hard.
|
||||
if (aURI->SchemeIs("mailto")) {
|
||||
bool isMailto = false;
|
||||
aURI->SchemeIs("mailto", &isMailto);
|
||||
if (isMailto) {
|
||||
nsAutoCString path;
|
||||
rv = aURI->GetPathQueryRef(path);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -356,7 +356,8 @@ void nsHTMLDNSPrefetch::nsDeferrals::SubmitQueue() {
|
||||
rv = NS_URIChainHasFlags(hrefURI,
|
||||
nsIProtocolHandler::URI_IS_LOCAL_RESOURCE,
|
||||
&isLocalResource);
|
||||
isHttps = hrefURI->SchemeIs("https");
|
||||
|
||||
hrefURI->SchemeIs("https", &isHttps);
|
||||
}
|
||||
|
||||
if (!hostName.IsEmpty() && NS_SUCCEEDED(rv) && !isLocalResource &&
|
||||
|
@ -476,7 +476,8 @@ nsresult nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
||||
aChannel->GetOriginalURI(getter_AddRefs(uri));
|
||||
// Adapted from nsDocShell:
|
||||
// GetSpec can be expensive for some URIs, so check the scheme first.
|
||||
if (uri && uri->SchemeIs("about")) {
|
||||
bool isAbout = false;
|
||||
if (uri && NS_SUCCEEDED(uri->SchemeIs("about", &isAbout)) && isAbout) {
|
||||
if (uri->GetSpecOrDefault().EqualsLiteral("about:blank")) {
|
||||
loadAsHtml5 = false;
|
||||
}
|
||||
@ -815,7 +816,9 @@ bool nsHTMLDocument::WillIgnoreCharsetOverride() {
|
||||
}
|
||||
nsIURI* uri = GetOriginalURI();
|
||||
if (uri) {
|
||||
if (uri->SchemeIs("about")) {
|
||||
bool schemeIs = false;
|
||||
uri->SchemeIs("about", &schemeIs);
|
||||
if (schemeIs) {
|
||||
return true;
|
||||
}
|
||||
bool isResource;
|
||||
|
@ -330,7 +330,10 @@ nsresult IDBFactory::AllowedForWindowInternal(nsPIDOMWindowInner* aWindow,
|
||||
MOZ_ALWAYS_SUCCEEDS(principal->GetURI(getter_AddRefs(uri)));
|
||||
MOZ_ASSERT(uri);
|
||||
|
||||
if (uri->SchemeIs("about")) {
|
||||
bool isAbout = false;
|
||||
MOZ_ALWAYS_SUCCEEDS(uri->SchemeIs("about", &isAbout));
|
||||
|
||||
if (isAbout) {
|
||||
nsCOMPtr<nsIAboutModule> module;
|
||||
if (NS_SUCCEEDED(NS_GetAboutModule(uri, getter_AddRefs(module)))) {
|
||||
uint32_t flags;
|
||||
|
@ -2860,8 +2860,10 @@ mozilla::ipc::IPCResult ContentParent::RecvGetExternalClipboardFormats(
|
||||
|
||||
mozilla::ipc::IPCResult ContentParent::RecvPlaySound(const URIParams& aURI) {
|
||||
nsCOMPtr<nsIURI> soundURI = DeserializeURI(aURI);
|
||||
bool isChrome = false;
|
||||
// If the check here fails, it can only mean that this message was spoofed.
|
||||
if (!soundURI || !soundURI->SchemeIs("chrome")) {
|
||||
if (!soundURI || NS_FAILED(soundURI->SchemeIs("chrome", &isChrome)) ||
|
||||
!isChrome) {
|
||||
// PlaySound only accepts a valid chrome URI.
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
|
@ -2348,9 +2348,18 @@ RefPtr<MediaManager::StreamPromise> MediaManager::GetUserMedia(
|
||||
isChrome ||
|
||||
Preferences::GetBool("media.navigator.permission.disabled", false);
|
||||
bool isSecure = aWindow->IsSecureContext();
|
||||
// Note: isHTTPS is for legacy telemetry only! Use isSecure for security, as
|
||||
// it handles things like https iframes in http pages correctly.
|
||||
bool isHTTPS = false;
|
||||
bool isHandlingUserInput = EventStateManager::IsHandlingUserInput();
|
||||
docURI->SchemeIs("https", &isHTTPS);
|
||||
nsCString host;
|
||||
nsresult rv = docURI->GetHost(host);
|
||||
// Test for some other schemes that ServiceWorker recognizes
|
||||
bool isFile;
|
||||
docURI->SchemeIs("file", &isFile);
|
||||
bool isApp;
|
||||
docURI->SchemeIs("app", &isApp);
|
||||
|
||||
nsCOMPtr<nsIPrincipal> principal =
|
||||
nsGlobalWindowInner::Cast(aWindow)->GetPrincipal();
|
||||
|
@ -477,10 +477,16 @@ NotificationPermissionRequest::Run() {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
mPrincipal->GetURI(getter_AddRefs(uri));
|
||||
|
||||
if (uri && uri->SchemeIs("file")) {
|
||||
mPermission = NotificationPermission::Granted;
|
||||
} else if (!StaticPrefs::dom_webnotifications_allowinsecure() &&
|
||||
!mWindow->IsSecureContext()) {
|
||||
bool isFile = false;
|
||||
if (uri) {
|
||||
uri->SchemeIs("file", &isFile);
|
||||
if (isFile) {
|
||||
mPermission = NotificationPermission::Granted;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isFile && !StaticPrefs::dom_webnotifications_allowinsecure() &&
|
||||
!mWindow->IsSecureContext()) {
|
||||
mPermission = NotificationPermission::Denied;
|
||||
nsCOMPtr<Document> doc = mWindow->GetExtantDoc();
|
||||
if (doc) {
|
||||
@ -1617,8 +1623,12 @@ NotificationPermission Notification::GetPermissionInternal(
|
||||
// Allow files to show notifications by default.
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
aPrincipal->GetURI(getter_AddRefs(uri));
|
||||
if (uri && uri->SchemeIs("file")) {
|
||||
return NotificationPermission::Granted;
|
||||
if (uri) {
|
||||
bool isFile;
|
||||
uri->SchemeIs("file", &isFile);
|
||||
if (isFile) {
|
||||
return NotificationPermission::Granted;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,10 @@ PerformanceTimingData::PerformanceTimingData(nsITimedChannel* aChannel,
|
||||
}
|
||||
|
||||
if (uri) {
|
||||
mSecureConnection = uri->SchemeIs("https");
|
||||
nsresult rv = uri->SchemeIs("https", &mSecureConnection);
|
||||
if (NS_FAILED(rv)) {
|
||||
mSecureConnection = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (aChannel) {
|
||||
|
@ -965,7 +965,9 @@ bool _evaluate(NPP npp, NPObject* npobj, NPString* script, NPVariant* result) {
|
||||
// chrome code anyways.
|
||||
|
||||
uri = doc->GetDocumentURI();
|
||||
if (uri && uri->SchemeIs("chrome")) {
|
||||
bool isChrome = false;
|
||||
|
||||
if (uri && NS_SUCCEEDED(uri->SchemeIs("chrome", &isChrome)) && isChrome) {
|
||||
uri->GetSpec(specStr);
|
||||
spec = specStr.get();
|
||||
} else {
|
||||
|
@ -198,7 +198,12 @@ bool ScriptLoadRequest::ShouldAcceptBinASTEncoding() const {
|
||||
#ifdef JS_BUILD_BINAST
|
||||
// We accept the BinAST encoding if we're using a secure connection.
|
||||
|
||||
if (!mURI->SchemeIs("https")) {
|
||||
bool isHTTPS = false;
|
||||
nsresult rv = mURI->SchemeIs("https", &isHTTPS);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
Unused << rv;
|
||||
|
||||
if (!isHTTPS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -358,7 +358,9 @@ bool ScriptLoader::IsAboutPageLoadingChromeURI(ScriptLoadRequest* aRequest) {
|
||||
aRequest->TriggeringPrincipal()->GetURI(getter_AddRefs(triggeringURI));
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
if (!triggeringURI->SchemeIs("about")) {
|
||||
bool isAbout =
|
||||
(NS_SUCCEEDED(triggeringURI->SchemeIs("about", &isAbout)) && isAbout);
|
||||
if (!isAbout) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -376,7 +378,9 @@ bool ScriptLoader::IsAboutPageLoadingChromeURI(ScriptLoadRequest* aRequest) {
|
||||
}
|
||||
|
||||
// if the uri to be loaded is not of scheme chrome:, there is nothing to do.
|
||||
if (!aRequest->mURI->SchemeIs("chrome")) {
|
||||
bool isChrome =
|
||||
(NS_SUCCEEDED(aRequest->mURI->SchemeIs("chrome", &isChrome)) && isChrome);
|
||||
if (!isChrome) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -3525,8 +3529,22 @@ uint32_t ScriptLoader::NumberOfProcessors() {
|
||||
}
|
||||
|
||||
static bool IsInternalURIScheme(nsIURI* uri) {
|
||||
return uri->SchemeIs("moz-extension") || uri->SchemeIs("resource") ||
|
||||
uri->SchemeIs("chrome");
|
||||
bool isWebExt;
|
||||
if (NS_SUCCEEDED(uri->SchemeIs("moz-extension", &isWebExt)) && isWebExt) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isResource;
|
||||
if (NS_SUCCEEDED(uri->SchemeIs("resource", &isResource)) && isResource) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isChrome;
|
||||
if (NS_SUCCEEDED(uri->SchemeIs("chrome", &isChrome)) && isChrome) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
nsresult ScriptLoader::PrepareLoadedRequest(ScriptLoadRequest* aRequest,
|
||||
|
@ -69,8 +69,10 @@ nsresult ServiceWorkerScopeAndScriptAreValid(const ClientInfo& aClientInfo,
|
||||
nsCOMPtr<nsIPrincipal> principal = aClientInfo.GetPrincipal();
|
||||
NS_ENSURE_TRUE(principal, NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
|
||||
bool isHttp = aScriptURI->SchemeIs("http");
|
||||
bool isHttps = aScriptURI->SchemeIs("https");
|
||||
bool isHttp = false;
|
||||
bool isHttps = false;
|
||||
Unused << aScriptURI->SchemeIs("http", &isHttp);
|
||||
Unused << aScriptURI->SchemeIs("https", &isHttps);
|
||||
NS_ENSURE_TRUE(isHttp || isHttps, NS_ERROR_DOM_SECURITY_ERR);
|
||||
|
||||
nsresult rv = CheckForSlashEscapedCharsInPath(aScopeURI);
|
||||
|
@ -32,7 +32,8 @@ nsresult GenerateOriginKey(nsIPrincipal* aPrincipal,
|
||||
|
||||
if (domainOrigin.IsEmpty()) {
|
||||
// For the file:/// protocol use the exact directory as domain.
|
||||
if (uri->SchemeIs("file")) {
|
||||
bool isScheme = false;
|
||||
if (NS_SUCCEEDED(uri->SchemeIs("file", &isScheme)) && isScheme) {
|
||||
nsCOMPtr<nsIURL> url = do_QueryInterface(uri, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = url->GetDirectory(domainOrigin);
|
||||
|
@ -115,7 +115,11 @@ URLSearchParams* URL::SearchParams() {
|
||||
return mSearchParams;
|
||||
}
|
||||
|
||||
bool IsChromeURI(nsIURI* aURI) { return aURI->SchemeIs("chrome"); }
|
||||
bool IsChromeURI(nsIURI* aURI) {
|
||||
bool isChrome = false;
|
||||
if (NS_SUCCEEDED(aURI->SchemeIs("chrome", &isChrome))) return isChrome;
|
||||
return false;
|
||||
}
|
||||
|
||||
void URL::CreateSearchParamsIfNeeded() {
|
||||
if (!mSearchParams) {
|
||||
|
@ -32,7 +32,8 @@ bool EvaluateAppID(nsPIDOMWindowInner* aParent, const nsString& aOrigin,
|
||||
}
|
||||
|
||||
// If the facetId (origin) is not HTTPS, reject
|
||||
if (!facetUri->SchemeIs("https")) {
|
||||
bool facetIsHttps = false;
|
||||
if (NS_FAILED(facetUri->SchemeIs("https", &facetIsHttps)) || !facetIsHttps) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -50,7 +51,8 @@ bool EvaluateAppID(nsPIDOMWindowInner* aParent, const nsString& aOrigin,
|
||||
}
|
||||
|
||||
// if the appId URL is not HTTPS, reject.
|
||||
if (!appIdUri->SchemeIs("https")) {
|
||||
bool appIdIsHttps = false;
|
||||
if (NS_FAILED(appIdUri->SchemeIs("https", &appIdIsHttps)) || !appIdIsHttps) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1647,8 +1647,14 @@ nsresult WebSocketImpl::Init(JSContext* aCx, nsIPrincipal* aLoadingPrincipal,
|
||||
aLoadingPrincipal->GetURI(getter_AddRefs(originURI));
|
||||
}
|
||||
|
||||
if (originURI && originURI->SchemeIs("https")) {
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
if (originURI) {
|
||||
bool originIsHttps = false;
|
||||
rv = originURI->SchemeIs("https", &originIsHttps);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (originIsHttps) {
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,10 @@ nsresult ChannelFromScriptURL(
|
||||
principal, uri, true /* aInheritForAboutBlank */,
|
||||
false /* aForceInherit */);
|
||||
|
||||
bool isData = uri->SchemeIs("data");
|
||||
bool isData = false;
|
||||
rv = uri->SchemeIs("data", &isData);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool isURIUniqueOrigin =
|
||||
net::nsIOService::IsDataURIUniqueOpaqueOrigin() && isData;
|
||||
if (inheritAttrs && !isURIUniqueOrigin) {
|
||||
|
@ -345,7 +345,12 @@ bool nsXBLContentSink::OnOpenContainer(const char16_t** aAtts,
|
||||
|
||||
nsIURI* uri = mDocument->GetDocumentURI();
|
||||
|
||||
mIsChromeOrResource = uri->SchemeIs("chrome") || uri->SchemeIs("resource");
|
||||
bool isChrome = false;
|
||||
bool isRes = false;
|
||||
|
||||
uri->SchemeIs("chrome", &isChrome);
|
||||
uri->SchemeIs("resource", &isRes);
|
||||
mIsChromeOrResource = isChrome || isRes;
|
||||
|
||||
mState = eXBL_InBindings;
|
||||
} else if (aTagName == nsGkAtoms::binding) {
|
||||
|
@ -341,7 +341,12 @@ nsXBLService::~nsXBLService(void) {}
|
||||
|
||||
// static
|
||||
bool nsXBLService::IsChromeOrResourceURI(nsIURI* aURI) {
|
||||
return aURI->SchemeIs("chrome") || aURI->SchemeIs("resource");
|
||||
bool isChrome = false;
|
||||
bool isResource = false;
|
||||
if (NS_SUCCEEDED(aURI->SchemeIs("chrome", &isChrome)) &&
|
||||
NS_SUCCEEDED(aURI->SchemeIs("resource", &isResource)))
|
||||
return (isChrome || isResource);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Servo avoids wasting work styling subtrees of elements with XBL bindings by
|
||||
@ -423,7 +428,8 @@ static bool IsSystemOrChromeURLPrincipal(nsIPrincipal* aPrincipal) {
|
||||
aPrincipal->GetURI(getter_AddRefs(uri));
|
||||
NS_ENSURE_TRUE(uri, false);
|
||||
|
||||
return uri->SchemeIs("chrome");
|
||||
bool isChrome = false;
|
||||
return NS_SUCCEEDED(uri->SchemeIs("chrome", &isChrome)) && isChrome;
|
||||
}
|
||||
|
||||
// This function loads a particular XBL file and installs all of the bindings
|
||||
@ -677,7 +683,10 @@ static bool MayBindToContent(nsXBLPrototypeBinding* aProtoBinding,
|
||||
// they end up with a null principal (rather than inheriting the document's
|
||||
// principal), which causes them to fail the check above.
|
||||
if (nsContentUtils::AllowXULXBLForPrincipal(aBoundElement->NodePrincipal())) {
|
||||
if (aURI->SchemeIs("data")) {
|
||||
bool isDataURI = false;
|
||||
nsresult rv = aURI->SchemeIs("data", &isDataURI);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
if (isDataURI) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -904,9 +913,9 @@ nsresult nsXBLService::LoadBindingDocumentInfo(nsIContent* aBoundElement,
|
||||
// document.
|
||||
|
||||
// Always load chrome synchronously
|
||||
if (documentURI->SchemeIs("chrome")) {
|
||||
bool chrome;
|
||||
if (NS_SUCCEEDED(documentURI->SchemeIs("chrome", &chrome)) && chrome)
|
||||
aForceSyncLoad = true;
|
||||
}
|
||||
|
||||
nsCOMPtr<Document> document;
|
||||
rv = FetchBindingDocument(aBoundElement, aBoundDocument, documentURI,
|
||||
|
@ -1087,8 +1087,9 @@ void XMLHttpRequestMainThread::GetAllResponseHeaders(
|
||||
|
||||
// Don't provide Content-Length for data URIs
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
bool isDataURI;
|
||||
if (NS_FAILED(mChannel->GetURI(getter_AddRefs(uri))) ||
|
||||
!uri->SchemeIs("data")) {
|
||||
NS_FAILED(uri->SchemeIs("data", &isDataURI)) || !isDataURI) {
|
||||
int64_t length;
|
||||
if (NS_SUCCEEDED(mChannel->GetContentLength(&length))) {
|
||||
aResponseHeaders.AppendLiteral("Content-Length: ");
|
||||
|
@ -317,7 +317,8 @@ bool XMLDocument::Load(const nsAString& aUrl, CallerType aCallerType,
|
||||
// We're called from chrome, check to make sure the URI we're
|
||||
// about to load is also chrome.
|
||||
|
||||
if (!uri->SchemeIs("chrome")) {
|
||||
bool isChrome = false;
|
||||
if (NS_FAILED(uri->SchemeIs("chrome", &isChrome)) || !isChrome) {
|
||||
nsAutoString error;
|
||||
error.AssignLiteral(
|
||||
"Cross site loading using document.load is no "
|
||||
|
@ -249,7 +249,8 @@ txStylesheetSink::OnStartRequest(nsIRequest* aRequest) {
|
||||
// sniffing themselves.
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
channel->GetURI(getter_AddRefs(uri));
|
||||
if (uri->SchemeIs("file") &&
|
||||
bool sniff;
|
||||
if (NS_SUCCEEDED(uri->SchemeIs("file", &sniff)) && sniff &&
|
||||
contentType.EqualsLiteral(UNKNOWN_CONTENT_TYPE)) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIStreamConverterService> serv =
|
||||
|
@ -1901,9 +1901,12 @@ nsresult nsXULPrototypeScript::Serialize(
|
||||
|
||||
nsresult nsXULPrototypeScript::SerializeOutOfLine(
|
||||
nsIObjectOutputStream* aStream, nsXULPrototypeDocument* aProtoDoc) {
|
||||
if (!mSrcURI->SchemeIs("chrome"))
|
||||
nsresult rv = NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
bool isChrome = false;
|
||||
if (NS_FAILED(mSrcURI->SchemeIs("chrome", &isChrome)) || !isChrome)
|
||||
// Don't cache scripts that don't come from chrome uris.
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return rv;
|
||||
|
||||
nsXULPrototypeCache* cache = nsXULPrototypeCache::GetInstance();
|
||||
if (!cache) return NS_ERROR_OUT_OF_MEMORY;
|
||||
@ -1921,7 +1924,7 @@ nsresult nsXULPrototypeScript::SerializeOutOfLine(
|
||||
if (exists) return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIObjectOutputStream> oos;
|
||||
nsresult rv = cache->GetOutputStream(mSrcURI, getter_AddRefs(oos));
|
||||
rv = cache->GetOutputStream(mSrcURI, getter_AddRefs(oos));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsresult tmp = Serialize(oos, aProtoDoc, nullptr);
|
||||
@ -2011,9 +2014,13 @@ nsresult nsXULPrototypeScript::DeserializeOutOfLine(
|
||||
rv = Deserialize(objectInput, aProtoDoc, nullptr, nullptr);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (useXULCache && mSrcURI && mSrcURI->SchemeIs("chrome")) {
|
||||
JS::Rooted<JSScript*> script(RootingCx(), GetScriptObject());
|
||||
cache->PutScript(mSrcURI, script);
|
||||
if (useXULCache && mSrcURI) {
|
||||
bool isChrome = false;
|
||||
mSrcURI->SchemeIs("chrome", &isChrome);
|
||||
if (isChrome) {
|
||||
JS::Rooted<JSScript*> script(RootingCx(), GetScriptObject());
|
||||
cache->PutScript(mSrcURI, script);
|
||||
}
|
||||
}
|
||||
cache->FinishInputStream(mSrcURI);
|
||||
} else {
|
||||
|
@ -220,7 +220,10 @@ int32_t CookiesBehavior(nsILoadInfo* aLoadInfo,
|
||||
|
||||
// WebExtensions 3rd party URI always get BEHAVIOR_ACCEPT as cookieBehavior,
|
||||
// this is semantically equivalent to the principal having a AddonPolicy().
|
||||
if (a3rdPartyURI->SchemeIs("moz-extension")) {
|
||||
bool is3rdPartyMozExt = false;
|
||||
if (NS_SUCCEEDED(
|
||||
a3rdPartyURI->SchemeIs("moz-extension", &is3rdPartyMozExt)) &&
|
||||
is3rdPartyMozExt) {
|
||||
return nsICookieService::BEHAVIOR_ACCEPT;
|
||||
}
|
||||
|
||||
|
@ -138,8 +138,12 @@ static StorageAccess InternalStorageAllowedCheck(
|
||||
if (!uri) {
|
||||
Unused << aPrincipal->GetURI(getter_AddRefs(uri));
|
||||
}
|
||||
if (uri && uri->SchemeIs("about")) {
|
||||
return access;
|
||||
if (uri) {
|
||||
bool isAbout = false;
|
||||
MOZ_ALWAYS_SUCCEEDS(uri->SchemeIs("about", &isAbout));
|
||||
if (isAbout) {
|
||||
return access;
|
||||
}
|
||||
}
|
||||
|
||||
if (!StorageDisabledByAntiTracking(aWindow, aChannel, aPrincipal, aURI,
|
||||
|
@ -1919,7 +1919,10 @@ nsNavBookmarks::OnPageChanged(nsIURI* aURI, uint32_t aChangedAttribute,
|
||||
changeData.bookmark.type = TYPE_BOOKMARK;
|
||||
|
||||
// Favicons may be set to either pure URIs or to folder URIs
|
||||
if (aURI->SchemeIs("place")) {
|
||||
bool isPlaceURI;
|
||||
rv = aURI->SchemeIs("place", &isPlaceURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (isPlaceURI) {
|
||||
nsNavHistory* history = nsNavHistory::GetHistoryService();
|
||||
NS_ENSURE_TRUE(history, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
|
@ -178,7 +178,8 @@ nsresult nsUrlClassifierStreamUpdater::FetchUpdate(
|
||||
// purposes.
|
||||
// This is only used for testing and should be deleted.
|
||||
bool match;
|
||||
if (aUpdateUrl->SchemeIs("file") || aUpdateUrl->SchemeIs("data")) {
|
||||
if ((NS_SUCCEEDED(aUpdateUrl->SchemeIs("file", &match)) && match) ||
|
||||
(NS_SUCCEEDED(aUpdateUrl->SchemeIs("data", &match)) && match)) {
|
||||
mChannel->SetContentType(
|
||||
NS_LITERAL_CSTRING("application/vnd.google.safebrowsing-update"));
|
||||
} else {
|
||||
|
@ -617,7 +617,7 @@ nsresult nsWindowWatcher::OpenWindowInternal(
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
uriToLoadIsChrome = uriToLoad->SchemeIs("chrome");
|
||||
uriToLoad->SchemeIs("chrome", &uriToLoadIsChrome);
|
||||
}
|
||||
|
||||
bool nameSpecified = false;
|
||||
|
@ -112,8 +112,10 @@ AddonContentPolicy::ShouldLoad(nsIURI* aContentLocation, nsILoadInfo* aLoadInfo,
|
||||
// Only apply this policy to requests from documents loaded from
|
||||
// moz-extension URLs, or to resources being loaded from moz-extension URLs.
|
||||
bool equals;
|
||||
if (!(aContentLocation->SchemeIs("moz-extension") ||
|
||||
requestOrigin->SchemeIs("moz-extension"))) {
|
||||
if (!((NS_SUCCEEDED(aContentLocation->SchemeIs("moz-extension", &equals)) &&
|
||||
equals) ||
|
||||
(NS_SUCCEEDED(requestOrigin->SchemeIs("moz-extension", &equals)) &&
|
||||
equals))) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,9 @@ bool AddonManagerWebAPI::IsValidSite(nsIURI* uri) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!uri->SchemeIs("https")) {
|
||||
bool isSecure;
|
||||
nsresult rv = uri->SchemeIs("https", &isSecure);
|
||||
if (NS_FAILED(rv) || !isSecure) {
|
||||
if (!(xpc::IsInAutomation() &&
|
||||
Preferences::GetBool("extensions.webapi.testing.http", false))) {
|
||||
return false;
|
||||
|
@ -175,7 +175,10 @@ static nsresult GetProxyFromEnvironment(const nsACString& aScheme,
|
||||
|
||||
// Is there a way to specify "socks://" or something in these environment
|
||||
// variables? I can't find any documentation.
|
||||
if (!proxyURI->SchemeIs("http")) return NS_ERROR_UNKNOWN_PROTOCOL;
|
||||
bool isHTTP;
|
||||
rv = proxyURI->SchemeIs("http", &isHTTP);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!isHTTP) return NS_ERROR_UNKNOWN_PROTOCOL;
|
||||
|
||||
nsAutoCString proxyHost;
|
||||
rv = proxyURI->GetHost(proxyHost);
|
||||
|
@ -1001,11 +1001,16 @@ nsXULAppInfo::GetServerURL(nsIURL** aServerURL) {
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAppInfo::SetServerURL(nsIURL* aServerURL) {
|
||||
// Only allow https or http URLs
|
||||
if (!aServerURL->SchemeIs("http") && !aServerURL->SchemeIs("https")) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
bool schemeOk;
|
||||
// only allow https or http URLs
|
||||
nsresult rv = aServerURL->SchemeIs("https", &schemeOk);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!schemeOk) {
|
||||
rv = aServerURL->SchemeIs("http", &schemeOk);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!schemeOk) return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
nsAutoCString spec;
|
||||
rv = aServerURL->GetSpec(spec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
Loading…
Reference in New Issue
Block a user