diff --git a/browser/base/content/aboutNetError.xhtml b/browser/base/content/aboutNetError.xhtml index ddc60924ce..662b284acb 100644 --- a/browser/base/content/aboutNetError.xhtml +++ b/browser/base/content/aboutNetError.xhtml @@ -273,6 +273,7 @@

&generic.title;

&dnsNotFound.title;

&fileNotFound.title;

+

&fileAccessDenied.title;

&malformedURI.title;

&unknownProtocolFound.title;

&connectionFailure.title;

@@ -296,11 +297,13 @@

&cspBlocked.title;

&remoteXUL.title;

&corruptedContentError.title;

+

&inadequateSecurityError.title;

&generic.longDesc;
&dnsNotFound.longDesc;
&fileNotFound.longDesc;
+
&fileAccessDenied.longDesc;
&malformedURI.longDesc;
&unknownProtocolFound.longDesc;
&connectionFailure.longDesc;
@@ -324,6 +327,7 @@
&cspBlocked.longDesc;
&remoteXUL.longDesc;
&corruptedContentError.longDesc;
+
&inadequateSecurityError.longDesc;
diff --git a/browser/components/contextualidentity/test/browser/browser.ini b/browser/components/contextualidentity/test/browser/browser.ini index 58611df0ad..22013f6804 100644 --- a/browser/components/contextualidentity/test/browser/browser.ini +++ b/browser/components/contextualidentity/test/browser/browser.ini @@ -1,7 +1,9 @@ [DEFAULT] skip-if = buildapp == "mulet" support-files = + empty_file.html file_reflect_cookie_into_title.html [browser_usercontext.js] skip-if = e10s +[browser_windowName.js] diff --git a/browser/components/contextualidentity/test/browser/browser_windowName.js b/browser/components/contextualidentity/test/browser/browser_windowName.js new file mode 100644 index 0000000000..d8e698a6a3 --- /dev/null +++ b/browser/components/contextualidentity/test/browser/browser_windowName.js @@ -0,0 +1,79 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + + +const USER_CONTEXTS = [ + "default", + "personal", + "work", +]; + +const BASE_URI = "http://mochi.test:8888/browser/browser/components/" + + "contextualidentity/test/browser/empty_file.html"; + +add_task(function* setup() { + // make sure userContext is enabled. + SpecialPowers.pushPrefEnv({"set": [ + ["privacy.userContext.enabled", true], + ["browser.link.open_newwindow", 3], + ]}); +}); + +add_task(function* cleanup() { + // make sure we don't leave any prefs set for the next tests + registerCleanupFunction(function() { + SpecialPowers.popPrefEnv(); + }); +}); + +add_task(function* test() { + info("Creating first tab..."); + let tab1 = gBrowser.addTab(BASE_URI + '?old', {userContextId: 1}); + let browser1 = gBrowser.getBrowserForTab(tab1); + yield BrowserTestUtils.browserLoaded(browser1); + yield ContentTask.spawn(browser1, null, function(opts) { + content.window.name = 'tab-1'; + }); + + info("Creating second tab..."); + let tab2 = gBrowser.addTab(BASE_URI + '?old', {userContextId: 2}); + let browser2 = gBrowser.getBrowserForTab(tab2); + yield BrowserTestUtils.browserLoaded(browser2); + yield ContentTask.spawn(browser2, null, function(opts) { + content.window.name = 'tab-2'; + }); + + // Let's try to open a window from tab1 with a name 'tab-2'. + info("Opening a window from the first tab..."); + yield ContentTask.spawn(browser1, { url: BASE_URI + '?new' }, function(opts) { + yield new content.window.wrappedJSObject.Promise(resolve => { + let w = content.window.wrappedJSObject.open(opts.url, 'tab-2'); + w.onload = function() { resolve(); } + }); + }); + + is(browser1.contentDocument.title, '?old', "Tab1 title must be 'old'"); + is(browser1.contentDocument.nodePrincipal.userContextId, 1, "Tab1 UCI must be 1"); + + is(browser2.contentDocument.title, '?old', "Tab2 title must be 'old'"); + is(browser2.contentDocument.nodePrincipal.userContextId, 2, "Tab2 UCI must be 2"); + + let found = false; + for (let i = 0; i < gBrowser.tabContainer.childNodes.length; ++i) { + let tab = gBrowser.tabContainer.childNodes[i]; + let browser = gBrowser.getBrowserForTab(tab); + if (browser.contentDocument.title == '?new') { + is(browser.contentDocument.nodePrincipal.userContextId, 1, "Tab3 UCI must be 1"); + isnot(browser, browser1, "Tab3 is not browser 1"); + isnot(browser, browser2, "Tab3 is not browser 2"); + gBrowser.removeTab(tab); + found = true; + break; + } + } + + ok(found, "We have tab3"); + + gBrowser.removeTab(tab1); + gBrowser.removeTab(tab2); +}); diff --git a/browser/components/contextualidentity/test/browser/empty_file.html b/browser/components/contextualidentity/test/browser/empty_file.html new file mode 100644 index 0000000000..c6d11dcd57 --- /dev/null +++ b/browser/components/contextualidentity/test/browser/empty_file.html @@ -0,0 +1,5 @@ + + + diff --git a/browser/locales/en-US/chrome/overrides/appstrings.properties b/browser/locales/en-US/chrome/overrides/appstrings.properties index 1d0a6a036b..7d8936a84e 100644 --- a/browser/locales/en-US/chrome/overrides/appstrings.properties +++ b/browser/locales/en-US/chrome/overrides/appstrings.properties @@ -4,6 +4,7 @@ malformedURI=The URL is not valid and cannot be loaded. fileNotFound=Pale Moon can't find the file at %S. +fileAccessDenied=The file at %S is not readable. dnsNotFound=Pale Moon can't find the server at %S. unknownProtocolFound=Pale Moon doesn't know how to open this address, because the protocol (%S) isn't associated with any program. connectionFailure=Pale Moon can't establish a connection to the server at %S. @@ -39,3 +40,6 @@ corruptedContentError=The page you are trying to view cannot be shown because an remoteXUL=This page uses an unsupported technology that is no longer available by default in Pale Moon. ## LOCALIZATION NOTE (sslv3Used) - Do not translate "%S". sslv3Used=Pale Moon cannot guarantee the safety of your data on %S because it uses SSLv3, a broken security protocol. +## LOCALIZATION NOTE (weakCryptoUsed) - Do not translate "%S". +weakCryptoUsed=The owner of %S has configured their website improperly. To protect your information from being stolen, Pale Moon has not connected to this website. +inadequateSecurityError=The website tried to negotiate an inadequate level of security. diff --git a/browser/locales/en-US/chrome/overrides/netError.dtd b/browser/locales/en-US/chrome/overrides/netError.dtd index 6d25902b04..83fe725712 100644 --- a/browser/locales/en-US/chrome/overrides/netError.dtd +++ b/browser/locales/en-US/chrome/overrides/netError.dtd @@ -37,6 +37,12 @@ "> + + +
  • It may have been removed, moved, or file permissions may be preventing access.
  • + +"> "ssl_error_unsupported_version". --> + + + + + + uses security technology that is outdated and vulnerable to attack. An attacker could easily reveal information which you thought to be safe. The website administrator will need to fix the server first before you can visit the site.

    Error code: NS_ERROR_NET_INADEQUATE_SECURITY

    "> diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index a4dcf3ade5..34f394d937 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -522,8 +522,9 @@ SendPing(void* aClosure, nsIContent* aContent, nsIURI* aURI, return; } - // Don't bother caching the result of this URI load. - chan->SetLoadFlags(nsIRequest::INHIBIT_CACHING); + // Don't bother caching the result of this URI load, but do not exempt + // it from Safe Browsing. + chan->SetLoadFlags(nsIRequest::INHIBIT_CACHING | nsIChannel::LOAD_CLASSIFY_URI); nsCOMPtr httpChan = do_QueryInterface(chan); if (!httpChan) { @@ -1510,8 +1511,7 @@ nsDocShell::LoadURI(nsIURI* aURI, } // Don't inherit from the current page. Just do the safe thing // and pretend that we were loaded by a nullprincipal. - owner = do_CreateInstance("@mozilla.org/nullprincipal;1"); - NS_ENSURE_TRUE(owner, NS_ERROR_FAILURE); + owner = nsNullPrincipal::Create(); inheritOwner = false; } } @@ -3475,6 +3475,11 @@ nsDocShell::CanAccessItem(nsIDocShellTreeItem* aTargetItem, return false; } + if (static_cast(targetDS.get())->GetOriginAttributes() != + static_cast(accessingDS.get())->GetOriginAttributes()) { + return false; + } + // A private document can't access a non-private one, and vice versa. if (static_cast(targetDS.get())->UsePrivateBrowsing() != static_cast(accessingDS.get())->UsePrivateBrowsing()) { @@ -4788,6 +4793,9 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI, } else if (NS_ERROR_FILE_NOT_FOUND == aError) { NS_ENSURE_ARG_POINTER(aURI); error.AssignLiteral("fileNotFound"); + } else if (NS_ERROR_FILE_ACCESS_DENIED == aError) { + NS_ENSURE_ARG_POINTER(aURI); + error.AssignLiteral("fileAccessDenied"); } else if (NS_ERROR_UNKNOWN_HOST == aError) { NS_ENSURE_ARG_POINTER(aURI); // Get the host @@ -5034,6 +5042,11 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI, // ServiceWorker intercepted request, but something went wrong. error.AssignLiteral("corruptedContentError"); break; + case NS_ERROR_NET_INADEQUATE_SECURITY: + // Server negotiated bad TLS for HTTP/2. + error.AssignLiteral("inadequateSecurityError"); + addHostPort = true; + break; default: break; } @@ -7563,6 +7576,7 @@ nsDocShell::EndPageLoad(nsIWebProgress* aProgress, // if (url && NS_FAILED(aStatus)) { if (aStatus == NS_ERROR_FILE_NOT_FOUND || + aStatus == NS_ERROR_FILE_ACCESS_DENIED || aStatus == NS_ERROR_CORRUPTED_CONTENT || aStatus == NS_ERROR_INVALID_CONTENT_ENCODING) { DisplayLoadError(aStatus, url, nullptr, aChannel); @@ -7787,6 +7801,7 @@ nsDocShell::EndPageLoad(nsIWebProgress* aProgress, aStatus == NS_ERROR_UNSAFE_CONTENT_TYPE || aStatus == NS_ERROR_REMOTE_XUL || aStatus == NS_ERROR_INTERCEPTION_FAILED || + aStatus == NS_ERROR_NET_INADEQUATE_SECURITY || NS_ERROR_GET_MODULE(aStatus) == NS_ERROR_MODULE_SECURITY) { // Errors to be shown for any frame DisplayLoadError(aStatus, url, nullptr, aChannel); @@ -9647,6 +9662,11 @@ nsDocShell::InternalLoad2(nsIURI* aURI, NS_ENSURE_TRUE(!mIsBeingDestroyed, NS_ERROR_NOT_AVAILABLE); + rv = EnsureScriptEnvironment(); + if (NS_FAILED(rv)) { + return rv; + } + // wyciwyg urls can only be loaded through history. Any normal load of // wyciwyg through docshell is illegal. Disallow such loads. if (aLoadType & LOAD_CMD_NORMAL) { @@ -9662,15 +9682,11 @@ nsDocShell::InternalLoad2(nsIURI* aURI, isJavaScript = false; } - // // First, notify any nsIContentPolicy listeners about the document load. // Only abort the load if a content policy listener explicitly vetos it! - // - nsCOMPtr requestingElement; // Use nsPIDOMWindow since we _want_ to cross the chrome boundary if needed - if (mScriptGlobal) { - requestingElement = mScriptGlobal->GetFrameElementInternal(); - } + nsCOMPtr requestingElement = + mScriptGlobal->GetFrameElementInternal(); RefPtr MMADeathGrip = mScriptGlobal; @@ -9832,8 +9848,6 @@ nsDocShell::InternalLoad2(nsIURI* aURI, if (aURI) { aURI->GetSpec(spec); } - // RM 2018-12-03 We miss all loadInfo setting up here - // so we cannot set aIsFromProcessingFrameAttributes rv = win->OpenNoNavigate(NS_ConvertUTF8toUTF16(spec), name, // window name EmptyString(), // Features @@ -10590,10 +10604,16 @@ nsDocShell::DoURILoad(nsIURI* aURI, nsIURI* aBaseURI, nsContentPolicyType aContentPolicyType) { - nsresult rv; - nsCOMPtr uriLoader; + // Double-check that we're still around to load this URI. + if (mIsBeingDestroyed) { + // Return NS_OK despite not doing anything to avoid throwing exceptions from + // nsLocation::SetHref if the unload handler of the existing page tears us + // down. + return NS_OK; + } - uriLoader = do_GetService(NS_URI_LOADER_CONTRACTID, &rv); + nsresult rv; + nsCOMPtr uriLoader = do_GetService(NS_URI_LOADER_CONTRACTID, &rv); if (NS_FAILED(rv)) { return rv; } @@ -10635,10 +10655,7 @@ nsDocShell::DoURILoad(nsIURI* aURI, bool isSrcdoc = !aSrcdoc.IsVoid(); - // There are three cases we care about: - // * Null mScriptGlobal: shouldn't happen but does (see bug 1240246). In this - // case, we create a loadingPrincipal as for a top-level load, but we leave - // requestingNode and requestingWindow null. + // There are two cases we care about: // * Top-level load (GetFrameElementInternal returns null). In this case, // requestingNode is null, but requestingWindow is our mScriptGlobal. // TODO we want to pass null for loadingPrincipal in this case. @@ -10649,18 +10666,20 @@ nsDocShell::DoURILoad(nsIURI* aURI, nsCOMPtr requestingWindow; nsCOMPtr loadingPrincipal; - if (mScriptGlobal) { - requestingNode = mScriptGlobal->GetFrameElementInternal(); - if (requestingNode) { - // If we have a requesting node, then use that as our loadingPrincipal. - loadingPrincipal = requestingNode->NodePrincipal(); - } else { - MOZ_ASSERT(aContentPolicyType == nsIContentPolicy::TYPE_DOCUMENT); - requestingWindow = mScriptGlobal; + requestingNode = mScriptGlobal->GetFrameElementInternal(); + if (requestingNode) { + // If we have a requesting node, then use that as our loadingPrincipal. + loadingPrincipal = requestingNode->NodePrincipal(); + } else { + if (aContentPolicyType != nsIContentPolicy::TYPE_DOCUMENT) { + // If this isn't a top-level load and mScriptGlobal's frame element is + // null, then the element got removed from the DOM while we were trying to + // load this resource. This docshell is scheduled for destruction already, + // so bail out here. + return NS_OK; } - } - if (!loadingPrincipal) { + requestingWindow = mScriptGlobal; if (mItemType != typeChrome) { nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager(); ssm->GetDocShellCodebasePrincipal(aURI, this, getter_AddRefs(loadingPrincipal)); diff --git a/docshell/resources/content/netError.xhtml b/docshell/resources/content/netError.xhtml index 922dadb790..11187626de 100644 --- a/docshell/resources/content/netError.xhtml +++ b/docshell/resources/content/netError.xhtml @@ -97,7 +97,7 @@ function initPage() { var err = getErrorCode(); - + // if it's an unknown error or there's no title or description // defined, get the generic message var errTitle = document.getElementById("et_" + err); @@ -141,7 +141,7 @@ // Also, if they specified a CSS class, they must supply their own // favicon. In order to trigger the browser to repaint though, we - // need to remove/add the link element. + // need to remove/add the link element. var favicon = document.getElementById("favicon"); var faviconParent = favicon.parentNode; faviconParent.removeChild(favicon); @@ -177,14 +177,25 @@ var secOverride = document.getElementById("securityOverrideDiv"); secOverride.parentNode.removeChild(secOverride); } + + if (err == "inadequateSecurityError") { + // Remove the "Try again" button for HTTP/2 inadequate security as it + // is useless. + document.getElementById("errorTryAgain").style.display = "none"; + + var container = document.getElementById("errorLongDesc"); + for (var span of container.querySelectorAll("span.hostname")) { + span.textContent = document.location.hostname; + } + } } - + function showSecuritySection() { // Swap link out, content in document.getElementById('securityOverrideContent').style.display = ''; document.getElementById('securityOverrideLink').style.display = 'none'; } - + /* In the case of SSL error pages about domain mismatch, see if we can hyperlink the user to the correct site. We don't want to do this generically since it allows MitM attacks to redirect @@ -196,29 +207,29 @@ var sd = document.getElementById("errorShortDescText"); if (sd) { var desc = getDescription(); - + // sanitize description text - see bug 441169 - + // First, find the index of the tag we care about, being careful not to // use an over-greedy regex var re = //; var result = re.exec(desc); if(!result) return; - + // Remove sd's existing children sd.textContent = ""; // Everything up to the link should be text content sd.appendChild(document.createTextNode(desc.slice(0, result.index))); - + // Now create the link itself var anchorEl = document.createElement("a"); anchorEl.setAttribute("id", "cert_domain_link"); anchorEl.setAttribute("title", result[1]); anchorEl.appendChild(document.createTextNode(result[1])); sd.appendChild(anchorEl); - + // Finally, append text for anything after the closing sd.appendChild(document.createTextNode(desc.slice(desc.indexOf("") + "".length))); } @@ -226,7 +237,7 @@ var link = document.getElementById('cert_domain_link'); if (!link) return; - + var okHost = link.getAttribute("title"); var thisHost = document.location.hostname; var proto = document.location.protocol; @@ -236,7 +247,7 @@ // get anyone anywhere useful. bug 432491 okHost = okHost.replace(/^\*\./, "www."); - /* case #1: + /* case #1: * example.com uses an invalid security certificate. * * The certificate is only valid for www.example.com @@ -260,7 +271,7 @@ if (endsWith(thisHost, "." + okHost)) link.href = proto + okHost; } - + function endsWith(haystack, needle) { return haystack.slice(-needle.length) == needle; } @@ -276,6 +287,7 @@

    &generic.title;

    &dnsNotFound.title;

    &fileNotFound.title;

    +

    &fileAccessDenied.title;

    &malformedURI.title;

    &unknownProtocolFound.title;

    &connectionFailure.title;

    @@ -299,11 +311,13 @@

    &cspBlocked.title;

    &remoteXUL.title;

    &corruptedContentError.title;

    +

    &inadequateSecurityError.title;

    &generic.longDesc;
    &dnsNotFound.longDesc;
    &fileNotFound.longDesc;
    +
    &fileAccessDenied.longDesc;
    &malformedURI.longDesc;
    &unknownProtocolFound.longDesc;
    &connectionFailure.longDesc;
    @@ -327,20 +341,21 @@
    &cspBlocked.longDesc;
    &remoteXUL.longDesc;
    &corruptedContentError.longDesc;
    +
    &inadequateSecurityError.longDesc;
    - +

    - +
    - +

    diff --git a/dom/base/test/unit/test_thirdpartyutil.js b/dom/base/test/unit/test_thirdpartyutil.js index 6cf2769535..1a41c909f1 100644 --- a/dom/base/test/unit/test_thirdpartyutil.js +++ b/dom/base/test/unit/test_thirdpartyutil.js @@ -41,8 +41,9 @@ function run_test() { let spec2 = "http://bar.com/bar.html"; let uri1 = NetUtil.newURI(spec1); let uri2 = NetUtil.newURI(spec2); - let channel1 = NetUtil.newChannel({uri: uri1, loadUsingSystemPrincipal: true}); - let channel2 = NetUtil.newChannel({uri: uri2, loadUsingSystemPrincipal: true}); + const contentPolicyType = Ci.nsIContentPolicy.TYPE_DOCUMENT; + let channel1 = NetUtil.newChannel({uri: uri1, loadUsingSystemPrincipal: true, contentPolicyType}); + let channel2 = NetUtil.newChannel({uri: uri2, loadUsingSystemPrincipal: true, contentPolicyType}); // Create some file:// URIs. let filespec1 = "file://foo.txt"; @@ -70,12 +71,12 @@ function run_test() { // hierarchy. We leave that to mochitests. // Test isThirdPartyChannel. As above, we can't test the bits that require - // a load context or window heirarchy. Because of that, the code assumes - // that these are all third-party loads. + // a load context or window heirarchy. Because of bug 1259873, we assume + // that these are not third-party. do_check_throws(function() { util.isThirdPartyChannel(null); }, NS_ERROR_INVALID_ARG); - do_check_true(util.isThirdPartyChannel(channel1)); - do_check_true(util.isThirdPartyChannel(channel1, uri1)); + do_check_false(util.isThirdPartyChannel(channel1)); + do_check_false(util.isThirdPartyChannel(channel1, uri1)); do_check_true(util.isThirdPartyChannel(channel1, uri2)); let httpchannel1 = channel1.QueryInterface(Ci.nsIHttpChannelInternal); diff --git a/dom/canvas/WebGLContextState.cpp b/dom/canvas/WebGLContextState.cpp index 7769a84e5a..f8b34718e6 100644 --- a/dom/canvas/WebGLContextState.cpp +++ b/dom/canvas/WebGLContextState.cpp @@ -569,8 +569,15 @@ WebGLContext::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv) case LOCAL_GL_DEPTH_RANGE: case LOCAL_GL_ALIASED_POINT_SIZE_RANGE: case LOCAL_GL_ALIASED_LINE_WIDTH_RANGE: { + GLenum driverPName = pname; + if (gl->IsCoreProfile() && + driverPName == LOCAL_GL_ALIASED_POINT_SIZE_RANGE) + { + driverPName = LOCAL_GL_POINT_SIZE_RANGE; + } + GLfloat fv[2] = { 0 }; - gl->fGetFloatv(pname, fv); + gl->fGetFloatv(driverPName, fv); JSObject* obj = dom::Float32Array::Create(cx, this, 2, fv); if (!obj) { rv = NS_ERROR_OUT_OF_MEMORY; diff --git a/dom/locales/en-US/chrome/appstrings.properties b/dom/locales/en-US/chrome/appstrings.properties index 7ee76cd02b..a0efb17fd5 100644 --- a/dom/locales/en-US/chrome/appstrings.properties +++ b/dom/locales/en-US/chrome/appstrings.properties @@ -4,6 +4,7 @@ malformedURI=The URL is not valid and cannot be loaded. fileNotFound=The file %S cannot be found. Please check the location and try again. +fileAccessDenied=The file at %S is not readable. dnsNotFound=%S could not be found. Please check the name and try again. unknownProtocolFound=One of the following (%S) is not a registered protocol or is not allowed in this context. connectionFailure=The connection was refused when attempting to contact %S. @@ -39,3 +40,4 @@ remoteXUL=This page uses an unsupported technology that is no longer available b tabcrashed= sslv3Used=The safety of your data on %S could not be guaranteed because it uses SSLv3, a broken security protocol. weakCryptoUsed=The owner of %S has configured their website improperly. To protect your information from being stolen, the connection to this website has not been established. +inadequateSecurityError=The website tried to negotiate an inadequate level of security. diff --git a/dom/locales/en-US/chrome/netError.dtd b/dom/locales/en-US/chrome/netError.dtd index d379108f53..c43c413bdc 100644 --- a/dom/locales/en-US/chrome/netError.dtd +++ b/dom/locales/en-US/chrome/netError.dtd @@ -19,6 +19,9 @@

  • Could the item have been renamed, removed, or relocated?
  • Is there a spelling, capitalization, or other typographical error in the address?
  • Do you have sufficient access permissions to the requested item?
  • "> + +
  • It may have been removed, moved, or file permissions may be preventing access.
  • "> + Additional information about this problem or error is currently unavailable.

    "> @@ -105,3 +108,8 @@
    • Please contact the website owners to inform them of this problem.

    "> + + + + uses security technology that is outdated and vulnerable to attack. An attacker could easily reveal information which you thought to be safe. The website administrator will need to fix the server first before you can visit the site.

    Error code: NS_ERROR_NET_INADEQUATE_SECURITY

    "> diff --git a/dom/workers/test/file_getcookie.sjs b/dom/workers/test/file_getcookie.sjs new file mode 100644 index 0000000000..b5204bdd71 --- /dev/null +++ b/dom/workers/test/file_getcookie.sjs @@ -0,0 +1,15 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ +function handleRequest(request, response) { + try { + var cookie = request.getHeader("Cookie"); + } catch (e) { + cookie = "EMPTY_COOKIE"; + } + + // avoid confusing cache behaviors. + response.setHeader("Cache-Control", "no-cache", false); + response.setHeader("Content-type", "text/plain", false); + response.setStatusLine(request.httpVersion, "200", "OK"); + response.write(cookie); +} diff --git a/dom/workers/test/mochitest.ini b/dom/workers/test/mochitest.ini index d0f31ea60c..c8f5ffa470 100644 --- a/dom/workers/test/mochitest.ini +++ b/dom/workers/test/mochitest.ini @@ -25,6 +25,7 @@ support-files = eventDispatch_worker.js fibonacci_worker.js file_bug1010784_worker.js + file_getcookie.sjs importScripts_worker.js importScripts_worker_imported1.js importScripts_worker_imported2.js @@ -236,6 +237,7 @@ skip-if = buildapp == 'b2g' || toolkit == 'android' #bug 982828 [test_workersDisabled.html] [test_xhr.html] [test_xhr2.html] +[test_xhr_3rdparty.html] [test_xhr_headers.html] [test_xhr_implicit_cancel.html] [test_xhr_parameters.html] diff --git a/dom/workers/test/test_xhr_3rdparty.html b/dom/workers/test/test_xhr_3rdparty.html new file mode 100644 index 0000000000..eeb6ef88c8 --- /dev/null +++ b/dom/workers/test/test_xhr_3rdparty.html @@ -0,0 +1,74 @@ + + + + + + Test for DOM Worker Threads XHR (Bug 450452 ) + + + + +DOM Worker Threads XHR (Bug 450452) +

    + +
    +
    +
    + + diff --git a/netwerk/base/LoadInfo.cpp b/netwerk/base/LoadInfo.cpp index 3db29a7753..ba0cc88e8e 100644 --- a/netwerk/base/LoadInfo.cpp +++ b/netwerk/base/LoadInfo.cpp @@ -50,7 +50,7 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal, , mParentOuterWindowID(0) , mEnforceSecurity(false) , mInitialSecurityCheckDone(false) - , mIsThirdPartyContext(true) + , mIsThirdPartyContext(false) , mForcePreflight(false) , mIsPreflight(false) , mIsFromProcessingFrameAttributes(false) @@ -58,6 +58,12 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal, MOZ_ASSERT(mLoadingPrincipal); MOZ_ASSERT(mTriggeringPrincipal); + // TODO(bug 1259873): Above, we initialize mIsThirdPartyContext to false meaning + // that consumers of LoadInfo that don't pass a context or pass a context from + // which we can't find a window will default to assuming that they're 1st + // party. It would be nice if we could default "safe" and assume that we are + // 3rd party until proven otherwise. + // if consumers pass both, aLoadingContext and aLoadingPrincipal // then the loadingPrincipal must be the same as the node's principal MOZ_ASSERT(!aLoadingContext || !aLoadingPrincipal || diff --git a/netwerk/protocol/http/Http2Session.cpp b/netwerk/protocol/http/Http2Session.cpp index 394b383d94..6603cb4dd1 100644 --- a/netwerk/protocol/http/Http2Session.cpp +++ b/netwerk/protocol/http/Http2Session.cpp @@ -151,6 +151,8 @@ Http2Session::Shutdown() CloseStream(stream, NS_ERROR_NET_RESET); // can be restarted } else if (stream->RecvdData()) { CloseStream(stream, NS_ERROR_NET_PARTIAL_TRANSFER); + } else if (mGoAwayReason == INADEQUATE_SECURITY) { + CloseStream(stream, NS_ERROR_NET_INADEQUATE_SECURITY); } else { CloseStream(stream, NS_ERROR_ABORT); } @@ -2270,8 +2272,14 @@ Http2Session::ReadSegmentsAgain(nsAHttpSegmentReader *reader, "Inconsistent Write Function Callback"); nsresult rv = ConfirmTLSProfile(); - if (NS_FAILED(rv)) + if (NS_FAILED(rv)) { + if (mGoAwayReason == INADEQUATE_SECURITY) { + LOG3(("Http2Session::ReadSegments %p returning INADEQUATE_SECURITY %x", + this, NS_ERROR_NET_INADEQUATE_SECURITY)); + rv = NS_ERROR_NET_INADEQUATE_SECURITY; + } return rv; + } if (reader) mSegmentReader = reader; diff --git a/toolkit/components/url-classifier/tests/mochitest/ping.sjs b/toolkit/components/url-classifier/tests/mochitest/ping.sjs new file mode 100644 index 0000000000..37a78956e0 --- /dev/null +++ b/toolkit/components/url-classifier/tests/mochitest/ping.sjs @@ -0,0 +1,16 @@ +function handleRequest(request, response) +{ + var query = {}; + request.queryString.split('&').forEach(function (val) { + var [name, value] = val.split('='); + query[name] = unescape(value); + }); + + if (request.method == "POST") { + setState(query["id"], "ping"); + } else { + var value = getState(query["id"]); + response.setHeader("Content-Type", "text/plain", false); + response.write(value); + } +} diff --git a/toolkit/components/url-classifier/tests/mochitest/test_classify_ping.html b/toolkit/components/url-classifier/tests/mochitest/test_classify_ping.html new file mode 100644 index 0000000000..96fa2891a7 --- /dev/null +++ b/toolkit/components/url-classifier/tests/mochitest/test_classify_ping.html @@ -0,0 +1,121 @@ + + + + Bug 1233914 - ping doesn't honor the TP list here. + + + + + +

    + +
    +
    +
    +
    + + diff --git a/xpcom/base/ErrorList.h b/xpcom/base/ErrorList.h index 5a859c2f84..0b631842ce 100644 --- a/xpcom/base/ErrorList.h +++ b/xpcom/base/ErrorList.h @@ -225,6 +225,8 @@ ERROR(NS_ERROR_PROXY_CONNECTION_REFUSED, FAILURE(72)), /* A transfer was only partially done when it completed. */ ERROR(NS_ERROR_NET_PARTIAL_TRANSFER, FAILURE(76)), + /* HTTP/2 detected invalid TLS configuration */ + ERROR(NS_ERROR_NET_INADEQUATE_SECURITY, FAILURE(82)), /* XXX really need to better rationalize these error codes. are consumers of * necko really expected to know how to discern the meaning of these?? */