From 196cd64e9e3c0e9177d255e266ad1f14c7db7d9a Mon Sep 17 00:00:00 2001 From: Blake Kaplan Date: Fri, 17 Jul 2015 14:52:00 +0200 Subject: [PATCH 01/20] Bug 1139953 - Pass a dummy channel into the cookie service so that nsICookiePermission can compute private browsing mode correctly. r=jdm --- .../privatebrowsing/test/browser/browser.ini | 1 - netwerk/cookie/CookieServiceParent.cpp | 44 ++++++++++++++++++- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/browser/components/privatebrowsing/test/browser/browser.ini b/browser/components/privatebrowsing/test/browser/browser.ini index 48410bc5df0..4004c622beb 100644 --- a/browser/components/privatebrowsing/test/browser/browser.ini +++ b/browser/components/privatebrowsing/test/browser/browser.ini @@ -23,7 +23,6 @@ support-files = [browser_privatebrowsing_certexceptionsui.js] [browser_privatebrowsing_concurrent.js] [browser_privatebrowsing_cookieacceptdialog.js] -skip-if = e10s # Bug 1139953 - Accept cookie dialog shown in private window when e10s enabled [browser_privatebrowsing_crh.js] [browser_privatebrowsing_downloadLastDir.js] [browser_privatebrowsing_downloadLastDir_c.js] diff --git a/netwerk/cookie/CookieServiceParent.cpp b/netwerk/cookie/CookieServiceParent.cpp index 5fa863b7fff..4a929b5ca2e 100644 --- a/netwerk/cookie/CookieServiceParent.cpp +++ b/netwerk/cookie/CookieServiceParent.cpp @@ -9,6 +9,8 @@ #include "mozilla/ipc/URIUtils.h" #include "nsCookieService.h" +#include "nsIScriptSecurityManager.h" +#include "nsIPrivateBrowsingChannel.h" #include "nsNetCID.h" #include "nsPrintfCString.h" #include "SerializedLoadContext.h" @@ -17,6 +19,33 @@ using namespace mozilla::ipc; using mozilla::dom::PContentParent; using mozilla::net::NeckoParent; +namespace { + +bool +CreateDummyChannel(nsIURI* aHostURI, bool aIsPrivate, nsIChannel **aChannel) +{ + nsCOMPtr principal; + nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager(); + nsresult rv = ssm->GetNoAppCodebasePrincipal(aHostURI, getter_AddRefs(principal)); + if (NS_FAILED(rv)) { + return false; + } + + nsCOMPtr dummyChannel; + NS_NewChannel(getter_AddRefs(dummyChannel), aHostURI, principal, + nsILoadInfo::SEC_NORMAL, nsIContentPolicy::TYPE_INVALID); + nsCOMPtr pbChannel = do_QueryInterface(dummyChannel); + if (!pbChannel) { + return false; + } + + pbChannel->SetPrivate(aIsPrivate); + dummyChannel.forget(aChannel); + return true; +} + +} + namespace mozilla { namespace net { @@ -126,11 +155,22 @@ CookieServiceParent::RecvSetCookieString(const URIParams& aHost, return false; } + // This is a gross hack. We've already computed everything we need to know + // for whether to set this cookie or not, but we need to communicate all of + // this information through to nsICookiePermission, which indirectly + // computes the information from the channel. We only care about the + // aIsPrivate argument as nsCookieService::SetCookieStringInternal deals + // with aIsForeign before we have to worry about nsCookiePermission trying + // to use the channel to inspect it. + nsCOMPtr dummyChannel; + if (!CreateDummyChannel(hostURI, isPrivate, getter_AddRefs(dummyChannel))) { + return false; + } + nsDependentCString cookieString(aCookieString, 0); - //TODO: bug 812475, pass a real channel object mCookieService->SetCookieStringInternal(hostURI, aIsForeign, cookieString, aServerTime, aFromHttp, appId, - isInBrowserElement, isPrivate, nullptr); + isInBrowserElement, isPrivate, dummyChannel); return true; } From ea0e1b5e867e2f72de78dedbd3e35c87f04688a3 Mon Sep 17 00:00:00 2001 From: John Pavlicek Date: Tue, 7 Jul 2015 13:40:00 +0200 Subject: [PATCH 02/20] Bug 1159725 - Links in markup-view attributes should open with middle-click; r=pbro --- browser/devtools/inspector/inspector-panel.js | 31 ++++- browser/devtools/inspector/inspector.xul | 4 +- browser/devtools/markupview/markup-view.js | 9 ++ browser/devtools/markupview/test/browser.ini | 1 + .../test/browser_markupview_links_05.js | 6 +- .../test/browser_markupview_links_06.js | 4 +- .../test/browser_markupview_links_07.js | 118 ++++++++++++++++++ 7 files changed, 160 insertions(+), 13 deletions(-) create mode 100644 browser/devtools/markupview/test/browser_markupview_links_07.js diff --git a/browser/devtools/inspector/inspector-panel.js b/browser/devtools/inspector/inspector-panel.js index ba51e4a777a..192e8afb554 100644 --- a/browser/devtools/inspector/inspector-panel.js +++ b/browser/devtools/inspector/inspector-panel.js @@ -1176,13 +1176,25 @@ InspectorPanel.prototype = { /** * This method is here for the benefit of the node-menu-link-follow menu item - * in the inspector contextual-menu. It's behavior depends on which node was - * right-clicked when the menu was opened. + * in the inspector contextual-menu. */ - followAttributeLink: function(e) { + onFollowLink: function() { let type = this.panelDoc.popupNode.dataset.type; let link = this.panelDoc.popupNode.dataset.link; + this.followAttributeLink(type, link); + }, + + /** + * Given a type and link found in a node's attribute in the markup-view, + * attempt to follow that link (which may result in opening a new tab, the + * style editor or debugger). + */ + followAttributeLink: function(type, link) { + if (!type || !link) { + return; + } + if (type === "uri" || type === "cssresource" || type === "jsresource") { // Open link in a new tab. // When the inspector menu was setup on click (see _setupNodeLinkMenu), we @@ -1213,11 +1225,18 @@ InspectorPanel.prototype = { /** * This method is here for the benefit of the node-menu-link-copy menu item - * in the inspector contextual-menu. It's behavior depends on which node was - * right-clicked when the menu was opened. + * in the inspector contextual-menu. */ - copyAttributeLink: function(e) { + onCopyLink: function() { let link = this.panelDoc.popupNode.dataset.link; + + this.copyAttributeLink(link); + }, + + /** + * This method is here for the benefit of copying links. + */ + copyAttributeLink: function(link) { // When the inspector menu was setup on click (see _setupNodeLinkMenu), we // already checked that resolveRelativeURL existed. this.inspector.resolveRelativeURL(link, this.selection.nodeFront).then(url => { diff --git a/browser/devtools/inspector/inspector.xul b/browser/devtools/inspector/inspector.xul index d4bb848c912..d8715bcf0eb 100644 --- a/browser/devtools/inspector/inspector.xul +++ b/browser/devtools/inspector/inspector.xul @@ -106,9 +106,9 @@ oncommand="inspector.deleteNode()"/> + oncommand="inspector.onFollowLink()"/> + oncommand="inspector.onCopyLink()"/> { diff --git a/browser/devtools/markupview/test/browser.ini b/browser/devtools/markupview/test/browser.ini index 53da26b0d22..1af2b0b9376 100644 --- a/browser/devtools/markupview/test/browser.ini +++ b/browser/devtools/markupview/test/browser.ini @@ -79,6 +79,7 @@ skip-if = e10s # Bug 1040751 - CodeMirror editor.destroy() isn't e10s compatible [browser_markupview_links_04.js] [browser_markupview_links_05.js] [browser_markupview_links_06.js] +[browser_markupview_links_07.js] [browser_markupview_load_01.js] [browser_markupview_html_edit_01.js] [browser_markupview_html_edit_02.js] diff --git a/browser/devtools/markupview/test/browser_markupview_links_05.js b/browser/devtools/markupview/test/browser_markupview_links_05.js index 93060d0a7a6..8e635fef52c 100644 --- a/browser/devtools/markupview/test/browser_markupview_links_05.js +++ b/browser/devtools/markupview/test/browser_markupview_links_05.js @@ -22,7 +22,7 @@ add_task(function*() { info("Follow the link and wait for the new tab to open"); let onTabOpened = once(gBrowser.tabContainer, "TabOpen"); - inspector.followAttributeLink(); + inspector.onFollowLink(); let {target: tab} = yield onTabOpened; yield waitForTabLoad(tab); @@ -41,7 +41,7 @@ add_task(function*() { info("Follow the link and wait for the new node to be selected"); let onSelection = inspector.selection.once("new-node-front"); - inspector.followAttributeLink(); + inspector.onFollowLink(); yield onSelection; ok(true, "A new node was selected"); @@ -57,7 +57,7 @@ add_task(function*() { info("Try to follow the link and check that no new node were selected"); let onFailed = inspector.once("idref-attribute-link-failed"); - inspector.followAttributeLink(); + inspector.onFollowLink(); yield onFailed; ok(true, "The node selection failed"); diff --git a/browser/devtools/markupview/test/browser_markupview_links_06.js b/browser/devtools/markupview/test/browser_markupview_links_06.js index 8a0f57475bf..8c15478c134 100644 --- a/browser/devtools/markupview/test/browser_markupview_links_06.js +++ b/browser/devtools/markupview/test/browser_markupview_links_06.js @@ -22,7 +22,7 @@ add_task(function*() { info("Follow the link and wait for the style-editor to open"); let onStyleEditorReady = toolbox.once("styleeditor-ready"); - inspector.followAttributeLink(); + inspector.onFollowLink(); yield onStyleEditorReady; // No real need to test that the editor opened on the right file here as this @@ -42,7 +42,7 @@ add_task(function*() { info("Follow the link and wait for the debugger to open"); let onDebuggerReady = toolbox.once("jsdebugger-ready"); - inspector.followAttributeLink(); + inspector.onFollowLink(); yield onDebuggerReady; // No real need to test that the debugger opened on the right file here as diff --git a/browser/devtools/markupview/test/browser_markupview_links_07.js b/browser/devtools/markupview/test/browser_markupview_links_07.js new file mode 100644 index 00000000000..beb4866a9a0 --- /dev/null +++ b/browser/devtools/markupview/test/browser_markupview_links_07.js @@ -0,0 +1,118 @@ +/* vim: set ts=2 et sw=2 tw=80: */ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Tests that a middle-click or meta/ctrl-click on links in attributes actually +// do follows the link. + +const TEST_URL = TEST_URL_ROOT + "doc_markup_links.html"; + +add_task(function*() { + let {inspector} = yield addTab(TEST_URL).then(openInspector); + + info("Select a node with a URI attribute"); + yield selectNode("video", inspector); + + info("Find the link element from the markup-view"); + let {editor} = yield getContainerForSelector("video", inspector); + let linkEl = editor.attrElements.get("poster").querySelector(".link"); + + info("Follow the link with middle-click and wait for the new tab to open"); + yield followLinkWaitForTab(linkEl, false, + TEST_URL_ROOT + "doc_markup_tooltip.png"); + + info("Follow the link with meta/ctrl-click and wait for the new tab to open"); + yield followLinkWaitForTab(linkEl, true, + TEST_URL_ROOT + "doc_markup_tooltip.png"); + + info("Select a node with a IDREF attribute"); + yield selectNode("label", inspector); + + info("Find the link element from the markup-view that contains the ref"); + ({editor} = yield getContainerForSelector("label", inspector)); + linkEl = editor.attrElements.get("for").querySelector(".link"); + + info("Follow link with middle-click, wait for new node to be selected."); + yield followLinkWaitForNewNode(linkEl, false, inspector); + + info("Follow link with ctrl/meta-click, wait for new node to be selected."); + yield followLinkWaitForNewNode(linkEl, true, inspector); + + info("Select a node with an invalid IDREF attribute"); + yield selectNode("output", inspector); + + info("Find the link element from the markup-view that contains the ref"); + ({editor} = yield getContainerForSelector("output", inspector)); + linkEl = editor.attrElements.get("for").querySelectorAll(".link")[2]; + + info("Try to follow link wiith middle-click, check no new node selected"); + yield followLinkNoNewNode(linkEl, false, inspector); + + info("Try to follow link wiith meta/ctrl-click, check no new node selected"); + yield followLinkNoNewNode(linkEl, true, inspector); +}); + +function waitForTabLoad(tab) { + let def = promise.defer(); + tab.addEventListener("load", function onLoad() { + // Skip load event for about:blank + if (tab.linkedBrowser.currentURI.spec === "about:blank") { + return; + } + tab.removeEventListener("load", onLoad); + def.resolve(); + }); + return def.promise; +} + +function performMouseDown(linkEl, metactrl) { + let evt = linkEl.ownerDocument.createEvent("MouseEvents"); + + let button = -1; + + if (metactrl) { + info("Performing Meta/Ctrl+Left Click"); + button = 0; + } else { + info("Performing Middle Click"); + button = 1; + } + + evt.initMouseEvent("mousedown", true, true, + linkEl.ownerDocument.defaultView, 1, 0, 0, 0, 0, metactrl, + false, false, metactrl, button, null); + + linkEl.dispatchEvent(evt); +} + +function* followLinkWaitForTab(linkEl, isMetaClick, expectedTabURI) { + let onTabOpened = once(gBrowser.tabContainer, "TabOpen"); + performMouseDown(linkEl, isMetaClick); + let {target} = yield onTabOpened; + yield waitForTabLoad(target); + ok(true, "A new tab opened"); + is(target.linkedBrowser.currentURI.spec, expectedTabURI, + "The URL for the new tab is correct"); + gBrowser.removeTab(target); +} + +function* followLinkWaitForNewNode(linkEl, isMetaClick, inspector) { + let onSelection = inspector.selection.once("new-node-front"); + performMouseDown(linkEl, isMetaClick); + yield onSelection; + + ok(true, "A new node was selected"); + is(inspector.selection.nodeFront.id, "name", "The right node was selected"); +} + +function* followLinkNoNewNode(linkEl, isMetaClick, inspector) { + let onFailed = inspector.once("idref-attribute-link-failed"); + performMouseDown(linkEl, isMetaClick); + yield onFailed; + + ok(true, "The node selection failed"); + is(inspector.selection.nodeFront.tagName.toLowerCase(), "output", + "The node is still selected"); +} From 43302a4fb400b2876df7d1baeb6bfd1634e9fc7b Mon Sep 17 00:00:00 2001 From: Justin Crawford Date: Tue, 21 Jul 2015 14:30:32 -0600 Subject: [PATCH 03/20] Bug 1169241 - Add hover style to footer links in newtab intro. r=emtwo --- browser/base/content/newtab/newTab.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/browser/base/content/newtab/newTab.css b/browser/base/content/newtab/newTab.css index 0ee040ada8c..fe095bb30fe 100644 --- a/browser/base/content/newtab/newTab.css +++ b/browser/base/content/newtab/newTab.css @@ -724,6 +724,10 @@ input[type=button] { color: #4A90E2; } +#newtab-intro-footer > ul > li > a:hover { + color: #000000; +} + #newtab-intro-body { position: relative; display: block; From 9f7118e076761eba25e3f4fb0761a36949dfb693 Mon Sep 17 00:00:00 2001 From: Amogh Pradeep Date: Sat, 20 Jun 2015 01:13:47 -0500 Subject: [PATCH 04/20] Bug 1169421 - Switch Fennec to use ch.boye instead of org.apache.http to allow for building with Android M SDK 23. r=mfinkle --- mobile/android/base/distribution/Distribution.java | 2 +- mobile/android/base/favicons/LoadFaviconTask.java | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/mobile/android/base/distribution/Distribution.java b/mobile/android/base/distribution/Distribution.java index 5f7bf56dd50..1cb9d508711 100644 --- a/mobile/android/base/distribution/Distribution.java +++ b/mobile/android/base/distribution/Distribution.java @@ -32,7 +32,7 @@ import java.util.zip.ZipFile; import javax.net.ssl.SSLException; -import org.apache.http.protocol.HTTP; +import ch.boye.httpclientandroidlib.protocol.HTTP; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; diff --git a/mobile/android/base/favicons/LoadFaviconTask.java b/mobile/android/base/favicons/LoadFaviconTask.java index 77bf3e1fe3d..9c942d26e30 100644 --- a/mobile/android/base/favicons/LoadFaviconTask.java +++ b/mobile/android/base/favicons/LoadFaviconTask.java @@ -8,13 +8,13 @@ package org.mozilla.gecko.favicons; import android.content.ContentResolver; import android.content.Context; import android.graphics.Bitmap; -import android.net.http.AndroidHttpClient; +import ch.boye.httpclientandroidlib.impl.client.DefaultHttpClient; import android.text.TextUtils; import android.util.Log; -import org.apache.http.Header; -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpGet; +import ch.boye.httpclientandroidlib.Header; +import ch.boye.httpclientandroidlib.HttpEntity; +import ch.boye.httpclientandroidlib.HttpResponse; +import ch.boye.httpclientandroidlib.client.methods.HttpGet; import org.mozilla.gecko.GeckoAppShell; import org.mozilla.gecko.GeckoProfile; import org.mozilla.gecko.db.BrowserDB; @@ -72,7 +72,7 @@ public class LoadFaviconTask { private LinkedList chainees; private boolean isChaining; - static AndroidHttpClient httpClient = AndroidHttpClient.newInstance(GeckoAppShell.getGeckoInterface().getDefaultUAString()); + static DefaultHttpClient httpClient = new DefaultHttpClient(); public LoadFaviconTask(Context context, String pageURL, String faviconURL, int flags, OnFaviconLoadedListener listener) { this(context, pageURL, faviconURL, flags, listener, -1, false); @@ -128,6 +128,7 @@ public class LoadFaviconTask { } HttpGet request = new HttpGet(faviconURI); + request.setHeader("User-Agent", GeckoAppShell.getGeckoInterface().getDefaultUAString()); HttpResponse response = httpClient.execute(request); if (response == null) { return null; From ea43bd80652741770a8a2409add90322d80754cc Mon Sep 17 00:00:00 2001 From: Brittany Storoz Date: Fri, 17 Jul 2015 17:09:00 +0200 Subject: [PATCH 05/20] Bug 1185005 - Fix panel-header font-size on WebIDE sidebars; r=jryans --- browser/devtools/webide/themes/panel-listing.css | 1 - 1 file changed, 1 deletion(-) diff --git a/browser/devtools/webide/themes/panel-listing.css b/browser/devtools/webide/themes/panel-listing.css index 5337ad2aaa9..165ff2494aa 100644 --- a/browser/devtools/webide/themes/panel-listing.css +++ b/browser/devtools/webide/themes/panel-listing.css @@ -35,7 +35,6 @@ label, text-transform: uppercase; line-height: 200%; margin: 5px 5px 0 5px; - font-size: 10%; font-weight: 700; width: 100%; } From 557f96fb0c53e8be35ad2474a1558ae525804208 Mon Sep 17 00:00:00 2001 From: Masatoshi Kimura Date: Wed, 22 Jul 2015 19:31:06 +0900 Subject: [PATCH 06/20] Bug 1184508 - Remember registry hash for later use on Win8+. r=jimm --- .../shell/nsWindowsShellService.cpp | 310 +++++++++++++++--- 1 file changed, 260 insertions(+), 50 deletions(-) diff --git a/browser/components/shell/nsWindowsShellService.cpp b/browser/components/shell/nsWindowsShellService.cpp index 43fecf2aec0..caa5252000f 100644 --- a/browser/components/shell/nsWindowsShellService.cpp +++ b/browser/components/shell/nsWindowsShellService.cpp @@ -3,6 +3,8 @@ * 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/. */ +#include "nsWindowsShellService.h" + #include "imgIContainer.h" #include "imgIRequest.h" #include "mozilla/gfx/2D.h" @@ -17,7 +19,6 @@ #include "nsNetUtil.h" #include "nsServiceManagerUtils.h" #include "nsShellService.h" -#include "nsWindowsShellService.h" #include "nsIProcess.h" #include "nsICategoryManager.h" #include "nsBrowserCompsCID.h" @@ -85,6 +86,38 @@ OpenKeyForReading(HKEY aKeyRoot, const nsAString& aKeyName, HKEY* aKey) return NS_OK; } +static bool +GetPrefString(const nsCString& aPrefName, nsAString& aValue) +{ + nsCOMPtr prefs(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (!prefs) { + return false; + } + + nsAutoCString prefCStr; + nsresult rv = prefs->GetCharPref(aPrefName.get(), + getter_Copies(prefCStr)); + if (NS_FAILED(rv)) { + return false; + } + CopyUTF8toUTF16(prefCStr, aValue); + + return true; +} + +static bool +SetPrefString(const nsCString& aPrefName, const nsString& aValue) +{ + nsCOMPtr prefs(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (!prefs) { + return false; + } + + nsresult rv = prefs->SetCharPref(aPrefName.get(), + NS_ConvertUTF16toUTF8(aValue).get()); + return NS_SUCCEEDED(rv); +} + /////////////////////////////////////////////////////////////////////////////// // Default Browser Registry Settings // @@ -322,38 +355,219 @@ nsWindowsShellService::ShortcutMaintenance() } static bool -IsAARDefaultHTTP(IApplicationAssociationRegistration* pAAR, - bool* aIsDefaultBrowser) +IsAARDefault(const nsRefPtr& pAAR, + LPCWSTR aClassName) { // Make sure the Prog ID matches what we have LPWSTR registeredApp; - HRESULT hr = pAAR->QueryCurrentDefault(L"http", AT_URLPROTOCOL, AL_EFFECTIVE, + bool isProtocol = *aClassName != L'.'; + ASSOCIATIONTYPE queryType = isProtocol ? AT_URLPROTOCOL : AT_FILEEXTENSION; + HRESULT hr = pAAR->QueryCurrentDefault(aClassName, queryType, AL_EFFECTIVE, ®isteredApp); - if (SUCCEEDED(hr)) { - LPCWSTR firefoxHTTPProgID = L"FirefoxURL"; - *aIsDefaultBrowser = !wcsicmp(registeredApp, firefoxHTTPProgID); - CoTaskMemFree(registeredApp); - } else { - *aIsDefaultBrowser = false; + if (FAILED(hr)) { + return false; } - return SUCCEEDED(hr); + + LPCWSTR progID = isProtocol ? L"FirefoxURL" : L"FirefoxHTML"; + bool isDefault = !wcsicmp(registeredApp, progID); + CoTaskMemFree(registeredApp); + + return isDefault; +} + +static void +GetUserChoiceKeyName(LPCWSTR aClassName, bool aIsProtocol, + nsAString& aKeyName) +{ + aKeyName.AssignLiteral(aIsProtocol + ? "Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\" + : "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\"); + aKeyName.Append(aClassName); + aKeyName.AppendLiteral("\\UserChoice"); +} + +static void +GetHashPrefName(LPCWSTR aClassName, nsACString& aPrefName) +{ + aPrefName.AssignLiteral("browser.shell.associationHash."); + aPrefName.Append(NS_ConvertUTF16toUTF8(*aClassName == L'.' ? aClassName + 1 + : aClassName)); } static bool -IsAARDefaultHTML(IApplicationAssociationRegistration* pAAR, - bool* aIsDefaultBrowser) +SaveWin8RegistryHash(const nsRefPtr& pAAR, + LPCWSTR aClassName) { - LPWSTR registeredApp; - HRESULT hr = pAAR->QueryCurrentDefault(L".html", AT_FILEEXTENSION, AL_EFFECTIVE, - ®isteredApp); - if (SUCCEEDED(hr)) { - LPCWSTR firefoxHTMLProgID = L"FirefoxHTML"; - *aIsDefaultBrowser = !wcsicmp(registeredApp, firefoxHTMLProgID); - CoTaskMemFree(registeredApp); - } else { - *aIsDefaultBrowser = false; + bool isProtocol = *aClassName != L'.'; + bool isDefault = IsAARDefault(pAAR, aClassName); + // We can save the value only if Firefox is the default. + if (!isDefault) { + return isDefault; } - return SUCCEEDED(hr); + + nsAutoString keyName; + GetUserChoiceKeyName(aClassName, isProtocol, keyName); + + nsCOMPtr regKey = + do_CreateInstance("@mozilla.org/windows-registry-key;1"); + if (!regKey) { + return isDefault; + } + + nsresult rv = regKey->Open(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER, + keyName, nsIWindowsRegKey::ACCESS_READ); + if (NS_FAILED(rv)) { + return isDefault; + } + + nsAutoString hash; + rv = regKey->ReadStringValue(NS_LITERAL_STRING("Hash"), hash); + if (NS_FAILED(rv)) { + return isDefault; + } + + nsAutoCString prefName; + GetHashPrefName(aClassName, prefName); + SetPrefString(prefName, hash); + + return isDefault; +} + +static bool +RestoreWin8RegistryHash(const nsRefPtr& pAAR, + LPCWSTR aClassName) +{ + nsAutoCString prefName; + GetHashPrefName(aClassName, prefName); + nsAutoString hash; + if (!GetPrefString(prefName, hash)) { + return false; + } + + bool isProtocol = *aClassName != L'.'; + nsString progId = isProtocol ? NS_LITERAL_STRING("FirefoxURL") + : NS_LITERAL_STRING("FirefoxHTML"); + + nsAutoString keyName; + GetUserChoiceKeyName(aClassName, isProtocol, keyName); + + nsCOMPtr regKey = + do_CreateInstance("@mozilla.org/windows-registry-key;1"); + if (!regKey) { + return false; + } + + nsresult rv = regKey->Open(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER, + keyName, nsIWindowsRegKey::ACCESS_READ); + if (NS_SUCCEEDED(rv)) { + nsAutoString currValue; + if (NS_SUCCEEDED(regKey->ReadStringValue(NS_LITERAL_STRING("Hash"), + currValue)) && + currValue.Equals(hash) && + NS_SUCCEEDED(regKey->ReadStringValue(NS_LITERAL_STRING("ProgId"), + currValue)) && + currValue.Equals(progId)) { + // The value is already set. + return true; + } + // We need to close this explicitly because nsIWindowsRegKey::SetKey + // does not close the old key. + regKey->Close(); + } + + // We have to use the registry function directly because + // nsIWindowsRegKey::Create will only return NS_ERROR_FAILURE + // on failure. + HKEY theKey; + DWORD res = ::RegOpenKeyExW(HKEY_CURRENT_USER, keyName.get(), 0, + KEY_READ | KEY_SET_VALUE, &theKey); + if (REG_FAILED(res)) { + if (res != ERROR_ACCESS_DENIED && res != ERROR_FILE_NOT_FOUND) { + return false; + } + if (res == ERROR_ACCESS_DENIED) { + res = ::RegDeleteKeyW(HKEY_CURRENT_USER, keyName.get()); + if (REG_FAILED(res)) { + return false; + } + } + res = ::RegCreateKeyExW(HKEY_CURRENT_USER, keyName.get(), 0, + nullptr, 0, KEY_READ | KEY_SET_VALUE, + nullptr, &theKey, nullptr); + if (REG_FAILED(res)) { + return false; + } + } + regKey->SetKey(theKey); + + rv = regKey->WriteStringValue(NS_LITERAL_STRING("Hash"), hash); + if (NS_FAILED(rv)) { + return false; + } + + rv = regKey->WriteStringValue(NS_LITERAL_STRING("ProgId"), progId); + if (NS_FAILED(rv)) { + return false; + } + + return IsAARDefault(pAAR, aClassName); +} + +static void +SaveWin8RegistryHashes(bool aCheckAllTypes, bool* aIsDefaultBrowser) +{ + nsRefPtr pAAR; + HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistration, + nullptr, + CLSCTX_INPROC, + IID_IApplicationAssociationRegistration, + getter_AddRefs(pAAR)); + if (FAILED(hr)) { + return; + } + + bool res = SaveWin8RegistryHash(pAAR, L"http"); + if (*aIsDefaultBrowser) { + *aIsDefaultBrowser = res; + } + SaveWin8RegistryHash(pAAR, L"https"); + SaveWin8RegistryHash(pAAR, L"ftp"); + res = SaveWin8RegistryHash(pAAR, L".html"); + if (*aIsDefaultBrowser && aCheckAllTypes) { + *aIsDefaultBrowser = res; + } + SaveWin8RegistryHash(pAAR, L".htm"); + SaveWin8RegistryHash(pAAR, L".shtml"); + SaveWin8RegistryHash(pAAR, L".xhtml"); + SaveWin8RegistryHash(pAAR, L".xht"); +} + +static bool +RestoreWin8RegistryHashes(bool aClaimAllTypes) +{ + nsRefPtr pAAR; + HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistration, + nullptr, + CLSCTX_INPROC, + IID_IApplicationAssociationRegistration, + getter_AddRefs(pAAR)); + if (FAILED(hr)) { + return false; + } + + bool res = RestoreWin8RegistryHash(pAAR, L"http"); + res = RestoreWin8RegistryHash(pAAR, L"https") && res; + RestoreWin8RegistryHash(pAAR, L"ftp"); + bool res2 = RestoreWin8RegistryHash(pAAR, L".html"); + res2 = RestoreWin8RegistryHash(pAAR, L".htm") && res2; + if (aClaimAllTypes) { + res = res && res2; + } + RestoreWin8RegistryHash(pAAR, L".shtml"); + RestoreWin8RegistryHash(pAAR, L".xhtml"); + RestoreWin8RegistryHash(pAAR, L".xht"); + + return res; } /* @@ -366,37 +580,27 @@ bool nsWindowsShellService::IsDefaultBrowserVista(bool aCheckAllTypes, bool* aIsDefaultBrowser) { - IApplicationAssociationRegistration* pAAR; + nsRefPtr pAAR; HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistration, nullptr, CLSCTX_INPROC, IID_IApplicationAssociationRegistration, - (void**)&pAAR); - - if (SUCCEEDED(hr)) { - if (aCheckAllTypes) { - BOOL res; - hr = pAAR->QueryAppIsDefaultAll(AL_EFFECTIVE, - APP_REG_NAME, - &res); - *aIsDefaultBrowser = res; - - // If we have all defaults, let's make sure that our ProgID - // is explicitly returned as well. Needed only for Windows 8. - if (*aIsDefaultBrowser && IsWin8OrLater()) { - IsAARDefaultHTTP(pAAR, aIsDefaultBrowser); - if (*aIsDefaultBrowser) { - IsAARDefaultHTML(pAAR, aIsDefaultBrowser); - } - } - } else { - IsAARDefaultHTTP(pAAR, aIsDefaultBrowser); - } - - pAAR->Release(); - return true; + getter_AddRefs(pAAR)); + if (FAILED(hr)) { + return false; } - return false; + + if (aCheckAllTypes) { + BOOL res; + hr = pAAR->QueryAppIsDefaultAll(AL_EFFECTIVE, + APP_REG_NAME, + &res); + *aIsDefaultBrowser = res; + } else if (!IsWin8OrLater()) { + *aIsDefaultBrowser = IsAARDefault(pAAR, L"http"); + } + + return true; } NS_IMETHODIMP @@ -496,6 +700,9 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck, // previous checks show that Firefox is the default browser. if (*aIsDefaultBrowser) { IsDefaultBrowserVista(aForAllTypes, aIsDefaultBrowser); + if (IsWin8OrLater()) { + SaveWin8RegistryHashes(aForAllTypes, aIsDefaultBrowser); + } } // To handle the case where DDE isn't disabled due for a user because there @@ -730,7 +937,8 @@ nsWindowsShellService::SetDefaultBrowser(bool aClaimAllTypes, bool aForAllUsers) } nsresult rv = LaunchHelper(appHelperPath); - if (NS_SUCCEEDED(rv) && IsWin8OrLater()) { + if (NS_SUCCEEDED(rv) && IsWin8OrLater() && + !RestoreWin8RegistryHashes(aClaimAllTypes)) { if (aClaimAllTypes) { if (IsWin10OrLater()) { rv = LaunchModernSettingsDialogDefaultApps(); @@ -760,6 +968,8 @@ nsWindowsShellService::SetDefaultBrowser(bool aClaimAllTypes, bool aForAllUsers) if (NS_FAILED(rv)) { rv = LaunchControlPanelDefaultsSelectionUI(); } + bool isDefault; + SaveWin8RegistryHashes(aClaimAllTypes, &isDefault); } } From 839d64e35ddc0abb8626be1124a15353b0864a96 Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Wed, 22 Jul 2015 12:50:18 +0100 Subject: [PATCH 07/20] Bug 1180700 - Fix wrapping of context information when comments field contains a long word. r=mikedeboer --- browser/components/loop/content/shared/css/common.css | 3 +++ 1 file changed, 3 insertions(+) diff --git a/browser/components/loop/content/shared/css/common.css b/browser/components/loop/content/shared/css/common.css index 92b03dabdd1..aa13075e8b6 100644 --- a/browser/components/loop/content/shared/css/common.css +++ b/browser/components/loop/content/shared/css/common.css @@ -549,6 +549,9 @@ html[dir="rtl"] .context-wrapper > .context-preview { flex: 0 1 auto; display: block; color: black; + /* 16px for the preview, plus its .8em margin */ + max-width: calc(100% - 16px - .8em); + word-wrap: break-word; } .context-wrapper > .context-description > .context-url { From eb435c8a7d07d112fccf0ef98d2f210901c312c5 Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Wed, 22 Jul 2015 12:50:18 +0100 Subject: [PATCH 08/20] Bug 1186362 - Drop Loop's use of jQuery from the desktop UI. r=mikedeboer --- browser/components/loop/content/conversation.html | 1 - browser/components/loop/content/js/client.js | 4 ++-- browser/components/loop/content/panel.html | 1 - browser/components/loop/jar.mn | 1 - browser/components/loop/test/desktop-local/index.html | 6 ++++-- browser/components/loop/test/shared/index.html | 6 ++++-- browser/components/loop/test/shared/views_test.js | 1 - browser/components/loop/test/standalone/index.html | 5 ++++- 8 files changed, 14 insertions(+), 11 deletions(-) diff --git a/browser/components/loop/content/conversation.html b/browser/components/loop/content/conversation.html index a88300687d4..7631a74452e 100644 --- a/browser/components/loop/content/conversation.html +++ b/browser/components/loop/content/conversation.html @@ -21,7 +21,6 @@ - diff --git a/browser/components/loop/content/js/client.js b/browser/components/loop/content/js/client.js index 3be748cbd96..4463146a920 100644 --- a/browser/components/loop/content/js/client.js +++ b/browser/components/loop/content/js/client.js @@ -3,7 +3,7 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ var loop = loop || {}; -loop.Client = (function($) { +loop.Client = (function() { "use strict"; // THe expected properties to be returned from the POST /calls request. @@ -116,4 +116,4 @@ loop.Client = (function($) { }; return Client; -})(jQuery); +})(); diff --git a/browser/components/loop/content/panel.html b/browser/components/loop/content/panel.html index d2aa202189b..6af78664cf7 100644 --- a/browser/components/loop/content/panel.html +++ b/browser/components/loop/content/panel.html @@ -16,7 +16,6 @@ - diff --git a/browser/components/loop/jar.mn b/browser/components/loop/jar.mn index 754795cc218..41173728e7f 100644 --- a/browser/components/loop/jar.mn +++ b/browser/components/loop/jar.mn @@ -99,7 +99,6 @@ browser.jar: content/browser/loop/shared/libs/react-0.12.2.js (content/shared/libs/react-0.12.2-prod.js) #endif content/browser/loop/shared/libs/lodash-3.9.3.js (content/shared/libs/lodash-3.9.3.js) - content/browser/loop/shared/libs/jquery-2.1.4.js (content/shared/libs/jquery-2.1.4.js) content/browser/loop/shared/libs/backbone-1.2.1.js (content/shared/libs/backbone-1.2.1.js) # Shared sounds diff --git a/browser/components/loop/test/desktop-local/index.html b/browser/components/loop/test/desktop-local/index.html index 35f243576eb..d74b99791a9 100644 --- a/browser/components/loop/test/desktop-local/index.html +++ b/browser/components/loop/test/desktop-local/index.html @@ -31,7 +31,6 @@ - @@ -101,7 +100,10 @@ }); mocha.run(function () { - $("#mocha").append("

Complete.

"); + var completeNode = document.createElement("p"); + completeNode.setAttribute("id", "complete"); + completeNode.appendChild(document.createTextNode("Complete")); + document.getElementById("mocha").appendChild(completeNode); }); diff --git a/browser/components/loop/test/shared/index.html b/browser/components/loop/test/shared/index.html index 84f5f3c5d22..197a3191aa2 100644 --- a/browser/components/loop/test/shared/index.html +++ b/browser/components/loop/test/shared/index.html @@ -30,7 +30,6 @@ - @@ -95,7 +94,10 @@ }); mocha.run(function () { - $("#mocha").append("

Complete.

"); + var completeNode = document.createElement("p"); + completeNode.setAttribute("id", "complete"); + completeNode.appendChild(document.createTextNode("Complete")); + document.getElementById("mocha").appendChild(completeNode); }); diff --git a/browser/components/loop/test/shared/views_test.js b/browser/components/loop/test/shared/views_test.js index e50d699ef2a..06cbc44fcdc 100644 --- a/browser/components/loop/test/shared/views_test.js +++ b/browser/components/loop/test/shared/views_test.js @@ -50,7 +50,6 @@ describe("loop.shared.views", function() { }); afterEach(function() { - $("#fixtures").empty(); sandbox.restore(); }); diff --git a/browser/components/loop/test/standalone/index.html b/browser/components/loop/test/standalone/index.html index 8d6c50d1c2f..bbec590c3ce 100644 --- a/browser/components/loop/test/standalone/index.html +++ b/browser/components/loop/test/standalone/index.html @@ -90,7 +90,10 @@ }); mocha.run(function () { - $("#mocha").append("

Complete.

"); + var completeNode = document.createElement("p"); + completeNode.setAttribute("id", "complete"); + completeNode.appendChild(document.createTextNode("Complete")); + document.getElementById("mocha").appendChild(completeNode); }); From a48fafa606b9fd32d036c2590c21695d67f998b0 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Wed, 22 Jul 2015 10:48:54 -0400 Subject: [PATCH 09/20] Bug 1148771 - Skip browser_notifications.js on Windows as well due to frequent failures. --- toolkit/components/passwordmgr/test/browser/browser.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/components/passwordmgr/test/browser/browser.ini b/toolkit/components/passwordmgr/test/browser/browser.ini index cb4750cb1e0..2d7bee1622a 100644 --- a/toolkit/components/passwordmgr/test/browser/browser.ini +++ b/toolkit/components/passwordmgr/test/browser/browser.ini @@ -7,7 +7,7 @@ support-files = [browser_DOMInputPasswordAdded.js] [browser_filldoorhanger.js] [browser_notifications.js] -skip-if = os != "win" # Intermittent failures: Bug 1182296 +skip-if = true # Intermittent failures: Bug 1182296, bug 1148771 [browser_passwordmgr_fields.js] [browser_passwordmgr_observers.js] [browser_passwordmgr_sort.js] From 76089e43bfa776ac85741daa858a51b775a35dd6 Mon Sep 17 00:00:00 2001 From: Sebastian Kaspari Date: Mon, 20 Jul 2015 11:55:32 +0200 Subject: [PATCH 10/20] Bug 1184683 - GeckoPreferences: Pass current context to RestrictedProfiles instead of relying on GeckoAppShell. r=ally --- mobile/android/base/RestrictedProfiles.java | 2 +- mobile/android/base/preferences/GeckoPreferences.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mobile/android/base/RestrictedProfiles.java b/mobile/android/base/RestrictedProfiles.java index f6e74c15d7e..4ce8ba7dc0f 100644 --- a/mobile/android/base/RestrictedProfiles.java +++ b/mobile/android/base/RestrictedProfiles.java @@ -181,7 +181,7 @@ public class RestrictedProfiles { return isUserRestricted(GeckoAppShell.getContext()); } - private static boolean isUserRestricted(final Context context) { + public static boolean isUserRestricted(final Context context) { // Guest mode is supported in all Android versions. if (getInGuest()) { return true; diff --git a/mobile/android/base/preferences/GeckoPreferences.java b/mobile/android/base/preferences/GeckoPreferences.java index f187a7660f1..736def42702 100644 --- a/mobile/android/base/preferences/GeckoPreferences.java +++ b/mobile/android/base/preferences/GeckoPreferences.java @@ -697,7 +697,7 @@ OnSharedPreferenceChangeListener } } if (PREFS_DEVTOOLS.equals(key) && - RestrictedProfiles.isUserRestricted()) { + RestrictedProfiles.isUserRestricted(this)) { preferences.removePreference(pref); i--; continue; From 653e081fc13e2c8efafe7205caac6aa07afb171c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Wed, 22 Jul 2015 17:17:32 +0200 Subject: [PATCH 11/20] Bug 1185958 - Windows 10: Only show box-shadow of location bar and search field on focus. r=jaws --- browser/themes/windows/browser.css | 1 - 1 file changed, 1 deletion(-) diff --git a/browser/themes/windows/browser.css b/browser/themes/windows/browser.css index 8325ef80432..8bc5129801c 100644 --- a/browser/themes/windows/browser.css +++ b/browser/themes/windows/browser.css @@ -1238,7 +1238,6 @@ toolbarbutton[constrain-size="true"][cui-areatype="toolbar"] > .toolbarbutton-ba #urlbar:not(:-moz-lwtheme):hover, .searchbar-textbox:not(:-moz-lwtheme):hover { border-color: hsl(0,0%,80%); - box-shadow: 0 0 0 1px hsl(0,0%,80%) inset; } #urlbar:not(:-moz-lwtheme)[focused], From a6a05d817f915725cd6e343acdbf42ca2c66e7a2 Mon Sep 17 00:00:00 2001 From: Iaroslav Sheptykin Date: Mon, 20 Jul 2015 06:54:00 -0400 Subject: [PATCH 12/20] Bug 1174468 - Show Yandex.Translate attribution when Yandex engine is selected. r=felipc --- browser/components/preferences/content.js | 5 +++ browser/components/preferences/content.xul | 12 ++--- .../preferences/in-content/content.js | 5 +++ .../preferences/in-content/content.xul | 14 +++--- .../components/translation/Translation.jsm | 30 +++++++++++-- .../test/browser_translation_yandex.js | 45 +++++++++++++++++++ .../translation/translation-infobar.xml | 22 ++++++--- .../en-US/chrome/browser/translation.dtd | 9 ++++ 8 files changed, 123 insertions(+), 19 deletions(-) diff --git a/browser/components/preferences/content.js b/browser/components/preferences/content.js index 7b78159b9c8..1fe3da35080 100644 --- a/browser/components/preferences/content.js +++ b/browser/components/preferences/content.js @@ -18,6 +18,11 @@ var gContentPane = { if (Services.prefs.getBoolPref(prefName)) { let row = document.getElementById("translationBox"); row.removeAttribute("hidden"); + // Showing attribution only for Bing Translator. + Components.utils.import("resource:///modules/translation/Translation.jsm"); + if (Translation.translationEngine == "bing") { + document.getElementById("bingAttribution").removeAttribute("hidden"); + } } let drmInfoURL = diff --git a/browser/components/preferences/content.xul b/browser/components/preferences/content.xul index e725597ebc4..da0cb1e1151 100644 --- a/browser/components/preferences/content.xul +++ b/browser/components/preferences/content.xul @@ -163,11 +163,13 @@ label="&translateWebPages.label;." accesskey="&translateWebPages.accesskey;" onsyncfrompreference="return gContentPane.updateButtons('translateButton', 'browser.translation.detectLanguage');"/> - - - +