From 3e994206e0c2d0f897b8d38684337abd4289fc1e Mon Sep 17 00:00:00 2001 From: Jan Henning Date: Mon, 8 May 2017 21:51:34 +0200 Subject: [PATCH 001/111] Bug 1363074 - Part 1 - Clarify meaning of "isExternalURL" variable during session restore. r=walkingice MozReview-Commit-ID: JnUiPSiqEhd --HG-- extra : rebase_source : b66b395271bff0c33585789eb87116bca2d4d864 --- .../base/java/org/mozilla/gecko/GeckoApp.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java index 44d575834d59..277c87e9e059 100644 --- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java +++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java @@ -229,7 +229,7 @@ public abstract class GeckoApp private static final class LastSessionParser extends SessionParser { private JSONArray tabs; private JSONObject windowObject; - private boolean isExternalURL; + private boolean loadingExternalURL; private int selectedTabId = INVALID_TAB_ID; @@ -239,10 +239,14 @@ public abstract class GeckoApp private SparseIntArray tabIdMap; - public LastSessionParser(JSONArray tabs, JSONObject windowObject, boolean isExternalURL) { + /** + * @param loadingExternalURL Pass true if we're going to open an additional tab to load an + * URL received through our launch intent. + */ + public LastSessionParser(JSONArray tabs, JSONObject windowObject, boolean loadingExternalURL) { this.tabs = tabs; this.windowObject = windowObject; - this.isExternalURL = isExternalURL; + this.loadingExternalURL = loadingExternalURL; tabIdMap = new SparseIntArray(); } @@ -293,7 +297,7 @@ public abstract class GeckoApp JSONObject tabObject = sessionTab.getTabObject(); int flags = Tabs.LOADURL_NEW_TAB; - flags |= ((isExternalURL || !sessionTab.isSelected()) ? Tabs.LOADURL_DELAY_LOAD : 0); + flags |= ((loadingExternalURL || !sessionTab.isSelected()) ? Tabs.LOADURL_DELAY_LOAD : 0); flags |= (tabObject.optBoolean("desktopMode") ? Tabs.LOADURL_DESKTOP : 0); flags |= (tabObject.optBoolean("isPrivate") ? Tabs.LOADURL_PRIVATE : 0); From d5d0cff6cff916209784e35f0e8f9cb70a824f9b Mon Sep 17 00:00:00 2001 From: Jan Henning Date: Mon, 8 May 2017 21:55:07 +0200 Subject: [PATCH 002/111] Bug 1363074 - Part 2 - When skipping the selected tab during session restore, don't select a replacement if we're also opening an URL from our launch intent. r=walkingice When starting up, ideally we want to only load the foreground tab, with all other tabs being created as delay-loaded "zombie" tabs that occupy minimal resources. To that extent, when restoring the previous session we need to know whether we're planning to open an additional, external tab for a URL received through the launch intent later on. If we do, we don't want to select any tab while restoring the previous session, as that selection is going to be overridden by the external tab anyway. Not selecting a tab from the previous session at this stage means that it can remain as a delay-loaded tab until it is eventually selected by the user. MozReview-Commit-ID: 1lWnOx0ZuNl --HG-- extra : rebase_source : 03a286ec3e1c66856d2ffb526cd4277c89b29594 --- mobile/android/base/java/org/mozilla/gecko/GeckoApp.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java index 277c87e9e059..676417e67d61 100644 --- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java +++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java @@ -277,7 +277,7 @@ public abstract class GeckoApp // always restore about:home only tabs then we'd never open the homepage. // See bug 1261008. - if (sessionTab.isSelected()) { + if (!loadingExternalURL && sessionTab.isSelected()) { // Unfortunately this tab is the selected tab. Let's just try to select // the first tab. If we haven't restored any tabs so far then remember // to select the next tab that gets restored. From bc7b6779e46fa9f4b7083d3817da0516fac2085f Mon Sep 17 00:00:00 2001 From: Gerald Squelart Date: Tue, 9 May 2017 14:40:11 +1200 Subject: [PATCH 003/111] Bug 1356138 - Backout bug 1337063 (Msg_GetGraphicsDeviceInitData opt) for Talos regression - r=dvander MozReview-Commit-ID: LS1Gg1HRwKo --HG-- extra : rebase_source : 8b20bc37b20feac4c0b590c8b286a9ee834646e2 --- dom/ipc/ContentChild.cpp | 6 +++--- dom/ipc/ContentChild.h | 2 +- dom/ipc/ContentParent.cpp | 2 -- dom/ipc/PContent.ipdl | 1 - gfx/ipc/D3DMessageUtils.cpp | 6 ++++-- gfx/thebes/gfxPlatform.cpp | 22 ---------------------- gfx/thebes/gfxPlatform.h | 6 ------ 7 files changed, 8 insertions(+), 37 deletions(-) diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 7dced323eab0..e2be64110ad8 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -524,7 +524,7 @@ ContentChild::RecvSetXPCOMProcessAttributes(const XPCOMInitData& aXPCOMInit, { mLookAndFeelCache = aLookAndFeelIntCache; InitXPCOM(aXPCOMInit, aInitialData); - InitGraphicsDeviceData(aXPCOMInit.contentDeviceData()); + InitGraphicsDeviceData(); #ifdef NS_PRINTING // Force the creation of the nsPrintingProxy so that it's IPC counterpart, @@ -955,11 +955,11 @@ ContentChild::AppendProcessId(nsACString& aName) } void -ContentChild::InitGraphicsDeviceData(const ContentDeviceData& aData) +ContentChild::InitGraphicsDeviceData() { // Initialize the graphics platform. This may contact the parent process // to read device preferences. - gfxPlatform::InitChild(aData); + gfxPlatform::GetPlatform(); } void diff --git a/dom/ipc/ContentChild.h b/dom/ipc/ContentChild.h index 2e5bc318fccb..d36f75981f83 100644 --- a/dom/ipc/ContentChild.h +++ b/dom/ipc/ContentChild.h @@ -104,7 +104,7 @@ public: void InitXPCOM(const XPCOMInitData& aXPCOMInit, const mozilla::dom::ipc::StructuredCloneData& aInitialData); - void InitGraphicsDeviceData(const ContentDeviceData& aData); + void InitGraphicsDeviceData(); static ContentChild* GetSingleton() { diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index d32479aa4a0c..3a3c304fda30 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -2224,8 +2224,6 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority, SerializeURI(nullptr, xpcomInit.userContentSheetURL()); } - gfxPlatform::GetPlatform()->BuildContentDeviceData(&xpcomInit.contentDeviceData()); - nsCOMPtr gfxInfo = services::GetGfxInfo(); if (gfxInfo) { for (int32_t i = 1; i <= nsIGfxInfo::FEATURE_MAX_VALUE; ++i) { diff --git a/dom/ipc/PContent.ipdl b/dom/ipc/PContent.ipdl index f76827e3efca..2e465ff6b1d3 100644 --- a/dom/ipc/PContent.ipdl +++ b/dom/ipc/PContent.ipdl @@ -269,7 +269,6 @@ struct XPCOMInitData FontFamilyListEntry[] fontFamilies; OptionalURIParams userContentSheetURL; PrefSetting[] prefs; - ContentDeviceData contentDeviceData; GfxInfoFeatureStatus[] gfxFeatureStatus; DataStorageEntry[] dataStorage; nsCString[] appLocales; diff --git a/gfx/ipc/D3DMessageUtils.cpp b/gfx/ipc/D3DMessageUtils.cpp index 30a2b88734b3..f3895fdae95c 100644 --- a/gfx/ipc/D3DMessageUtils.cpp +++ b/gfx/ipc/D3DMessageUtils.cpp @@ -47,6 +47,8 @@ ParamTraits::Write(Message* aMsg, const paramType& aParam) WriteParam(aMsg, aParam.SharedSystemMemory); WriteParam(aMsg, aParam.AdapterLuid.LowPart); WriteParam(aMsg, aParam.AdapterLuid.HighPart); +#else + MOZ_ASSERT_UNREACHABLE("DxgiAdapterDesc is Windows-only"); #endif } @@ -70,10 +72,10 @@ ParamTraits::Read(const Message* aMsg, PickleIterator* aIter, p { return true; } - return false; #else - return true; + MOZ_ASSERT_UNREACHABLE("DxgiAdapterDesc is Windows-only"); #endif + return false; } } // namespace IPC diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index ae66945956f9..6650cb034457 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -152,8 +152,6 @@ using namespace mozilla::gfx; gfxPlatform *gPlatform = nullptr; static bool gEverInitialized = false; -const ContentDeviceData* gContentDeviceInitData = nullptr; - static Mutex* gGfxPlatformPrefsLock = nullptr; // These two may point to the same profile @@ -529,8 +527,6 @@ gfxPlatform* gfxPlatform::GetPlatform() { if (!gPlatform) { - MOZ_RELEASE_ASSERT(!XRE_IsContentProcess(), - "Content Process should have called InitChild() before first GetPlatform()"); Init(); } return gPlatform; @@ -542,19 +538,6 @@ gfxPlatform::Initialized() return !!gPlatform; } -/* static */ void -gfxPlatform::InitChild(const ContentDeviceData& aData) -{ - MOZ_ASSERT(XRE_IsContentProcess()); - MOZ_RELEASE_ASSERT(!gPlatform, - "InitChild() should be called before first GetPlatform()"); - // Make the provided initial ContentDeviceData available to the init - // routines, so they don't have to do a sync request from the parent. - gContentDeviceInitData = &aData; - Init(); - gContentDeviceInitData = nullptr; -} - void RecordingPrefChanged(const char *aPrefName, void *aClosure) { if (Preferences::GetBool("gfx.2d.recording", false)) { @@ -2677,11 +2660,6 @@ gfxPlatform::FetchAndImportContentDeviceData() { MOZ_ASSERT(XRE_IsContentProcess()); - if (gContentDeviceInitData) { - ImportContentDeviceData(*gContentDeviceInitData); - return; - } - mozilla::dom::ContentChild* cc = mozilla::dom::ContentChild::GetSingleton(); mozilla::gfx::ContentDeviceData data; diff --git a/gfx/thebes/gfxPlatform.h b/gfx/thebes/gfxPlatform.h index c5de447f40e3..2e0615b18696 100644 --- a/gfx/thebes/gfxPlatform.h +++ b/gfx/thebes/gfxPlatform.h @@ -175,12 +175,6 @@ public: */ static void Shutdown(); - /** - * Initialize gfxPlatform (if not already done) in a child process, with - * the provided ContentDeviceData. - */ - static void InitChild(const mozilla::gfx::ContentDeviceData& aData); - static void InitLayersIPC(); static void ShutdownLayersIPC(); From ad1d261fede33659afdd6ff309df6172d2ee181d Mon Sep 17 00:00:00 2001 From: Julian Descottes Date: Mon, 8 May 2017 22:42:10 +0200 Subject: [PATCH 004/111] Bug 1363100 - change aboutdebugging links text to "Learn more";r=flod,ochameau MozReview-Commit-ID: jOWDb17tsv --HG-- extra : rebase_source : 6cdf4a4d54a817a99367d8cf5535746142944429 --- .../client/aboutdebugging/aboutdebugging.css | 1 + .../components/addons/controls.js | 7 ++-- .../aboutdebugging/components/addons/panel.js | 5 ++- .../components/workers/panel.js | 14 +++++--- .../locales/en-US/aboutdebugging.properties | 33 +++++++++++++++---- 5 files changed, 41 insertions(+), 19 deletions(-) diff --git a/devtools/client/aboutdebugging/aboutdebugging.css b/devtools/client/aboutdebugging/aboutdebugging.css index 817876e5ce17..cc28c35f3d6e 100644 --- a/devtools/client/aboutdebugging/aboutdebugging.css +++ b/devtools/client/aboutdebugging/aboutdebugging.css @@ -197,6 +197,7 @@ button { flex: 1; } +.service-worker-disabled-label, .addons-debugging-label, .addons-web-ext-tip { display: inline-block; diff --git a/devtools/client/aboutdebugging/components/addons/controls.js b/devtools/client/aboutdebugging/components/addons/controls.js index d5d67bc47956..3485bd252826 100644 --- a/devtools/client/aboutdebugging/components/addons/controls.js +++ b/devtools/client/aboutdebugging/components/addons/controls.js @@ -83,11 +83,10 @@ module.exports = createClass({ className: "addons-debugging-label", htmlFor: "enable-addon-debugging", title: Strings.GetStringFromName("addonDebugging.tooltip") - }, Strings.GetStringFromName("addonDebugging.label")), - "(", + }, Strings.GetStringFromName("addonDebugging.label2")), dom.a({ href: MORE_INFO_URL, target: "_blank" }, - Strings.GetStringFromName("moreInfo")), - ")" + Strings.GetStringFromName("addonDebugging.learnMore") + ), ), dom.button({ id: "load-addon-from-file", diff --git a/devtools/client/aboutdebugging/components/addons/panel.js b/devtools/client/aboutdebugging/components/addons/panel.js index 1bd6c126f865..fd75714931ca 100644 --- a/devtools/client/aboutdebugging/components/addons/panel.js +++ b/devtools/client/aboutdebugging/components/addons/panel.js @@ -157,10 +157,9 @@ module.exports = createClass({ dom.span({ className: "addons-web-ext-tip", }, Strings.GetStringFromName("webExtTip")), - "(", dom.a({ href: WEB_EXT_URL, target: "_blank" }, - Strings.GetStringFromName("moreInfo")), - ")" + Strings.GetStringFromName("webExtTip.learnMore") + ) ) ), dom.div({ id: "addons" }, diff --git a/devtools/client/aboutdebugging/components/workers/panel.js b/devtools/client/aboutdebugging/components/workers/panel.js index 4035911bcf44..d2c13629b26e 100644 --- a/devtools/client/aboutdebugging/components/workers/panel.js +++ b/devtools/client/aboutdebugging/components/workers/panel.js @@ -29,7 +29,8 @@ const Strings = Services.strings.createBundle( "chrome://devtools/locale/aboutdebugging.properties"); const WorkerIcon = "chrome://devtools/skin/images/debugging-workers.svg"; -const MORE_INFO_URL = "https://developer.mozilla.org/en-US/docs/Tools/about%3Adebugging"; +const MORE_INFO_URL = "https://developer.mozilla.org/en-US/docs/Tools/about%3Adebugging" + + "#Service_workers_not_compatible"; const PROCESS_COUNT_PREF = "dom.ipc.processCount"; const MULTI_OPTOUT_PREF = "dom.ipc.multiOptOut"; @@ -185,16 +186,19 @@ module.exports = createClass({ className: "service-worker-disabled" }, dom.div({ className: "warning" }), - Strings.GetStringFromName("configurationIsNotCompatible"), - " (", + dom.span( + { + className: "service-worker-disabled-label", + }, + Strings.GetStringFromName("configurationIsNotCompatible.label") + ), dom.a( { href: MORE_INFO_URL, target: "_blank" }, - Strings.GetStringFromName("moreInfo") + Strings.GetStringFromName("configurationIsNotCompatible.learnMore") ), - ")" ); }, diff --git a/devtools/client/locales/en-US/aboutdebugging.properties b/devtools/client/locales/en-US/aboutdebugging.properties index b2ee9624f319..9ed5dd91934b 100644 --- a/devtools/client/locales/en-US/aboutdebugging.properties +++ b/devtools/client/locales/en-US/aboutdebugging.properties @@ -37,20 +37,21 @@ notListeningForFetchEvents = Not listening for fetch events. # This string is displayed as a header of the about:debugging#addons page. addons = Add-ons -# LOCALIZATION NOTE (addonDebugging.label): +# LOCALIZATION NOTE (addonDebugging.label2): # This string is displayed next to a check box that enables the user to switch # addon debugging on/off. -addonDebugging.label = Enable add-on debugging +addonDebugging.label2 = Enable add-on debugging. # LOCALIZATION NOTE (addonDebugging.tooltip): # This string is displayed in a tooltip that appears when hovering over a check # box that switches addon debugging on/off. addonDebugging.tooltip = Turning this on will allow you to debug add-ons and various other parts of the browser chrome -# LOCALIZATION NOTE (moreInfo): -# This string is displayed next to addonDebugging.label as a link to a page -# with documentation. -moreInfo = more info +# LOCALIZATION NOTE (addonDebugging.learnMore): +# This string is displayed as a link next to addonDebugging.label and leads the user to +# the MDN documentation page for about:debugging. +# (https://developer.mozilla.org/docs/Tools/about:debugging#Enabling_add-on_debugging) +addonDebugging.learnMore = Learn more # LOCALIZATION NOTE (loadTemporaryAddon): # This string is displayed as a label of a button that allows the user to @@ -67,8 +68,15 @@ temporaryExtensions = Temporary Extensions # LOCALIZATION NOTE (webExtTip): # This string is displayed as a message below the list of temporarily loaded add-ons. +# Web-ext is a command line tool for web-extensions developers. +# See https://developer.mozilla.org/Add-ons/WebExtensions/Getting_started_with_web-ext webExtTip = You can use web-ext to load temporary WebExtensions from the command line. +# LOCALIZATION NOTE (webExtTip.learnMore): +# This string is displayed as a link next to webExtTip and leads the user to the MDN +# documentation page for web-ext. +# (https://developer.mozilla.org/Add-ons/WebExtensions/Getting_started_with_web-ext) +webExtTip.learnMore = Learn more # LOCALIZATION NOTE (selectAddonFromFile2): # This string is displayed as the title of the file picker that appears when @@ -127,7 +135,18 @@ doesNotExist = #%S does not exist! # This string is displayed when the list of workers is empty. nothing = Nothing yet. -configurationIsNotCompatible = Your browser configuration is not compatible with Service Workers +# LOCALIZATION NOTE (configurationIsNotCompatible.label): +# This string is displayed in about:debugging#workers if the current configuration of the +# browser is incompatible with service workers. More details at +# https://developer.mozilla.org/en-US/docs/Tools/about%3Adebugging#Service_workers_not_compatible +configurationIsNotCompatible.label = Your browser configuration is not compatible with Service Workers. + +# LOCALIZATION NOTE (configurationIsNotCompatible.learnMore): +# This string is displayed as a link next to configurationIsNotCompatible.label and leads +# the user to the MDN documentation page for about:debugging, on the section explaining +# why service workers might not be available. +# (https://developer.mozilla.org/en-US/docs/Tools/about%3Adebugging#Service_workers_not_compatible) +configurationIsNotCompatible.learnMore = Learn more # LOCALIZATION NOTE (multiProcessWarningTitle): # This string is displayed as a warning message on top of the about:debugging#workers From 1c354cb585b945a0a3e65669f28b2872e5472e68 Mon Sep 17 00:00:00 2001 From: James Graham Date: Sun, 7 May 2017 00:20:43 +0100 Subject: [PATCH 005/111] Bug 1362811 - Don't require REFTEST prefix in unstructured reftest analyzer, r=dbaron This prefix can't be produced by the standard structured logging formatters because it doesn't know that the tests are reftests. Therefore the reftest harness has a hack to add this prefix, and the unstructured analyzer doesn't work with wpt reftests. This can simply be solved by making the prefix optional, but looking for the "INFO - " prefix that mozharness adds, when present, to identify the start of the TEST- string. MozReview-Commit-ID: GxWVWOSkAUZ --HG-- extra : rebase_source : fbd8afa860da0fba4925b6bf2fc715cbf6c2688c --- layout/tools/reftest/reftest-analyzer.xhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout/tools/reftest/reftest-analyzer.xhtml b/layout/tools/reftest/reftest-analyzer.xhtml index 0b57d2bca42c..aad5cb482a8c 100644 --- a/layout/tools/reftest/reftest-analyzer.xhtml +++ b/layout/tools/reftest/reftest-analyzer.xhtml @@ -223,7 +223,7 @@ function process_log(contents) { // Ignore duplicated output in logcat. if (line.match(/I\/Gecko.*?REFTEST/)) continue; - var match = line.match(/^.*?REFTEST (.*)$/); + var match = line.match(/^(?:.*? INFO - )?(?:REFTEST )?(.*)$/); if (!match) continue; line = match[1]; From f0cabce9415180d757d085e32906b5e388735471 Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Tue, 25 Apr 2017 15:28:31 +0200 Subject: [PATCH 006/111] Bug 1357040: P1. Abort if demuxer initialisation isn't complete. r=jwwang MozReview-Commit-ID: 9SSgQq272My --HG-- extra : rebase_source : a9d0abfaefaf2861dfca58b328fdef46505a7aaf --- dom/media/MediaFormatReader.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp index 69a8b73e8d26..bb2c1d0e77ca 100644 --- a/dom/media/MediaFormatReader.cpp +++ b/dom/media/MediaFormatReader.cpp @@ -2898,9 +2898,7 @@ MediaFormatReader::NotifyDataArrived() { MOZ_ASSERT(OnTaskQueue()); - if (mShutdown - || !mDemuxer - || (!mDemuxerInitDone && !mDemuxerInitRequest.Exists())) { + if (mShutdown || !mDemuxer || !mDemuxerInitDone) { return; } From ab282a14d4c10482df0f2b039dd963b42a754de4 Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Thu, 27 Apr 2017 19:53:53 +0200 Subject: [PATCH 007/111] Bug 1357040: P2. Don't rely on NotifyDataArrived to resolve MSE init promise. r=gerald MozReview-Commit-ID: KUxVqfU9umw --HG-- extra : rebase_source : c6f11109490fbb6fbfbda1b0fe2be1c8088ca4a2 --- dom/media/mediasource/MediaSourceDecoder.cpp | 10 ++++++++++ dom/media/mediasource/MediaSourceDecoder.h | 2 ++ dom/media/mediasource/MediaSourceDemuxer.cpp | 19 +++++++++---------- dom/media/mediasource/MediaSourceDemuxer.h | 3 +-- dom/media/mediasource/SourceBuffer.cpp | 1 + 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/dom/media/mediasource/MediaSourceDecoder.cpp b/dom/media/mediasource/MediaSourceDecoder.cpp index 7df293717bb9..a59904b9e93f 100644 --- a/dom/media/mediasource/MediaSourceDecoder.cpp +++ b/dom/media/mediasource/MediaSourceDecoder.cpp @@ -353,6 +353,16 @@ MediaSourceDecoder::ClampIntervalToEnd(const TimeInterval& aInterval) aInterval.mFuzz); } +void +MediaSourceDecoder::NotifyInitDataArrived() +{ + MOZ_ASSERT(NS_IsMainThread()); + + if (mDemuxer) { + mDemuxer->NotifyInitDataArrived(); + } +} + #undef MSE_DEBUG #undef MSE_DEBUGV diff --git a/dom/media/mediasource/MediaSourceDecoder.h b/dom/media/mediasource/MediaSourceDecoder.h index 8139d35989f0..f0070da74ea4 100644 --- a/dom/media/mediasource/MediaSourceDecoder.h +++ b/dom/media/mediasource/MediaSourceDecoder.h @@ -78,6 +78,8 @@ public: bool IsMSE() const override { return true; } + void NotifyInitDataArrived(); + private: void DoSetMediaSourceDuration(double aDuration); media::TimeInterval ClampIntervalToEnd(const media::TimeInterval& aInterval); diff --git a/dom/media/mediasource/MediaSourceDemuxer.cpp b/dom/media/mediasource/MediaSourceDemuxer.cpp index 68c3acede3c9..5bd4395057b0 100644 --- a/dom/media/mediasource/MediaSourceDemuxer.cpp +++ b/dom/media/mediasource/MediaSourceDemuxer.cpp @@ -66,18 +66,17 @@ MediaSourceDemuxer::AddSizeOfResources( GetTaskQueue()->Dispatch(task.forget()); } -void MediaSourceDemuxer::NotifyDataArrived() +void MediaSourceDemuxer::NotifyInitDataArrived() { RefPtr self = this; - nsCOMPtr task = - NS_NewRunnableFunction([self] () { - if (self->mInitPromise.IsEmpty()) { - return; - } - if (self->ScanSourceBuffersForContent()) { - self->mInitPromise.ResolveIfExists(NS_OK, __func__); - } - }); + nsCOMPtr task = NS_NewRunnableFunction([self]() { + if (self->mInitPromise.IsEmpty()) { + return; + } + if (self->ScanSourceBuffersForContent()) { + self->mInitPromise.ResolveIfExists(NS_OK, __func__); + } + }); GetTaskQueue()->Dispatch(task.forget()); } diff --git a/dom/media/mediasource/MediaSourceDemuxer.h b/dom/media/mediasource/MediaSourceDemuxer.h index 74244df606bb..880435a153ff 100644 --- a/dom/media/mediasource/MediaSourceDemuxer.h +++ b/dom/media/mediasource/MediaSourceDemuxer.h @@ -44,12 +44,11 @@ public: bool ShouldComputeStartTime() const override { return false; } - void NotifyDataArrived() override; - /* interface for TrackBuffersManager */ void AttachSourceBuffer(TrackBuffersManager* aSourceBuffer); void DetachSourceBuffer(TrackBuffersManager* aSourceBuffer); AutoTaskQueue* GetTaskQueue() { return mTaskQueue; } + void NotifyInitDataArrived(); // Returns a string describing the state of the MediaSource internal // buffered data. Used for debugging purposes. diff --git a/dom/media/mediasource/SourceBuffer.cpp b/dom/media/mediasource/SourceBuffer.cpp index 166d0fc62aa5..20b62d1a8bd5 100644 --- a/dom/media/mediasource/SourceBuffer.cpp +++ b/dom/media/mediasource/SourceBuffer.cpp @@ -434,6 +434,7 @@ SourceBuffer::AppendDataCompletedWithSuccess(const SourceBufferTask::AppendBuffe if (!mActive) { mActive = true; mMediaSource->SourceBufferIsActive(this); + mMediaSource->GetDecoder()->NotifyInitDataArrived(); } } if (mActive) { From c28f35b424b0bba7ddf6868c79b373fd7876e424 Mon Sep 17 00:00:00 2001 From: btian Date: Tue, 9 May 2017 11:39:27 +0800 Subject: [PATCH 008/111] Bug 1351795 - part 1: Remove console.timeline and timelineEnd. r=baku MozReview-Commit-ID: DLoqGD5NDwt --HG-- extra : rebase_source : 43b55175f9ba1671e8269a227078e205581c8f1c --- addon-sdk/source/lib/sdk/content/sandbox.js | 2 -- .../mochitest/general/test_consoleAPI.html | 2 -- dom/webidl/Console.webidl | 4 ---- ...e-timeline-timelineEnd-historical.any.js.ini | 17 ----------------- 4 files changed, 25 deletions(-) delete mode 100644 testing/web-platform/meta/console/console-timeline-timelineEnd-historical.any.js.ini diff --git a/addon-sdk/source/lib/sdk/content/sandbox.js b/addon-sdk/source/lib/sdk/content/sandbox.js index a984e827dd1a..cb88f4b725dc 100644 --- a/addon-sdk/source/lib/sdk/content/sandbox.js +++ b/addon-sdk/source/lib/sdk/content/sandbox.js @@ -260,8 +260,6 @@ const WorkerSandbox = Class({ clear: genPropDesc('clear'), dirxml: genPropDesc('dirxml'), markTimeline: genPropDesc('markTimeline'), - timeline: genPropDesc('timeline'), - timelineEnd: genPropDesc('timelineEnd'), timeStamp: genPropDesc('timeStamp'), }; diff --git a/dom/tests/mochitest/general/test_consoleAPI.html b/dom/tests/mochitest/general/test_consoleAPI.html index 53c06ce57944..07b129f6fe5b 100644 --- a/dom/tests/mochitest/general/test_consoleAPI.html +++ b/dom/tests/mochitest/general/test_consoleAPI.html @@ -41,8 +41,6 @@ function doTest() { "clear": "function", "dirxml": "function", "markTimeline": "function", - "timeline": "function", - "timelineEnd": "function", "timeStamp": "function", }; diff --git a/dom/webidl/Console.webidl b/dom/webidl/Console.webidl index da13047342ab..23d62ddd3548 100644 --- a/dom/webidl/Console.webidl +++ b/dom/webidl/Console.webidl @@ -46,10 +46,6 @@ namespace console { // No-op methods for compatibility with other browsers. [BinaryName="noopMethod"] void markTimeline(); - [BinaryName="noopMethod"] - void timeline(); - [BinaryName="noopMethod"] - void timelineEnd(); [ChromeOnly] const boolean IS_NATIVE_CONSOLE = true; diff --git a/testing/web-platform/meta/console/console-timeline-timelineEnd-historical.any.js.ini b/testing/web-platform/meta/console/console-timeline-timelineEnd-historical.any.js.ini deleted file mode 100644 index 9aa180ea5df8..000000000000 --- a/testing/web-platform/meta/console/console-timeline-timelineEnd-historical.any.js.ini +++ /dev/null @@ -1,17 +0,0 @@ -[console-timeline-timelineEnd-historical.any.worker.html] - type: testharness - ['timeline' function should not exist on the console object] - expected: FAIL - - ['timelineEnd' function should not exist on the console object] - expected: FAIL - - -[console-timeline-timelineEnd-historical.any.html] - type: testharness - ['timeline' function should not exist on the console object] - expected: FAIL - - ['timelineEnd' function should not exist on the console object] - expected: FAIL - From bc058622e685b0cdc547c31ff010767598a446e9 Mon Sep 17 00:00:00 2001 From: btian Date: Tue, 9 May 2017 15:34:18 +0800 Subject: [PATCH 009/111] Bug 1351795 - part 2: Remove console.markTimeline. r=baku MozReview-Commit-ID: EmbscFp9oD4 --HG-- extra : rebase_source : 3f620c05faf82731d384dfca369db62ae8eb871e --- addon-sdk/source/lib/sdk/content/sandbox.js | 1 - .../webgl-conf/checkout/deqp/temp_externs/webkit_dom.js | 5 ----- dom/console/Console.cpp | 6 ------ dom/console/Console.h | 3 --- dom/tests/mochitest/general/test_consoleAPI.html | 1 - dom/webidl/Console.webidl | 4 ---- testing/marionette/atom.js | 2 +- 7 files changed, 1 insertion(+), 21 deletions(-) diff --git a/addon-sdk/source/lib/sdk/content/sandbox.js b/addon-sdk/source/lib/sdk/content/sandbox.js index cb88f4b725dc..3cc06fdb2aa7 100644 --- a/addon-sdk/source/lib/sdk/content/sandbox.js +++ b/addon-sdk/source/lib/sdk/content/sandbox.js @@ -259,7 +259,6 @@ const WorkerSandbox = Class({ table: genPropDesc('table'), clear: genPropDesc('clear'), dirxml: genPropDesc('dirxml'), - markTimeline: genPropDesc('markTimeline'), timeStamp: genPropDesc('timeStamp'), }; diff --git a/dom/canvas/test/webgl-conf/checkout/deqp/temp_externs/webkit_dom.js b/dom/canvas/test/webgl-conf/checkout/deqp/temp_externs/webkit_dom.js index da8c8fdde978..35b562c1f727 100644 --- a/dom/canvas/test/webgl-conf/checkout/deqp/temp_externs/webkit_dom.js +++ b/dom/canvas/test/webgl-conf/checkout/deqp/temp_externs/webkit_dom.js @@ -157,11 +157,6 @@ Console.prototype.trace = function() {}; */ Console.prototype.count = function(value) {}; -/** - * @param {*} value - */ -Console.prototype.markTimeline = function(value) {}; - /** * @param {string=} opt_title */ diff --git a/dom/console/Console.cpp b/dom/console/Console.cpp index 375621bc925f..47855dd7b083 100644 --- a/dom/console/Console.cpp +++ b/dom/console/Console.cpp @@ -1120,12 +1120,6 @@ Console::Count(const GlobalObject& aGlobal, const nsAString& aLabel) StringMethod(aGlobal, aLabel, MethodCount, NS_LITERAL_STRING("count")); } -/* static */ void -Console::NoopMethod(const GlobalObject& aGlobal) -{ - // Nothing to do. -} - namespace { nsresult diff --git a/dom/console/Console.h b/dom/console/Console.h index 711c40394805..b66eea17a8e0 100644 --- a/dom/console/Console.h +++ b/dom/console/Console.h @@ -112,9 +112,6 @@ public: static void Clear(const GlobalObject& aGlobal); - static void - NoopMethod(const GlobalObject& aGlobal); - void ClearStorage(); diff --git a/dom/tests/mochitest/general/test_consoleAPI.html b/dom/tests/mochitest/general/test_consoleAPI.html index 07b129f6fe5b..ed9c84f8957a 100644 --- a/dom/tests/mochitest/general/test_consoleAPI.html +++ b/dom/tests/mochitest/general/test_consoleAPI.html @@ -40,7 +40,6 @@ function doTest() { "table": "function", "clear": "function", "dirxml": "function", - "markTimeline": "function", "timeStamp": "function", }; diff --git a/dom/webidl/Console.webidl b/dom/webidl/Console.webidl index 23d62ddd3548..f278f1565f06 100644 --- a/dom/webidl/Console.webidl +++ b/dom/webidl/Console.webidl @@ -43,10 +43,6 @@ namespace console { void profile(any... data); void profileEnd(any... data); - // No-op methods for compatibility with other browsers. - [BinaryName="noopMethod"] - void markTimeline(); - [ChromeOnly] const boolean IS_NATIVE_CONSOLE = true; }; diff --git a/testing/marionette/atom.js b/testing/marionette/atom.js index d9cacb0f4e33..c553e1823e24 100644 --- a/testing/marionette/atom.js +++ b/testing/marionette/atom.js @@ -63,7 +63,7 @@ R(ta?{c:92,e:92,opera:220}:sa?{c:224,e:93,opera:17}:{c:0,e:92,opera:k});R(ta?{c: R({c:109,e:109,opera:xa?109:45},"-");R({c:110,e:110,opera:xa?190:78},".");R({c:111,e:111,opera:xa?191:47},"/");R(144);R(112);R(113);R(114);R(115);R(116);R(117);R(118);R(119);R(120);R(121);R(122);R(123);R({c:107,e:187,opera:61},"=","+");R({c:109,e:189,opera:109},"-","_");R(188,",","<");R(190,".",">");R(191,"/","?");R(192,"`","~");R(219,"[","{");R(220,"\\","|");R(221,"]","}");R({c:59,e:186,opera:59},";",":");R(222,"'",'"');lc.prototype.X=function (a){return this.Ha.contains(a)};function oc(a){return pc(a||arguments.callee.caller,[])} function pc(a,b){var c=[];if(0<=A(b,a))c.push("[...circular reference...]");else if(a&&50>b.length){c.push(qc(a)+"(");for(var d=a.arguments,e=0;e=xc(this).value){a=this.Ca(a,b,c);b="log:"+a.Fa;q.console&&(q.console.timeStamp?q.console.timeStamp(b):q.console.markTimeline&&q.console.markTimeline(b));q.msWriteProfilerMark&&q.msWriteProfilerMark(b);for(b=this;b;){var c=b,d=a;if(c.ra)for(var e=0,f=h;f=c.ra[e];e++)f(d);b=b.getParent()}}}; +S.prototype.log=function (a,b,c){if(a.value>=xc(this).value){a=this.Ca(a,b,c);b="log:"+a.Fa;q.console&&q.console.timeStamp&&q.console.timeStamp(b);q.msWriteProfilerMark&&q.msWriteProfilerMark(b);for(b=this;b;){var c=b,d=a;if(c.ra)for(var e=0,f=h;f=c.ra[e];e++)f(d);b=b.getParent()}}}; S.prototype.Ca=function (a,b,c){var d=new sc(a,""+b,this.Ga);if(c){d.oa=c;var e;var f=arguments.callee.caller;try{var j;var m;c:{for(var s=["window","location","href"],O=q,E;E=s.shift();)if(O[E]!=k)O=O[E];else{m=k;break c}m=O}if(t(c))j={message:c,name:"Unknown error",lineNumber:"Not available",fileName:m,stack:"Not available"};else{var u,v,s=l;try{u=c.lineNumber||c.Ma||"Not available"}catch(md){u="Not available",s=i}try{v=c.fileName||c.filename||c.sourceURL||m}catch(nd){v="Not available",s=i}j=s|| !c.lineNumber||!c.fileName||!c.stack?{message:c.message,name:c.name,lineNumber:u,fileName:v,stack:c.stack||"Not available"}:c}e="Message: "+ia(j.message)+'\nUrl: '+j.fileName+"\nLine: "+j.lineNumber+"\n\nBrowser stack:\n"+ia(j.stack+"-> ")+"[end]\n\nJS stack traversal:\n"+ia(oc(f)+"-> ")}catch(kd){e="Exception trying to expose exception! You win, we lose. "+kd}d.na=e}return d};var yc={},zc=k; function Ac(a){zc||(zc=new S(""),yc[""]=zc,zc.va(wc));var b;if(!(b=yc[a])){b=new S(a);var c=a.lastIndexOf("."),d=a.substr(c+1),c=Ac(a.substr(0,c));c.ba||(c.ba={});c.ba[d]=b;b.Y=c;yc[a]=b}return b};function Bc(){}x(Bc,function(){});Ac("goog.dom.SavedRange");x(function (a){this.Ja="goog_"+pa++;this.Aa="goog_"+pa++;this.la=Wa(a.ea());a.R(this.la.da("SPAN",{id:this.Ja}),this.la.da("SPAN",{id:this.Aa}))},Bc);function T(){}function Cc(a){if(a.getSelection)return a.getSelection();var a=a.document,b=a.selection;if(b){try{var c=b.createRange();if(c.parentElement){if(c.parentElement().document!=a)return k}else if(!c.length||c.item(0).document!=a)return k}catch(d){return k}return b}return k}function Dc(a){for(var b=[],c=0,d=a.D();c Date: Thu, 4 May 2017 16:34:20 +0800 Subject: [PATCH 010/111] Bug 1353159 - Use IPC_MESSAGE_SIZE2 to unify the expired IPC_MESSAGE_SIZE and MESSAGE_MANAGER_MESSAGE_SIZE2 r=billm The new telemetry tag is for probing the best IPC message pre-allocate size to avoid realloc overhead. We only count those message size which is greater than 4096. This tag integrates IPC_MESSAGE_SIZE and MESSAGE_MANAGER_MESSAGE_SIZE2 which have both expired. MozReview-Commit-ID: GjvuidGJ7pz --HG-- extra : rebase_source : 1da13b3f2b5b042d0445abd6051993e2fb317f93 --- dom/base/nsFrameMessageManager.cpp | 15 +++---------- ipc/glue/MessageChannel.cpp | 8 +++---- toolkit/components/telemetry/Histograms.json | 23 +++++--------------- 3 files changed, 12 insertions(+), 34 deletions(-) diff --git a/dom/base/nsFrameMessageManager.cpp b/dom/base/nsFrameMessageManager.cpp index 1854e5c1b937..912f25acc7e8 100644 --- a/dom/base/nsFrameMessageManager.cpp +++ b/dom/base/nsFrameMessageManager.cpp @@ -577,18 +577,6 @@ nsFrameMessageManager::SendRpcMessage(const nsAString& aMessageName, static bool AllowMessage(size_t aDataLength, const nsAString& aMessageName) { - static const size_t kMinTelemetryMessageSize = 8192; - - if (aDataLength < kMinTelemetryMessageSize) { - return true; - } - - NS_ConvertUTF16toUTF8 messageName(aMessageName); - messageName.StripChars("0123456789"); - - Telemetry::Accumulate(Telemetry::MESSAGE_MANAGER_MESSAGE_SIZE2, messageName, - aDataLength); - // A message includes more than structured clone data, so subtract // 20KB to make it more likely that a message within this bound won't // result in an overly large IPC message. @@ -597,6 +585,9 @@ AllowMessage(size_t aDataLength, const nsAString& aMessageName) return true; } + NS_ConvertUTF16toUTF8 messageName(aMessageName); + messageName.StripChars("0123456789"); + Telemetry::Accumulate(Telemetry::REJECTED_MESSAGE_MANAGER_MESSAGE, messageName); diff --git a/ipc/glue/MessageChannel.cpp b/ipc/glue/MessageChannel.cpp index 14f8785cb9a5..e16fa387d2c5 100644 --- a/ipc/glue/MessageChannel.cpp +++ b/ipc/glue/MessageChannel.cpp @@ -130,7 +130,7 @@ static MessageChannel* gParentProcessBlocker; namespace mozilla { namespace ipc { -static const uint32_t kMinTelemetryMessageSize = 8192; +static const uint32_t kMinTelemetryMessageSize = 4096; // Note: we round the time we spend to the nearest millisecond. So a min value // of 1 ms actually captures from 500us and above. @@ -873,8 +873,7 @@ bool MessageChannel::Send(Message* aMsg) { if (aMsg->size() >= kMinTelemetryMessageSize) { - Telemetry::Accumulate(Telemetry::IPC_MESSAGE_SIZE, - nsDependentCString(aMsg->name()), aMsg->size()); + Telemetry::Accumulate(Telemetry::IPC_MESSAGE_SIZE2, aMsg->size()); } // If the message was created by the IPC bindings, the create time will be @@ -1294,8 +1293,7 @@ MessageChannel::Send(Message* aMsg, Message* aReply) { mozilla::TimeStamp start = TimeStamp::Now(); if (aMsg->size() >= kMinTelemetryMessageSize) { - Telemetry::Accumulate(Telemetry::IPC_MESSAGE_SIZE, - nsDependentCString(aMsg->name()), aMsg->size()); + Telemetry::Accumulate(Telemetry::IPC_MESSAGE_SIZE2, aMsg->size()); } nsAutoPtr msg(aMsg); diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index 4c5083074c1d..5c369c67660b 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -10737,15 +10737,15 @@ "n_values": 10, "description": "Media decoder backend (0=WMF Software, 1=DXVA2D3D9, 2=DXVA2D3D11)" }, - "IPC_MESSAGE_SIZE": { - "alert_emails": ["wmccloskey@mozilla.com"], - "bug_numbers": [1260908], - "expires_in_version": "55", + "IPC_MESSAGE_SIZE2": { + "alert_emails": ["hchang@mozilla.com"], + "bug_numbers": [1353159], + "expires_in_version": "60", "kind": "exponential", "high": 8000000, "n_buckets": 50, - "keyed": true, - "description": "Measures the size of IPC messages by message name" + "keyed": false, + "description": "Measures the size of all IPC messages sent that are >= 4096 bytes." }, "IPC_REPLY_SIZE": { "alert_emails": ["wmccloskey@mozilla.com"], @@ -10768,17 +10768,6 @@ "keyed": true, "description": "Measures the number of milliseconds we spend waiting for sync IPC messages to finish sending, keyed by message name. Note: only messages that wait for more than 500 microseconds and block the main thread are included in this probe." }, - "MESSAGE_MANAGER_MESSAGE_SIZE2": { - "alert_emails": ["wmccloskey@mozilla.com","amccreight@mozilla.com"], - "bug_numbers": [1260908], - "expires_in_version": "55", - "kind": "exponential", - "low": 8192, - "high": 8000000, - "n_buckets": 50, - "keyed": true, - "description": "Each key is the message name, with digits removed, from an async message manager message that was larger than 8192 bytes, recorded in the sending process at the time of sending." - }, "REJECTED_MESSAGE_MANAGER_MESSAGE": { "alert_emails": ["amccreight@mozilla.com"], "bug_numbers": [1272423], From 3bf914f927b99c0192f20c75bf00297ba504cea6 Mon Sep 17 00:00:00 2001 From: Michael Ratcliffe Date: Fri, 5 May 2017 18:00:57 +0100 Subject: [PATCH 011/111] Bug 1362464 - Fix feedback from Storage Inspector's head.js methods r=pbro MozReview-Commit-ID: G5lOr9bU13B --HG-- extra : rebase_source : 55973b2ecc57e0f7c395fda9fff3046b0dae446d --- devtools/client/storage/test/head.js | 35 ++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/devtools/client/storage/test/head.js b/devtools/client/storage/test/head.js index 1fea5c944f77..ab1c935d9071 100644 --- a/devtools/client/storage/test/head.js +++ b/devtools/client/storage/test/head.js @@ -621,9 +621,8 @@ function getRowCells(id, includeHidden = false) { " .table-widget-cell[value='" + id + "']"); if (!item) { - ok(false, "Row id '" + id + "' exists"); - - showAvailableIds(); + ok(false, `The row id '${id}' that was passed to getRowCells() does not ` + + `exist. ${getAvailableIds()}`); } let index = table.columns.get(table.uniqueId).cellNodes.indexOf(item); @@ -640,18 +639,27 @@ function getRowCells(id, includeHidden = false) { } /** - * Show available ids. + * Get available ids... useful for error reporting. */ -function showAvailableIds() { +function getAvailableIds() { let doc = gPanelWindow.document; let table = gUI.table; - info("Available ids:"); + let out = "Available ids:\n"; let cells = doc.querySelectorAll(".table-widget-column#" + table.uniqueId + " .table-widget-cell"); for (let cell of cells) { - info(" - " + cell.getAttribute("value")); + out += ` - ${cell.getAttribute("value")}\n`; } + + return out; +} + +/** + * Show available ids. + */ +function showAvailableIds() { + info(getAvailableIds); } /** @@ -668,6 +676,19 @@ function showAvailableIds() { function getCellValue(id, column) { let row = getRowValues(id, true); + if (typeof row[column] === "undefined") { + let out = ""; + for (let key in row) { + let value = row[key]; + + out += ` - ${key} = ${value}\n`; + } + + ok(false, `The column name '${column}' that was passed to ` + + `getCellValue() does not exist. Current column names and row ` + + `values are:\n${out}`); + } + return row[column]; } From 7d62f38a7b03ee8da2c2919503f093379c208459 Mon Sep 17 00:00:00 2001 From: Dan Banner Date: Sun, 7 May 2017 16:19:13 +0100 Subject: [PATCH 012/111] Bug 1348521 - Remove unreferenced global/skin/linkTree.css files r=florian MozReview-Commit-ID: DXpi0HbLNIq --HG-- extra : rebase_source : 94e73cdb7b9afdd0a7cf21a66f4e41551d4e1f16 --- .../static/browser_all_files_referenced.js | 2 -- toolkit/themes/osx/global/jar.mn | 1 - toolkit/themes/osx/global/linkTree.css | 32 ------------------- toolkit/themes/shared/non-mac.jar.inc.mn | 2 -- toolkit/themes/windows/global/linkTree.css | 32 ------------------- 5 files changed, 69 deletions(-) delete mode 100644 toolkit/themes/osx/global/linkTree.css delete mode 100644 toolkit/themes/windows/global/linkTree.css diff --git a/browser/base/content/test/static/browser_all_files_referenced.js b/browser/base/content/test/static/browser_all_files_referenced.js index 2b2347f7a7ba..cd993ea86d87 100644 --- a/browser/base/content/test/static/browser_all_files_referenced.js +++ b/browser/base/content/test/static/browser_all_files_referenced.js @@ -189,8 +189,6 @@ var whitelist = new Set([ {file: "chrome://global/skin/icons/warning-64.png", platforms: ["linux", "win"]}, {file: "chrome://global/skin/icons/warning-large.png", platforms: ["linux"]}, {file: "chrome://global/skin/icons/windowControls.png", platforms: ["linux"]}, - // Bug 1348521 - {file: "chrome://global/skin/linkTree.css"}, // Bug 1348522 {file: "chrome://global/skin/media/clicktoplay-bgtexture.png"}, {file: "chrome://global/skin/media/videoClickToPlayButton.svg"}, diff --git a/toolkit/themes/osx/global/jar.mn b/toolkit/themes/osx/global/jar.mn index a18cbffec620..32251e227a72 100644 --- a/toolkit/themes/osx/global/jar.mn +++ b/toolkit/themes/osx/global/jar.mn @@ -20,7 +20,6 @@ toolkit.jar: * skin/classic/global/findBar.css * skin/classic/global/global.css skin/classic/global/groupbox.css - skin/classic/global/linkTree.css skin/classic/global/listbox.css skin/classic/global/menu.css skin/classic/global/menulist.css diff --git a/toolkit/themes/osx/global/linkTree.css b/toolkit/themes/osx/global/linkTree.css deleted file mode 100644 index d83c5bfd9d37..000000000000 --- a/toolkit/themes/osx/global/linkTree.css +++ /dev/null @@ -1,32 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * 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/. */ - -@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); - -/** - * All the properties in this rule are important to avoid having to create - * a special type of tree. This stylesheet can be loaded into a document with - * a single tree that is a link tree. Hardly elegant but it's efficient. - */ -treeitem[selected="true"] > treerow - { - background : transparent !important; - border : none !important; - color : -moz-FieldText !important; - } - -treecell:hover - { - text-decoration : underline !important; - color : #000080 !important; - cursor : pointer; - } - -treecell:hover:active - { - text-decoration : underline !important; - color : red !important; - } - - diff --git a/toolkit/themes/shared/non-mac.jar.inc.mn b/toolkit/themes/shared/non-mac.jar.inc.mn index df130a8d1474..c90f512b98ea 100644 --- a/toolkit/themes/shared/non-mac.jar.inc.mn +++ b/toolkit/themes/shared/non-mac.jar.inc.mn @@ -17,7 +17,6 @@ skin/classic/global/expander.css (../../windows/global/expander.css) skin/classic/global/filefield.css (../../windows/global/filefield.css) skin/classic/global/globalBindings.xml (../../windows/global/globalBindings.xml) - skin/classic/global/linkTree.css (../../windows/global/linkTree.css) skin/classic/global/progressmeter.css (../../windows/global/progressmeter.css) skin/classic/global/resizer.css (../../windows/global/resizer.css) skin/classic/global/richlistbox.css (../../windows/global/richlistbox.css) @@ -125,4 +124,3 @@ % override chrome://mozapps/skin/plugins/notifyPluginCrashed.png chrome://mozapps/skin/plugins/pluginGeneric-16.png % override chrome://mozapps/skin/plugins/notifyPluginGeneric.png chrome://mozapps/skin/plugins/pluginGeneric-16.png % override chrome://mozapps/skin/xpinstall/xpinstallItemGeneric.png chrome://mozapps/skin/extensions/extensionGeneric.png - diff --git a/toolkit/themes/windows/global/linkTree.css b/toolkit/themes/windows/global/linkTree.css deleted file mode 100644 index d83c5bfd9d37..000000000000 --- a/toolkit/themes/windows/global/linkTree.css +++ /dev/null @@ -1,32 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * 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/. */ - -@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); - -/** - * All the properties in this rule are important to avoid having to create - * a special type of tree. This stylesheet can be loaded into a document with - * a single tree that is a link tree. Hardly elegant but it's efficient. - */ -treeitem[selected="true"] > treerow - { - background : transparent !important; - border : none !important; - color : -moz-FieldText !important; - } - -treecell:hover - { - text-decoration : underline !important; - color : #000080 !important; - cursor : pointer; - } - -treecell:hover:active - { - text-decoration : underline !important; - color : red !important; - } - - From eb054662cc4a214cc66489a1616663f61b7d27cb Mon Sep 17 00:00:00 2001 From: Dan Banner Date: Sun, 7 May 2017 15:27:05 +0100 Subject: [PATCH 013/111] Bug 1320156 - Remove leftover Privacy-16.png files. r=florian MozReview-Commit-ID: GXCfNNwiqFf --HG-- extra : rebase_source : 8c296d23d6fb4fb9883cd05a4378f032dcfb0d8d --- .../test/static/browser_all_files_referenced.js | 2 -- browser/themes/linux/Privacy-16.png | Bin 822 -> 0 bytes browser/themes/linux/jar.mn | 1 - browser/themes/osx/Privacy-16.png | Bin 852 -> 0 bytes browser/themes/windows/Privacy-16.png | Bin 789 -> 0 bytes 5 files changed, 3 deletions(-) delete mode 100644 browser/themes/linux/Privacy-16.png delete mode 100644 browser/themes/osx/Privacy-16.png delete mode 100644 browser/themes/windows/Privacy-16.png diff --git a/browser/base/content/test/static/browser_all_files_referenced.js b/browser/base/content/test/static/browser_all_files_referenced.js index cd993ea86d87..efdf2bacfc0d 100644 --- a/browser/base/content/test/static/browser_all_files_referenced.js +++ b/browser/base/content/test/static/browser_all_files_referenced.js @@ -120,8 +120,6 @@ var whitelist = new Set([ // Bug 1339424 (wontfix?) {file: "chrome://browser/locale/taskbar.properties", platforms: ["linux", "macosx"]}, - // Bug 1320156 - {file: "chrome://browser/skin/Privacy-16.png", platforms: ["linux"]}, // Bug 1343584 {file: "chrome://browser/skin/click-to-play-warning-stripes.png"}, // Bug 1343824 diff --git a/browser/themes/linux/Privacy-16.png b/browser/themes/linux/Privacy-16.png deleted file mode 100644 index 013cdc4b9d2ec2b6586d9371dabe2b3d3c50a0b4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 822 zcmV-61Ihe}P)e;xLspA~x+zZ;KaV9x2wm~fm>2wA&6TddBt$h2{ zOYP+?@!h9ZQnS;miMQ~$loIt|2+ap7z&UF5aLGjgQ2-)1_m_o>z$k?vaME?Mr79Q* zAIn*+*YmuZ`ub8&5@>>`0Sy)UB2IUllYagf>vPPl%Y^vc{SA$zYDW~3x{Su=mZHxi z=wV_0prPNwpij{@{2>6pWpvom; z^}*w!!#o%^1LHtL=;J1UF%pi(5Y>UA0gdT1R6bLnG_M&dswn|1!JZ zmrTdx#atOgNyCZCR}1B83IOg4Y_*3Ezj=tV?KO{la-iE{O4f1Q->S4Z&>B@f1poj507*qoM6N<$f@xoI AdH?_b diff --git a/browser/themes/linux/jar.mn b/browser/themes/linux/jar.mn index 8b575bcb534a..cccdb2440887 100644 --- a/browser/themes/linux/jar.mn +++ b/browser/themes/linux/jar.mn @@ -25,7 +25,6 @@ browser.jar: * skin/classic/browser/pageInfo.css skin/classic/browser/pageInfo.png skin/classic/browser/page-livemarks.png - skin/classic/browser/Privacy-16.png skin/classic/browser/privatebrowsing-mask.png skin/classic/browser/reload-stop-go.png skin/classic/browser/reload-stop-go@2x.png diff --git a/browser/themes/osx/Privacy-16.png b/browser/themes/osx/Privacy-16.png deleted file mode 100644 index 5291abce4103dc62005dc180fd5ed01f015eaeaa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 852 zcmV-a1FQUrP)b@6)TTw|+|eKP-PcrJSAm=B~oX ziw4bQC(1>0$4hyX4&`9z2EqjbZzYCe#t0*h)>04kCk|F^*Y?6biz)w&n7f=|rYww^ zqZ?-Kc@I1vVAHY@I1H*rpk)WNR)R#OS|0XtObf*VB=xU zg1_PeMvOh9lQ=}D;chTIupVH2unG}UMDy*0MjN zh2!7VmX^`3chGQJsINCgCzCST@qjK?P+giH3ZD>rWgdpJFymI&JqfhQ%I=VBv zmC@<<_M^08B+{rZn)hwd{<)JGnJB{JF`Im6L{W61Iz5N{eybsy*=N@up4v`pi%qg- z%vbhCuTA$V0gTX9krQBUAIo+JhHXHjMB{(O2#f*Nn=T?-MaQ;2>GHNu#$PD6%mY9E z(e~AQQAd_l=kRI_t;RCEC_rF^=zAVmD~7wsU_a)ltvPdFEFGVftsAIsyj=cZ%T~j` zaAWqP?dB0Zi^AThk4(46BAbb3FO0gnZscQ5l*VS)f3#Bl@_Oau=}`DxnSd#0-re`B z!=Zh4`_Y^7B9s`(gi4YbkJE`I$wx^di6`kxg2Ybu9NboWT(u9R!Is2H1CS;`8jLg{ zPx;qIGFf%))mO$dQdZL>a+2Vtcq#wse(Ll829jPs?3o3PJD-N6w50sJS& zDWZUYpkfpSK}|$tG$G`oMiVnLnQ<=J=gdCWy*(rIqECXqm%U-}XDt>iBBjK~pc^-S zlg;gAEbjhIF!FS(6&V}Tq6H&qA+*0g&@FS|Rj2bF-lLpb{Hy^G1SKDJ-kanW4>sq35MYd<)o!EL?s+mGZAnC`V=|qp(sA@$UMqi^(V~=MU@`1B zn@FdUC{9ko3WMwG>utWo;MTnvlwL}tpZNs4inwiaHw3S*7{J`QdRoOKyvtk@F zBB$o&U|ANHmY2c0mX}GVw>Q?Gl~dWY_T}-f;5j~{fi0h@gcPWc&H07XGsDjRo;|DB ziNxzhqcP5H8yeL*KmGA@j+rL<%*67YyH9P$o%Xm`r3SXP+O5h-eOy1f`FQntJfg3h z`0jhw>NMQ}=MX|7o6EaPx9|V&dVY%ggV|&uH?{lf6&x<<1VgK)?-ak!TFLd>(5LYI}uhsYDM==)mpT^%ooEZzf7cDw#|I zVQ6o!j+mxFNEyC5iebnP1bY2G)*jWkW6=eK$j+@F<>HNd$ezAu)E?F@acO=XiN{rI zFaQPNo-g53q7ApsI^Doy-jeIkGv#9w+XzvN9QnN3Iy^HqcjdyZFAlo>A4m{yhXeoT zx-PhFp6UDh1u2xvpUjq4G4jp?2h1gp>c61Lrs2B`Ab=K+VTjuf2ndFBJqF(oAOry+ z1PVrouuw_gM3mYfiV7txj=cRV$}j-DPkFMki6O_2BB!mQl(>UH#POj%`kdbYvFl%d TgeG9q00000NkvXXu0mjf+xvOV From 92572b43ec86a86a1364c068695e9dbbd5c20612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Tue, 9 May 2017 05:54:07 -0500 Subject: [PATCH 014/111] servo: Merge #16768 - Stylo: Bug 1355408 - add support for @-moz-document (from ferjm:bug1355408.mozdocument); r=xidorn - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors Link to the gecko bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1355408. Source-Repo: https://github.com/servo/servo Source-Revision: 8bc20ee9ac90b56a21bee8c9d507bc4624ef5dc9 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 307c61b490fce69f1b559d25159009e75cc25be1 --- servo/Cargo.lock | 1 + servo/components/script/dom/cssrule.rs | 1 + servo/components/style/build_gecko.rs | 2 + servo/components/style/document_condition.rs | 176 ++++++++++++++++++ .../style/gecko/generated/bindings.rs | 9 + .../style/gecko/generated/structs_debug.rs | 12 ++ .../style/gecko/generated/structs_release.rs | 12 ++ servo/components/style/lib.rs | 1 + servo/components/style/stylesheets.rs | 107 +++++++++-- servo/components/style/stylist.rs | 25 ++- servo/ports/geckolib/Cargo.toml | 1 + servo/tests/unit/style/media_queries.rs | 15 +- 12 files changed, 338 insertions(+), 24 deletions(-) create mode 100644 servo/components/style/document_condition.rs diff --git a/servo/Cargo.lock b/servo/Cargo.lock index fb927c48ffe3..13c3ea29af0e 100644 --- a/servo/Cargo.lock +++ b/servo/Cargo.lock @@ -963,6 +963,7 @@ dependencies = [ "env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "nsstring_vendor 0.1.0", "parking_lot 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.18.0", "style 0.0.1", diff --git a/servo/components/script/dom/cssrule.rs b/servo/components/script/dom/cssrule.rs index 6bfe057d6d9c..32e6ad05471b 100644 --- a/servo/components/script/dom/cssrule.rs +++ b/servo/components/script/dom/cssrule.rs @@ -85,6 +85,7 @@ impl CSSRule { StyleCssRule::Viewport(s) => Root::upcast(CSSViewportRule::new(window, parent_stylesheet, s)), StyleCssRule::Supports(s) => Root::upcast(CSSSupportsRule::new(window, parent_stylesheet, s)), StyleCssRule::Page(_) => unreachable!(), + StyleCssRule::Document(_) => unimplemented!(), // TODO } } diff --git a/servo/components/style/build_gecko.rs b/servo/components/style/build_gecko.rs index af8d1c722520..3b80bd338191 100644 --- a/servo/components/style/build_gecko.rs +++ b/servo/components/style/build_gecko.rs @@ -349,6 +349,7 @@ mod bindings { "mozilla::ServoElementSnapshot.*", "mozilla::CSSPseudoClassType", "mozilla::css::SheetParsingMode", + "mozilla::css::URLMatchingFunction", "mozilla::HalfCorner", "mozilla::PropertyStyleAnimationValuePair", "mozilla::TraversalRestyleBehavior", @@ -739,6 +740,7 @@ mod bindings { "UpdateAnimationsTasks", "LengthParsingMode", "InheritTarget", + "URLMatchingFunction", ]; struct ArrayType { cpp_type: &'static str, diff --git a/servo/components/style/document_condition.rs b/servo/components/style/document_condition.rs new file mode 100644 index 000000000000..aef034f2eebd --- /dev/null +++ b/servo/components/style/document_condition.rs @@ -0,0 +1,176 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * 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/. */ + +//! [@document rules](https://www.w3.org/TR/2012/WD-css3-conditional-20120911/#at-document) +//! initially in CSS Conditional Rules Module Level 3, @document has been postponed to the level 4. +//! We implement the prefixed `@-moz-document`. + +use cssparser::{Parser, Token, serialize_string}; +#[cfg(feature = "gecko")] +use gecko_bindings::bindings::Gecko_DocumentRule_UseForPresentation; +#[cfg(feature = "gecko")] +use gecko_bindings::structs::URLMatchingFunction as GeckoUrlMatchingFunction; +use media_queries::Device; +#[cfg(feature = "gecko")] +use nsstring::nsCString; +use parser::{Parse, ParserContext}; +use std::fmt; +use style_traits::ToCss; +use values::specified::url::SpecifiedUrl; + +/// A URL matching function for a `@document` rule's condition. +#[derive(Debug)] +pub enum UrlMatchingFunction { + /// Exact URL matching function. It evaluates to true whenever the + /// URL of the document being styled is exactly the URL given. + Url(SpecifiedUrl), + /// URL prefix matching function. It evaluates to true whenever the + /// URL of the document being styled has the argument to the + /// function as an initial substring (which is true when the two + /// strings are equal). When the argument is the empty string, + /// it evaluates to true for all documents. + UrlPrefix(String), + /// Domain matching function. It evaluates to true whenever the URL + /// of the document being styled has a host subcomponent and that + /// host subcomponent is exactly the argument to the ‘domain()’ + /// function or a final substring of the host component is a + /// period (U+002E) immediately followed by the argument to the + /// ‘domain()’ function. + Domain(String), + /// Regular expression matching function. It evaluates to true + /// whenever the regular expression matches the entirety of the URL + /// of the document being styled. + RegExp(String), +} + +macro_rules! parse_quoted_or_unquoted_string { + ($input:ident, $url_matching_function:expr) => { + $input.parse_nested_block(|input| { + let start = input.position(); + input.parse_entirely(|input| { + match input.next() { + Ok(Token::QuotedString(value)) => + Ok($url_matching_function(value.into_owned())), + _ => Err(()), + } + }).or_else(|_| { + while let Ok(_) = input.next() {} + Ok($url_matching_function(input.slice_from(start).to_string())) + }) + }) + } +} + +impl UrlMatchingFunction { + /// Parse a URL matching function for a`@document` rule's condition. + pub fn parse(context: &ParserContext, input: &mut Parser) + -> Result { + if input.try(|input| input.expect_function_matching("url-prefix")).is_ok() { + parse_quoted_or_unquoted_string!(input, UrlMatchingFunction::UrlPrefix) + } else if input.try(|input| input.expect_function_matching("domain")).is_ok() { + parse_quoted_or_unquoted_string!(input, UrlMatchingFunction::Domain) + } else if input.try(|input| input.expect_function_matching("regexp")).is_ok() { + input.parse_nested_block(|input| { + Ok(UrlMatchingFunction::RegExp(input.expect_string()?.into_owned())) + }) + } else if let Ok(url) = input.try(|input| SpecifiedUrl::parse(context, input)) { + Ok(UrlMatchingFunction::Url(url)) + } else { + Err(()) + } + } + + #[cfg(feature = "gecko")] + /// Evaluate a URL matching function. + pub fn evaluate(&self, device: &Device) -> bool { + let func = match *self { + UrlMatchingFunction::Url(_) => GeckoUrlMatchingFunction::eURL, + UrlMatchingFunction::UrlPrefix(_) => GeckoUrlMatchingFunction::eURLPrefix, + UrlMatchingFunction::Domain(_) => GeckoUrlMatchingFunction::eDomain, + UrlMatchingFunction::RegExp(_) => GeckoUrlMatchingFunction::eRegExp, + }; + let pattern = nsCString::from(match *self { + UrlMatchingFunction::Url(ref url) => url.as_str(), + UrlMatchingFunction::UrlPrefix(ref pat) | + UrlMatchingFunction::Domain(ref pat) | + UrlMatchingFunction::RegExp(ref pat) => pat, + }); + unsafe { + Gecko_DocumentRule_UseForPresentation(&*device.pres_context, &*pattern, func) + } + } + + #[cfg(not(feature = "gecko"))] + /// Evaluate a URL matching function. + pub fn evaluate(&self, _: &Device) -> bool { + false + } +} + +impl ToCss for UrlMatchingFunction { + fn to_css(&self, dest: &mut W) -> fmt::Result + where W: fmt::Write { + match *self { + UrlMatchingFunction::Url(ref url) => { + url.to_css(dest) + }, + UrlMatchingFunction::UrlPrefix(ref url_prefix) => { + dest.write_str("url-prefix(")?; + serialize_string(url_prefix, dest)?; + dest.write_str(")") + }, + UrlMatchingFunction::Domain(ref domain) => { + dest.write_str("domain(")?; + serialize_string(domain, dest)?; + dest.write_str(")") + }, + UrlMatchingFunction::RegExp(ref regex) => { + dest.write_str("regexp(")?; + serialize_string(regex, dest)?; + dest.write_str(")") + }, + } + } +} + +/// A `@document` rule's condition. +/// +/// https://www.w3.org/TR/2012/WD-css3-conditional-20120911/#at-document +/// +/// The `@document` rule's condition is written as a comma-separated list of +/// URL matching functions, and the condition evaluates to true whenever any +/// one of those functions evaluates to true. +#[derive(Debug)] +pub struct DocumentCondition(Vec); + +impl DocumentCondition { + /// Parse a document condition. + pub fn parse(context: &ParserContext, input: &mut Parser) + -> Result { + input.parse_comma_separated(|input| UrlMatchingFunction::parse(context, input)) + .map(DocumentCondition) + } + + /// Evaluate a document condition. + pub fn evaluate(&self, device: &Device) -> bool { + self.0.iter().any(|ref url_matching_function| + url_matching_function.evaluate(device) + ) + } +} + +impl ToCss for DocumentCondition { + fn to_css(&self, dest: &mut W) -> fmt::Result + where W: fmt::Write { + let mut iter = self.0.iter(); + let first = iter.next() + .expect("Empty DocumentCondition, should contain at least one URL matching function"); + first.to_css(dest)?; + for url_matching_function in iter { + dest.write_str(", ")?; + url_matching_function.to_css(dest)?; + } + Ok(()) + } +} diff --git a/servo/components/style/gecko/generated/bindings.rs b/servo/components/style/gecko/generated/bindings.rs index d068add23753..fdd7d7c7ac81 100644 --- a/servo/components/style/gecko/generated/bindings.rs +++ b/servo/components/style/gecko/generated/bindings.rs @@ -194,6 +194,7 @@ use gecko_bindings::structs::EffectCompositor_CascadeLevel; use gecko_bindings::structs::UpdateAnimationsTasks; use gecko_bindings::structs::LengthParsingMode; use gecko_bindings::structs::InheritTarget; +use gecko_bindings::structs::URLMatchingFunction; pub type nsTArrayBorrowed_uintptr_t<'a> = &'a mut ::gecko_bindings::structs::nsTArray; pub type ServoCssRulesStrong = ::gecko_bindings::sugar::ownership::Strong; pub type ServoCssRulesBorrowed<'a> = &'a ServoCssRules; @@ -1549,6 +1550,14 @@ extern "C" { extern "C" { pub fn Gecko_UnregisterProfilerThread(); } +extern "C" { + pub fn Gecko_DocumentRule_UseForPresentation(arg1: + RawGeckoPresContextBorrowed, + aPattern: *const nsACString, + aURLMatchingFunction: + URLMatchingFunction) + -> bool; +} extern "C" { pub fn Servo_Element_ClearData(node: RawGeckoElementBorrowed); } diff --git a/servo/components/style/gecko/generated/structs_debug.rs b/servo/components/style/gecko/generated/structs_debug.rs index dc5734d3a214..7ac6548e1fd5 100644 --- a/servo/components/style/gecko/generated/structs_debug.rs +++ b/servo/components/style/gecko/generated/structs_debug.rs @@ -2130,6 +2130,18 @@ pub mod root { ComplexColorValue ) , "::" , stringify ! ( _mOwningThread ) )); } + #[repr(i32)] + /** + * Enum defining the type of URL matching function for a @-moz-document rule + * condition. + */ + #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] + pub enum URLMatchingFunction { + eURL = 0, + eURLPrefix = 1, + eDomain = 2, + eRegExp = 3, + } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct DocumentRule { diff --git a/servo/components/style/gecko/generated/structs_release.rs b/servo/components/style/gecko/generated/structs_release.rs index 035c42bbf8a1..6abecf98e099 100644 --- a/servo/components/style/gecko/generated/structs_release.rs +++ b/servo/components/style/gecko/generated/structs_release.rs @@ -2036,6 +2036,18 @@ pub mod root { ComplexColorValue ) , "::" , stringify ! ( mRefCnt ) )); } + #[repr(i32)] + /** + * Enum defining the type of URL matching function for a @-moz-document rule + * condition. + */ + #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] + pub enum URLMatchingFunction { + eURL = 0, + eURLPrefix = 1, + eDomain = 2, + eRegExp = 3, + } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct DocumentRule { diff --git a/servo/components/style/lib.rs b/servo/components/style/lib.rs index 8a21e15d6483..91c8727a2e7b 100644 --- a/servo/components/style/lib.rs +++ b/servo/components/style/lib.rs @@ -93,6 +93,7 @@ pub mod context; pub mod counter_style; pub mod custom_properties; pub mod data; +pub mod document_condition; pub mod dom; pub mod element_state; #[cfg(feature = "servo")] mod encoding_support; diff --git a/servo/components/style/stylesheets.rs b/servo/components/style/stylesheets.rs index 36e5a2a936e0..5b19e9a14d35 100644 --- a/servo/components/style/stylesheets.rs +++ b/servo/components/style/stylesheets.rs @@ -12,6 +12,7 @@ use counter_style::{CounterStyleRule, parse_counter_style_name, parse_counter_st use cssparser::{AtRuleParser, Parser, QualifiedRuleParser}; use cssparser::{AtRuleType, RuleListParser, parse_one_rule}; use cssparser::ToCss as ParserToCss; +use document_condition::DocumentCondition; use error_reporting::{ParseErrorReporter, NullReporter}; #[cfg(feature = "servo")] use font_face::FontFaceRuleData; @@ -299,6 +300,7 @@ pub enum CssRule { Keyframes(Arc>), Supports(Arc>), Page(Arc>), + Document(Arc>), } #[allow(missing_docs)] @@ -321,12 +323,24 @@ pub enum CssRuleType { CounterStyle = 11, // https://drafts.csswg.org/css-conditional-3/#extentions-to-cssrule-interface Supports = 12, + // https://www.w3.org/TR/2012/WD-css3-conditional-20120911/#extentions-to-cssrule-interface + Document = 13, // https://drafts.csswg.org/css-fonts-3/#om-fontfeaturevalues FontFeatureValues = 14, // https://drafts.csswg.org/css-device-adapt/#css-rule-interface Viewport = 15, } +/// Result type for with_nested_rules_mq_and_doc_rule() +pub enum NestedRulesResult<'a> { + /// Only rules + Rules(&'a [CssRule]), + /// Rules with media queries + RulesWithMediaQueries(&'a [CssRule], &'a MediaList), + /// Rules with document rule + RulesWithDocument(&'a [CssRule], &'a DocumentRule) +} + #[allow(missing_docs)] pub enum SingleRuleParseError { Syntax, @@ -347,6 +361,7 @@ impl CssRule { CssRule::Viewport(_) => CssRuleType::Viewport, CssRule::Supports(_) => CssRuleType::Supports, CssRule::Page(_) => CssRuleType::Page, + CssRule::Document(_) => CssRuleType::Document, } } @@ -365,8 +380,8 @@ impl CssRule { /// used for others. /// /// This will not recurse down unsupported @supports rules - pub fn with_nested_rules_and_mq(&self, guard: &SharedRwLockReadGuard, mut f: F) -> R - where F: FnMut(&[CssRule], Option<&MediaList>) -> R { + pub fn with_nested_rules_mq_and_doc_rule(&self, guard: &SharedRwLockReadGuard, mut f: F) -> R + where F: FnMut(NestedRulesResult) -> R { match *self { CssRule::Import(ref lock) => { let rule = lock.read_with(guard); @@ -374,7 +389,7 @@ impl CssRule { let rules = rule.stylesheet.rules.read_with(guard); // FIXME(emilio): Include the nested rules if the stylesheet is // loaded. - f(&rules.0, Some(&media)) + f(NestedRulesResult::RulesWithMediaQueries(&rules.0, &media)) } CssRule::Namespace(_) | CssRule::Style(_) | @@ -383,22 +398,31 @@ impl CssRule { CssRule::Viewport(_) | CssRule::Keyframes(_) | CssRule::Page(_) => { - f(&[], None) + f(NestedRulesResult::Rules(&[])) } CssRule::Media(ref lock) => { let media_rule = lock.read_with(guard); let mq = media_rule.media_queries.read_with(guard); let rules = &media_rule.rules.read_with(guard).0; - f(rules, Some(&mq)) + f(NestedRulesResult::RulesWithMediaQueries(rules, &mq)) } CssRule::Supports(ref lock) => { let supports_rule = lock.read_with(guard); let enabled = supports_rule.enabled; if enabled { let rules = &supports_rule.rules.read_with(guard).0; - f(rules, None) + f(NestedRulesResult::Rules(rules)) } else { - f(&[], None) + f(NestedRulesResult::Rules(&[])) + } + } + CssRule::Document(ref lock) => { + if cfg!(feature = "gecko") { + let document_rule = lock.read_with(guard); + let rules = &document_rule.rules.read_with(guard).0; + f(NestedRulesResult::RulesWithDocument(rules, &document_rule)) + } else { + unimplemented!() } } } @@ -460,6 +484,7 @@ impl ToCssWithGuard for CssRule { CssRule::Media(ref lock) => lock.read_with(guard).to_css(guard, dest), CssRule::Supports(ref lock) => lock.read_with(guard).to_css(guard, dest), CssRule::Page(ref lock) => lock.read_with(guard).to_css(guard, dest), + CssRule::Document(ref lock) => lock.read_with(guard).to_css(guard, dest), } } } @@ -654,6 +679,29 @@ impl ToCssWithGuard for StyleRule { #[cfg(feature = "servo")] pub type FontFaceRule = FontFaceRuleData; +#[derive(Debug)] +/// A @-moz-document rule +pub struct DocumentRule { + /// The parsed condition + pub condition: DocumentCondition, + /// Child rules + pub rules: Arc>, +} + +impl ToCssWithGuard for DocumentRule { + fn to_css(&self, guard: &SharedRwLockReadGuard, dest: &mut W) -> fmt::Result + where W: fmt::Write { + try!(dest.write_str("@-moz-document ")); + try!(self.condition.to_css(dest)); + try!(dest.write_str(" {")); + for rule in self.rules.read_with(guard).0.iter() { + try!(dest.write_str(" ")); + try!(rule.to_css(guard, dest)); + } + dest.write_str(" }") + } +} + impl Stylesheet { /// Updates an empty stylesheet from a given string of text. pub fn update_from_str(existing: &Stylesheet, @@ -820,12 +868,24 @@ fn effective_rules(rules: &[CssRule], { for rule in rules { f(rule); - rule.with_nested_rules_and_mq(guard, |rules, mq| { - if let Some(media_queries) = mq { - if !media_queries.evaluate(device, quirks_mode) { - return - } - } + rule.with_nested_rules_mq_and_doc_rule(guard, |result| { + let rules = match result { + NestedRulesResult::Rules(rules) => { + rules + }, + NestedRulesResult::RulesWithMediaQueries(rules, media_queries) => { + if !media_queries.evaluate(device, quirks_mode) { + return; + } + rules + }, + NestedRulesResult::RulesWithDocument(rules, doc_rule) => { + if !doc_rule.condition.evaluate(device) { + return; + } + rules + }, + }; effective_rules(rules, device, quirks_mode, guard, f) }) } @@ -859,6 +919,7 @@ rule_filter! { effective_keyframes_rules(Keyframes => KeyframesRule), effective_supports_rules(Supports => SupportsRule), effective_page_rules(Page => PageRule), + effective_document_rules(Document => DocumentRule), } /// The stylesheet loader is the abstraction used to trigger network requests @@ -948,6 +1009,8 @@ enum AtRulePrelude { Keyframes(KeyframesName, Option), /// A @page rule prelude. Page, + /// A @document rule, with its conditional. + Document(DocumentCondition), } @@ -1171,6 +1234,14 @@ impl<'a, 'b> AtRuleParser for NestedRuleParser<'a, 'b> { Err(()) } }, + "-moz-document" => { + if cfg!(feature = "gecko") { + let cond = DocumentCondition::parse(self.context, input)?; + Ok(AtRuleType::WithBlock(AtRulePrelude::Document(cond))) + } else { + Err(()) + } + }, _ => Err(()) } } @@ -1221,6 +1292,16 @@ impl<'a, 'b> AtRuleParser for NestedRuleParser<'a, 'b> { Arc::new(self.shared_lock.wrap(declarations)) ))))) } + AtRulePrelude::Document(cond) => { + if cfg!(feature = "gecko") { + Ok(CssRule::Document(Arc::new(self.shared_lock.wrap(DocumentRule { + condition: cond, + rules: self.parse_nested_rules(input, CssRuleType::Document), + })))) + } else { + unreachable!() + } + } } } } diff --git a/servo/components/style/stylist.rs b/servo/components/style/stylist.rs index 54030358ddb7..e693a1d24e7d 100644 --- a/servo/components/style/stylist.rs +++ b/servo/components/style/stylist.rs @@ -42,6 +42,8 @@ use std::marker::PhantomData; use style_traits::viewport::ViewportConstraints; use stylearc::Arc; use stylesheets::{CssRule, FontFaceRule, Origin, StyleRule, Stylesheet, UserAgentStylesheets}; +#[cfg(feature = "servo")] +use stylesheets::NestedRulesResult; use thread_state; use viewport::{self, MaybeNew, ViewportRule}; @@ -596,12 +598,23 @@ impl Stylist { fn mq_eval_changed(guard: &SharedRwLockReadGuard, rules: &[CssRule], before: &Device, after: &Device, quirks_mode: QuirksMode) -> bool { for rule in rules { - let changed = rule.with_nested_rules_and_mq(guard, |rules, mq| { - if let Some(mq) = mq { - if mq.evaluate(before, quirks_mode) != mq.evaluate(after, quirks_mode) { - return true - } - } + let changed = rule.with_nested_rules_mq_and_doc_rule(guard, + |result| { + let rules = match result { + NestedRulesResult::Rules(rules) => rules, + NestedRulesResult::RulesWithMediaQueries(rules, mq) => { + if mq.evaluate(before, quirks_mode) != mq.evaluate(after, quirks_mode) { + return true; + } + rules + }, + NestedRulesResult::RulesWithDocument(rules, doc_rule) => { + if !doc_rule.condition.evaluate(before) { + return false; + } + rules + }, + }; mq_eval_changed(guard, rules, before, after, quirks_mode) }); if changed { diff --git a/servo/ports/geckolib/Cargo.toml b/servo/ports/geckolib/Cargo.toml index 6cb93fa3466a..382a1dbafa36 100644 --- a/servo/ports/geckolib/Cargo.toml +++ b/servo/ports/geckolib/Cargo.toml @@ -20,6 +20,7 @@ cssparser = "0.13" env_logger = {version = "0.4", default-features = false} # disable `regex` to reduce code size libc = "0.2" log = {version = "0.3.5", features = ["release_max_level_info"]} +nsstring_vendor = {path = "../../components/style/gecko_bindings/nsstring_vendor"} parking_lot = "0.3" selectors = {path = "../../components/selectors"} style = {path = "../../components/style", features = ["gecko"]} diff --git a/servo/tests/unit/style/media_queries.rs b/servo/tests/unit/style/media_queries.rs index d538225d9d88..f7ce523aa168 100644 --- a/servo/tests/unit/style/media_queries.rs +++ b/servo/tests/unit/style/media_queries.rs @@ -13,7 +13,7 @@ use style::media_queries::*; use style::servo::media_queries::*; use style::shared_lock::{SharedRwLock, SharedRwLockReadGuard}; use style::stylearc::Arc; -use style::stylesheets::{Stylesheet, Origin, CssRule}; +use style::stylesheets::{Stylesheet, Origin, CssRule, NestedRulesResult}; use style::values::specified; use style_traits::ToCss; @@ -52,11 +52,16 @@ fn media_queries(guard: &SharedRwLockReadGuard, rules: &[CssRule], f: &mut F) where F: FnMut(&MediaList), { for rule in rules { - rule.with_nested_rules_and_mq(guard, |rules, mq| { - if let Some(mq) = mq { - f(mq) + rule.with_nested_rules_mq_and_doc_rule(guard, |result| { + match result { + NestedRulesResult::Rules(rules) | + NestedRulesResult::RulesWithDocument(rules, _) => { + media_queries(guard, rules, f) + }, + NestedRulesResult::RulesWithMediaQueries(_, mq) => { + f(mq) + } } - media_queries(guard, rules, f) }) } } From e0a7705300153af02d096b19b02ebf135c32e83d Mon Sep 17 00:00:00 2001 From: Servo VCS Sync Date: Tue, 9 May 2017 12:32:43 +0000 Subject: [PATCH 015/111] No bug - Revendor rust dependencies --- toolkit/library/gtest/rust/Cargo.lock | 1 + toolkit/library/rust/Cargo.lock | 1 + 2 files changed, 2 insertions(+) diff --git a/toolkit/library/gtest/rust/Cargo.lock b/toolkit/library/gtest/rust/Cargo.lock index f1a8a7af351c..e0b9dee34734 100644 --- a/toolkit/library/gtest/rust/Cargo.lock +++ b/toolkit/library/gtest/rust/Cargo.lock @@ -314,6 +314,7 @@ dependencies = [ "env_logger 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "nsstring_vendor 0.1.0", "parking_lot 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.18.0", "style 0.0.1", diff --git a/toolkit/library/rust/Cargo.lock b/toolkit/library/rust/Cargo.lock index 3ce1b64b4ab7..5f3c1c052f0c 100644 --- a/toolkit/library/rust/Cargo.lock +++ b/toolkit/library/rust/Cargo.lock @@ -312,6 +312,7 @@ dependencies = [ "env_logger 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "nsstring_vendor 0.1.0", "parking_lot 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.18.0", "style 0.0.1", From 3e354c3b34b0911dd4bcde9d4f929941daf7160e Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Thu, 27 Apr 2017 11:53:38 +0100 Subject: [PATCH 016/111] Bug 1360166 - Make accessible/ ESLint rules inherit from the mozilla/recommended configuration. r=surkov MozReview-Commit-ID: GJs25x7vNgZ --HG-- extra : rebase_source : 6f1c650a50f638dddf8b774931931d226ebbe26d --- accessible/.eslintrc.js | 33 +++++++++++-------- accessible/jsat/AccessFu.jsm | 2 -- accessible/jsat/EventManager.jsm | 4 +-- accessible/jsat/Gestures.jsm | 1 - accessible/jsat/OutputGenerator.jsm | 1 - accessible/jsat/PointerAdapter.jsm | 2 -- accessible/jsat/Presentation.jsm | 2 -- accessible/jsat/Traversal.jsm | 2 -- accessible/jsat/Utils.jsm | 2 -- accessible/jsat/content-script.js | 2 ++ accessible/tests/crashtests/.eslintrc.js | 7 ++++ accessible/tests/crashtests/448064.xhtml | 16 ++++----- accessible/tests/mochitest/.eslintrc.js | 24 ++++++++++++++ accessible/tests/mochitest/actions.js | 4 +-- .../tests/mochitest/actions/test_media.html | 2 +- .../mochitest/editabletext/editabletext.js | 19 +---------- .../tests/mochitest/elm/test_canvas.html | 2 +- accessible/tests/mochitest/events.js | 26 +++++++-------- .../mochitest/events/test_fromUserInput.html | 6 ---- .../tests/mochitest/events/test_text.html | 3 -- accessible/tests/mochitest/grid.js | 3 +- .../hittest/test_canvas_hitregion.html | 2 +- .../tests/mochitest/hittest/test_general.html | 3 +- .../mochitest/hyperlink/test_general.html | 12 +++---- .../mochitest/jsat/test_live_regions.html | 1 - accessible/tests/mochitest/name/markup.js | 2 -- accessible/tests/mochitest/relations.js | 1 - .../tests/mochitest/scroll/test_zoom.html | 6 ++-- .../mochitest/scroll/test_zoom_text.html | 4 +-- accessible/tests/mochitest/selectable.js | 2 +- accessible/tests/mochitest/states.js | 2 +- .../tests/mochitest/states/test_aria.html | 2 +- accessible/tests/mochitest/table.js | 4 +-- .../tests/mochitest/table/test_table_1.html | 10 ++++-- .../mochitest/test_OuterDocAccessible.html | 4 +-- accessible/tests/mochitest/text.js | 4 +-- .../mochitest/tree/test_aria_globals.html | 2 +- .../tests/mochitest/treeupdate/test_list.html | 6 ++-- .../treeupdate/test_list_editabledoc.html | 2 +- .../tests/mochitest/value/test_general.html | 1 - 40 files changed, 113 insertions(+), 120 deletions(-) create mode 100644 accessible/tests/crashtests/.eslintrc.js create mode 100644 accessible/tests/mochitest/.eslintrc.js diff --git a/accessible/.eslintrc.js b/accessible/.eslintrc.js index 563570d8b953..887fd4770dc1 100644 --- a/accessible/.eslintrc.js +++ b/accessible/.eslintrc.js @@ -2,23 +2,30 @@ module.exports = { "extends": [ - "../.eslintrc.js" + "plugin:mozilla/recommended" ], - "globals": { - "Cc": true, - "Ci": true, - "Components": true, - "console": true, - "Cu": true, - "dump": true, - "Services": true, - "XPCOMUtils": true - }, "rules": { // Warn about cyclomatic complexity in functions. "complexity": ["error", 42], - // Maximum depth callbacks can be nested. - "max-nested-callbacks": ["error", 10], + // XXX These are rules that are enabled in the recommended configuration, but + // disabled here due to failures when initially implemented. They should be + // removed (and hence enabled) at some stage. + "brace-style": "off", + "consistent-return": "off", + "func-call-spacing": "off", + "quotes": "off", + "object-shorthand": "off", + "space-before-function-paren": "off", + "space-infix-ops": "off", + "key-spacing": "off", + "keyword-spacing": "off", + "no-else-return": "off", + "no-multi-spaces": "off", + "no-trailing-spaces": "off", + "no-unexpected-multiline": "off", + "no-unsafe-finally": "off", + "no-useless-call": "off", + "spaced-comment": "off", } }; diff --git a/accessible/jsat/AccessFu.jsm b/accessible/jsat/AccessFu.jsm index 307894d5259d..06eb6d7f6a9f 100644 --- a/accessible/jsat/AccessFu.jsm +++ b/accessible/jsat/AccessFu.jsm @@ -2,8 +2,6 @@ * 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/. */ -/* global AccessFu, Components, Utils, PrefCache, Logger, Services, - PointerAdapter, dump, Presentation, Rect */ /* exported AccessFu */ 'use strict'; diff --git a/accessible/jsat/EventManager.jsm b/accessible/jsat/EventManager.jsm index 4efa732e121c..0bf7beb0891c 100644 --- a/accessible/jsat/EventManager.jsm +++ b/accessible/jsat/EventManager.jsm @@ -98,7 +98,6 @@ this.EventManager.prototype = { switch (aEvent.type) { case 'wheel': { - let attempts = 0; let delta = aEvent.deltaX || aEvent.deltaY; this.contentControl.autoMove( null, @@ -271,7 +270,6 @@ this.EventManager.prototype = { { // Put vc where the focus is at let acc = aEvent.accessible; - let doc = aEvent.accessibleDocument; this._setEditingMode(aEvent); if ([Roles.CHROME_WINDOW, Roles.DOCUMENT, @@ -486,7 +484,7 @@ this.EventManager.prototype = { } return {}; }; - let {live, relevant, busy, atomic, memberOf} = getLiveAttributes(aEvent); + let {live, relevant, /* busy, atomic, memberOf */ } = getLiveAttributes(aEvent); // If container-live is not present or is set to |off| ignore the event. if (!live || live === 'off') { return {}; diff --git a/accessible/jsat/Gestures.jsm b/accessible/jsat/Gestures.jsm index cc431614c7c7..9a278f9b18f9 100644 --- a/accessible/jsat/Gestures.jsm +++ b/accessible/jsat/Gestures.jsm @@ -2,7 +2,6 @@ * 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/. */ -/* global Components, GestureSettings, XPCOMUtils, Utils, Promise, Logger */ /* exported GestureSettings, GestureTracker */ /****************************************************************************** diff --git a/accessible/jsat/OutputGenerator.jsm b/accessible/jsat/OutputGenerator.jsm index 36b43a5695e6..1f5dd74d7a0b 100644 --- a/accessible/jsat/OutputGenerator.jsm +++ b/accessible/jsat/OutputGenerator.jsm @@ -2,7 +2,6 @@ * 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/. */ -/* global Components, XPCOMUtils, Utils, PrefCache, States, Roles, Logger */ /* exported UtteranceGenerator, BrailleGenerator */ 'use strict'; diff --git a/accessible/jsat/PointerAdapter.jsm b/accessible/jsat/PointerAdapter.jsm index ff54976b759b..3240d7b55256 100644 --- a/accessible/jsat/PointerAdapter.jsm +++ b/accessible/jsat/PointerAdapter.jsm @@ -2,8 +2,6 @@ * 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/. */ -/* global Components, XPCOMUtils, Utils, Logger, GestureSettings, - GestureTracker */ /* exported PointerRelay, PointerAdapter */ 'use strict'; diff --git a/accessible/jsat/Presentation.jsm b/accessible/jsat/Presentation.jsm index c7d4162b7149..1b801569ad08 100644 --- a/accessible/jsat/Presentation.jsm +++ b/accessible/jsat/Presentation.jsm @@ -2,8 +2,6 @@ * 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/. */ -/* global Components, XPCOMUtils, Utils, Logger, BraillePresenter, Presentation, - UtteranceGenerator, BrailleGenerator, States, Roles, PivotContext */ /* exported Presentation */ 'use strict'; diff --git a/accessible/jsat/Traversal.jsm b/accessible/jsat/Traversal.jsm index 5b3bbdf89c72..a505f6dbaddf 100644 --- a/accessible/jsat/Traversal.jsm +++ b/accessible/jsat/Traversal.jsm @@ -2,8 +2,6 @@ * 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/. */ -/* global PrefCache, Roles, Prefilters, States, Filters, Utils, - TraversalRules, Components, XPCOMUtils */ /* exported TraversalRules, TraversalHelper */ 'use strict'; diff --git a/accessible/jsat/Utils.jsm b/accessible/jsat/Utils.jsm index 61a68eb28b67..a8f6d89d16c1 100644 --- a/accessible/jsat/Utils.jsm +++ b/accessible/jsat/Utils.jsm @@ -2,8 +2,6 @@ * 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/. */ -/* global Components, XPCOMUtils, Services, PluralForm, Logger, Rect, Utils, - States, Relations, Roles, dump, Events, PivotContext, PrefCache */ /* exported Utils, Logger, PivotContext, PrefCache */ 'use strict'; diff --git a/accessible/jsat/content-script.js b/accessible/jsat/content-script.js index 6ef0dadc3120..d7b8e8347265 100644 --- a/accessible/jsat/content-script.js +++ b/accessible/jsat/content-script.js @@ -2,6 +2,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/. */ +/* eslint-env mozilla/frame-script */ + var Ci = Components.interfaces; var Cu = Components.utils; diff --git a/accessible/tests/crashtests/.eslintrc.js b/accessible/tests/crashtests/.eslintrc.js new file mode 100644 index 000000000000..1a103a8d38c1 --- /dev/null +++ b/accessible/tests/crashtests/.eslintrc.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = { + "extends": [ + "plugin:mozilla/mochitest-test" + ], +}; diff --git a/accessible/tests/crashtests/448064.xhtml b/accessible/tests/crashtests/448064.xhtml index 7b662e7de7c0..586dbd1debf5 100644 --- a/accessible/tests/crashtests/448064.xhtml +++ b/accessible/tests/crashtests/448064.xhtml @@ -20,13 +20,13 @@ - \ No newline at end of file + diff --git a/accessible/tests/mochitest/.eslintrc.js b/accessible/tests/mochitest/.eslintrc.js new file mode 100644 index 000000000000..63fd23f5143c --- /dev/null +++ b/accessible/tests/mochitest/.eslintrc.js @@ -0,0 +1,24 @@ +"use strict"; + +module.exports = { + "extends": [ + "plugin:mozilla/mochitest-test" + ], + "rules": { + "mozilla/no-cpows-in-tests": "error", + "mozilla/reject-importGlobalProperties": "error", + + // XXX These are rules that are enabled in the recommended configuration, but + // disabled here due to failures when initially implemented. They should be + // removed (and hence enabled) at some stage. + "comma-spacing": "off", + "no-cond-assign": "off", + "no-lonely-if": "off", + "no-nested-ternary": "off", + "no-new-object": "off", + "no-redeclare": "off", + "no-shadow": "off", + "no-undef": "off", + "space-unary-ops": "off", + } +}; diff --git a/accessible/tests/mochitest/actions.js b/accessible/tests/mochitest/actions.js index 0c2765eeb3ac..d7ac0dc56303 100644 --- a/accessible/tests/mochitest/actions.js +++ b/accessible/tests/mochitest/actions.js @@ -41,7 +41,7 @@ const XUL_EVENTS = CLICK_EVENTS | COMMAND_EVENT; * * // [optional] an array of invoker's checker objects (see eventQueue * // constructor events.js) - * get eventSeq() {} + * get eventSeq() {} * }; * * @@ -134,7 +134,7 @@ function actionInvoker(aAccOrElmOrId, aActionIndex, aActionName, aEventSeq) try { acc.doAction(aActionIndex); } - catch (e){ + catch (e) { ok(false, "doAction(" + aActionIndex + ") failed with: " + e.name); return INVOKER_ACTION_FAILED; } diff --git a/accessible/tests/mochitest/actions/test_media.html b/accessible/tests/mochitest/actions/test_media.html index beb014ebc3e2..447d25941eba 100644 --- a/accessible/tests/mochitest/actions/test_media.html +++ b/accessible/tests/mochitest/actions/test_media.html @@ -64,7 +64,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483573 var audioElm = getAccessible("audio"); var playBtn = audioElm.firstChild; - var scrubber = playBtn.nextSibling.nextSibling.nextSibling; + // var scrubber = playBtn.nextSibling.nextSibling.nextSibling; var muteBtn = audioElm.lastChild.previousSibling; var actions = [ diff --git a/accessible/tests/mochitest/editabletext/editabletext.js b/accessible/tests/mochitest/editabletext/editabletext.js index 2fb1851bf6f5..46f5d345f092 100644 --- a/accessible/tests/mochitest/editabletext/editabletext.js +++ b/accessible/tests/mochitest/editabletext/editabletext.js @@ -133,7 +133,7 @@ function editableTextTest(aID) } this.generateTest(aID, null, [aStartPos, aEndPos, getTextFromClipboard], - copyNPasteInvoke, getValueChecker(aID, aResStr), testID); + copyNPasteTextInvoke, getValueChecker(aID, aResStr), testID); } /** @@ -222,7 +222,6 @@ function editableTextTest(aID) function getValue(aID) { - var value = ""; var elm = getNode(aID); if (elm instanceof Components.interfaces.nsIDOMNSEditableElement) return elm.value; @@ -258,21 +257,6 @@ function editableTextTest(aID) return checker; } - function getValueNClipboardChecker(aID, aValue, aText) - { - var valueChecker = getValueChecker(aID, aValue); - var clipboardChecker = getClipboardChecker(aID, aText); - - var checker = { - check: function() - { - valueChecker.check(); - clipboardChecker.check(); - } - }; - return checker; - } - /** * Process next scheduled test. */ @@ -350,4 +334,3 @@ function editableTextTest(aID) this.mEventQueue = new eventQueue(); this.mEventQueueReady = false; } - diff --git a/accessible/tests/mochitest/elm/test_canvas.html b/accessible/tests/mochitest/elm/test_canvas.html index b4b74380033f..4f707d067f89 100644 --- a/accessible/tests/mochitest/elm/test_canvas.html +++ b/accessible/tests/mochitest/elm/test_canvas.html @@ -29,7 +29,7 @@ context.addHitRegion({control: element}); var input = getAccessible("showA"); - var [cnvX, cnvY, cnvWidth, cnvHeight] = getBoundsForDOMElm(canv); + var [cnvX, cnvY, /*cnvWidth*/, /*cnvHeight*/] = getBoundsForDOMElm(canv); var [accX, accY, accWidth, accHeight] = getBounds(input); var [x, y, w, h] = CSSToDevicePixels(window, kX, kY, kWidth, kHeight); diff --git a/accessible/tests/mochitest/events.js b/accessible/tests/mochitest/events.js index 6cb5fd938548..e426d6a8cc6e 100644 --- a/accessible/tests/mochitest/events.js +++ b/accessible/tests/mochitest/events.js @@ -505,7 +505,7 @@ function eventQueue(aEventType) // (i.e. event types are matched, targets differs). if (!checker.unexpected && checker.unique && eventQueue.compareEventTypes(checker, aEvent)) { - var isExppected = false; + var isExpected = false; for (var jdx = 0; jdx < eventSeq.length; jdx++) { isExpected = eventQueue.compareEvents(eventSeq[jdx], aEvent); if (isExpected) @@ -969,7 +969,7 @@ eventQueue.logEvent = function eventQueue_logEvent(aOrigEvent, aMatchedChecker, var currType = eventQueue.getEventTypeAsString(aMatchedChecker); var currTargetDescr = eventQueue.getEventTargetDescr(aMatchedChecker); - var consoleMsg = "*****\nScenario " + aScenarioIdx + + var consoleMsg = "*****\nScenario " + aScenarioIdx + ", event " + aEventIdx + " matched: " + currType + "\n" + infoMsg + "\n*****"; gLogger.logToConsole(consoleMsg); @@ -1315,8 +1315,8 @@ function synthFocus(aNodeOrID, aCheckerOrEventSeq) this.DOMNode.focus(); } - this.getID = function synthFocus_getID() - { + this.getID = function synthFocus_getID() + { return prettyName(aNodeOrID) + " focus"; } } @@ -1336,8 +1336,8 @@ function synthFocusOnFrame(aNodeOrID, aCheckerOrEventSeq) this.DOMNode.body.focus(); } - this.getID = function synthFocus_getID() - { + this.getID = function synthFocus_getID() + { return prettyName(aNodeOrID) + " frame document focus"; } } @@ -1991,7 +1991,7 @@ function selChangeSeq(aUnselectedID, aSelectedID) } // Return two possible scenarios: depending on widget type when selection is - // moved the the order of items that get selected and unselected may vary. + // moved the the order of items that get selected and unselected may vary. return [ [ new stateChangeChecker(STATE_SELECTED, false, false, aUnselectedID), @@ -2151,7 +2151,7 @@ function removeA11yEventListener(aEventType, aEventHandler) return false; listenersArray.splice(index, 1); - + if (!listenersArray.length) { gA11yEventListeners[aEventType] = null; delete gA11yEventListeners[aEventType]; @@ -2270,21 +2270,19 @@ var gLogger = function sequenceItem(aProcessor, aEventType, aTarget, aItemID) { // private - + this.startProcess = function sequenceItem_startProcess() { this.queue.invoke(); } - - var item = this; - + this.queue = new eventQueue(); this.queue.onFinish = function() { aProcessor.onProcessed(); return DO_NOT_FINISH_TEST; } - + var invoker = { invoke: function invoker_invoke() { return aProcessor.process(); @@ -2295,7 +2293,7 @@ function sequenceItem(aProcessor, aEventType, aTarget, aItemID) }, eventSeq: [ new invokerChecker(aEventType, aTarget) ] }; - + this.queue.push(invoker); } diff --git a/accessible/tests/mochitest/events/test_fromUserInput.html b/accessible/tests/mochitest/events/test_fromUserInput.html index 1cfeedf0b360..5917ae06eb5a 100644 --- a/accessible/tests/mochitest/events/test_fromUserInput.html +++ b/accessible/tests/mochitest/events/test_fromUserInput.html @@ -31,9 +31,6 @@ this.invoke = function removeTextFromInput_invoke() { - const nsIDOMNSEditableElement = - Components.interfaces.nsIDOMNSEditableElement; - this.DOMNode.focus(); this.DOMNode.setSelectionRange(aStart, aEnd); @@ -60,9 +57,6 @@ this.invoke = function removeTextFromContentEditable_invoke() { - const nsIDOMNSEditableElement = - Components.interfaces.nsIDOMNSEditableElement; - this.DOMNode.focus(); this.textNode = getNode(aID).firstChild; var selection = window.getSelection(); diff --git a/accessible/tests/mochitest/events/test_text.html b/accessible/tests/mochitest/events/test_text.html index 76dd1ce49af0..b05dbeeafc2e 100644 --- a/accessible/tests/mochitest/events/test_text.html +++ b/accessible/tests/mochitest/events/test_text.html @@ -185,9 +185,6 @@ this.invoke = function removeTextFromInput_invoke() { - const nsIDOMNSEditableElement = - Components.interfaces.nsIDOMNSEditableElement; - this.DOMNode.focus(); this.DOMNode.setSelectionRange(aStart, aEnd); diff --git a/accessible/tests/mochitest/grid.js b/accessible/tests/mochitest/grid.js index c3dc7d1ba536..abe1212e24d4 100644 --- a/accessible/tests/mochitest/grid.js +++ b/accessible/tests/mochitest/grid.js @@ -26,7 +26,6 @@ function grid(aTableIdentifier) this.getCellAtIndex = function getCellAtIndex(aIndex) { - var rowCount = this.getRowCount(); var colsCount = this.getColsCount(); var rowIdx = Math.floor(aIndex / colsCount); @@ -133,7 +132,7 @@ function grid(aTableIdentifier) { if (aEvent.target.localName != "td") return; - + var curCell = this.getCurrentCell(); var cell = aEvent.target; diff --git a/accessible/tests/mochitest/hittest/test_canvas_hitregion.html b/accessible/tests/mochitest/hittest/test_canvas_hitregion.html index fc1df3d60fd3..37309984b9a3 100644 --- a/accessible/tests/mochitest/hittest/test_canvas_hitregion.html +++ b/accessible/tests/mochitest/hittest/test_canvas_hitregion.html @@ -51,7 +51,7 @@ var hitcanvas = getAccessible("hitcanvas"); var hitcheck = getAccessible("hitcheck"); - var [hitX, hitY, hitWidth, hitHeight] = getBounds(hitcanvas); + var [hitX, hitY, /*hitWidth, hitHeight */] = getBounds(hitcanvas); var [deltaX, deltaY] = CSSToDevicePixels(window, offsetX, offsetY); var docAcc = getAccessible(document); diff --git a/accessible/tests/mochitest/hittest/test_general.html b/accessible/tests/mochitest/hittest/test_general.html index 74ff4fe298d7..0a8f5d0d60b7 100644 --- a/accessible/tests/mochitest/hittest/test_general.html +++ b/accessible/tests/mochitest/hittest/test_general.html @@ -48,9 +48,8 @@ if (!MAC) { // Not specific case, point is inside of btn accessible. var btn = getAccessible("btn"); - var btnText = btn.firstChild; testChildAtPoint(btn, 1, 1, btn, btn); - + // Not specific case, point is outside of btn accessible. testChildAtPoint(btn, -1, 1, null, null); diff --git a/accessible/tests/mochitest/hyperlink/test_general.html b/accessible/tests/mochitest/hyperlink/test_general.html index e6e098ecca2f..4b3a20446a40 100644 --- a/accessible/tests/mochitest/hyperlink/test_general.html +++ b/accessible/tests/mochitest/hyperlink/test_general.html @@ -72,7 +72,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368 [nsIAccessibleHyperLink]); testThis("NormalHyperlink", normalHyperlinkAcc, ROLE_LINK, 1, "Mozilla Foundation", true, 17, 18); - is(normalHyperlinkAcc.getURI(0).spec, "http://www.mozilla.org/", + is(normalHyperlinkAcc.getURI(0).spec, "http://www.mozilla.org/", "URI wrong for normalHyperlinkElement!"); testStates(normalHyperlinkAcc, STATE_LINKED, 0); @@ -133,7 +133,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368 [nsIAccessibleHyperLink]); testThis("LinkWithSpan", hyperlinkWithSpanAcc, ROLE_LINK, 1, "Heise Online", true, 119, 120); - is(hyperlinkWithSpanAcc.getURI(0).spec, "http://www.heise.de/", + is(hyperlinkWithSpanAcc.getURI(0).spec, "http://www.heise.de/", "URI wrong for hyperlinkElementWithSpan!"); testStates(hyperlinkWithSpanAcc, STATE_LINKED, 0); testAction("LinkWithSpan", hyperlinkWithSpanAcc, "jump"); @@ -168,7 +168,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368 ////////////////////////////////////////////////////////////////////////// // Maps to group links (bug 431615). - var linksMapAcc = getAccessible("linksmap"); + // var linksMapAcc = getAccessible("linksmap"); ////////////////////////////////////////////////////////////////////////// // Link with title attribute, no name from the subtree (bug 438325). @@ -260,13 +260,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368 >This should never be of state_linked
Link with registered 'click' event: This should have state_linked
Link with title attribute (no name from subtree):
Link with title attribute (no name from subtree):

Link with title attribute (name from subtree):
Link with title attribute (name from subtree):
the name from subtree
Link with title attribute (name from nested image):
Link with title attribute (name from nested image):
The title for link

Map that is used to group links (www.w3.org/TR/WCAG10-HTML-TECHS/#group-bypass), also see the bug 431615:
= length) break; diff --git a/accessible/tests/mochitest/tree/test_aria_globals.html b/accessible/tests/mochitest/tree/test_aria_globals.html index 771640fcc6dd..34c73691a932 100644 --- a/accessible/tests/mochitest/tree/test_aria_globals.html +++ b/accessible/tests/mochitest/tree/test_aria_globals.html @@ -42,7 +42,7 @@ for (var idx = 0; idx < globalIds.length; idx++) { ok(isAccessible(globalIds[idx]), - "Must be accessible becuase of " + "aria-" + globalIds[idx] + + "Must be accessible becuase of aria-" + globalIds[idx] + " presence"); } diff --git a/accessible/tests/mochitest/treeupdate/test_list.html b/accessible/tests/mochitest/treeupdate/test_list.html index 9196142d9be6..595392b5bc8d 100644 --- a/accessible/tests/mochitest/treeupdate/test_list.html +++ b/accessible/tests/mochitest/treeupdate/test_list.html @@ -68,7 +68,7 @@ 0, this.li, this.liNode, this.bullet ); } - }; + } function showProcessor() { @@ -84,7 +84,7 @@ testLiAccessibleTree(); gSequence.processNext(); } - }; + } function textReplaceProcessor() { @@ -106,7 +106,7 @@ testAccessibleTree(this.liNode, tree); SimpleTest.finish(); } - }; + } //////////////////////////////////////////////////////////////////////////// // Test diff --git a/accessible/tests/mochitest/treeupdate/test_list_editabledoc.html b/accessible/tests/mochitest/treeupdate/test_list_editabledoc.html index d4c178cb978a..66deadb55c49 100644 --- a/accessible/tests/mochitest/treeupdate/test_list_editabledoc.html +++ b/accessible/tests/mochitest/treeupdate/test_list_editabledoc.html @@ -65,7 +65,7 @@ { return "add li"; } - }; + } //////////////////////////////////////////////////////////////////////////// // Test diff --git a/accessible/tests/mochitest/value/test_general.html b/accessible/tests/mochitest/value/test_general.html index 12e718ba17ce..bf19bc38bb82 100644 --- a/accessible/tests/mochitest/value/test_general.html +++ b/accessible/tests/mochitest/value/test_general.html @@ -36,7 +36,6 @@ is(acc.value, aValue, "Wrong value for " + aID + "!"); } - var rootDir = getRootDirectory(window.location.href); var href = getRootDirectory(window.location.href) + "foo"; // roles that can't live as HTMLLinkAccessibles From f682c34d0628c0802491778eee3bbdf7aaf355c4 Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Thu, 27 Apr 2017 11:57:13 +0100 Subject: [PATCH 017/111] Bug 1360166 - Remove duplicated rules in accessible/tests/browser/.eslintrc.js (already in recommended.js). r=surkov MozReview-Commit-ID: Vcacy2HEwj --HG-- extra : rebase_source : defe73462a8fae3ec5fd9b2ccc6b00ad70ceca6e --- accessible/tests/browser/.eslintrc.js | 56 +++------------------------ 1 file changed, 6 insertions(+), 50 deletions(-) diff --git a/accessible/tests/browser/.eslintrc.js b/accessible/tests/browser/.eslintrc.js index f38b1b517867..1c3bd0f116d4 100644 --- a/accessible/tests/browser/.eslintrc.js +++ b/accessible/tests/browser/.eslintrc.js @@ -1,6 +1,6 @@ "use strict"; -module.exports = { // eslint-disable-line no-undef +module.exports = { "extends": [ "plugin:mozilla/browser-test" ], @@ -51,16 +51,14 @@ module.exports = { // eslint-disable-line no-undef "findAccessibleChildByID": true }, "rules": { - "mozilla/no-aArgs": "warn", - "mozilla/no-cpows-in-tests": "warn", - "mozilla/reject-importGlobalProperties": "warn", - "mozilla/var-only-at-top-level": "warn", + "mozilla/no-aArgs": "error", + "mozilla/no-cpows-in-tests": "error", + "mozilla/reject-importGlobalProperties": "error", + "mozilla/var-only-at-top-level": "error", "block-scoped-var": "error", - "brace-style": ["error", "1tbs"], "camelcase": "error", "comma-dangle": ["error", "never"], - "comma-spacing": "error", "comma-style": ["error", "last"], "complexity": ["error", 20], "consistent-this": "off", @@ -68,18 +66,12 @@ module.exports = { // eslint-disable-line no-undef "default-case": "off", "dot-location": ["error", "property"], "dot-notation": "error", - "eol-last": "error", "eqeqeq": "off", - "func-call-spacing": "error", "func-names": "off", "func-style": "off", - "generator-star": "off", - "global-strict": "off", + "generator-star-spacing": "off", "handle-callback-err": ["error", "er"], "indent": ["error", 2, {"SwitchCase": 1}], - "key-spacing": ["error", {"beforeColon": false, "afterColon": true}], - "linebreak-style": "off", - "max-depth": "off", "max-nested-callbacks": ["error", 4], "max-params": "off", "max-statements": "off", @@ -90,73 +82,47 @@ module.exports = { // eslint-disable-line no-undef "no-caller": "error", "no-catch-shadow": "error", "no-comma-dangle": "off", - "no-cond-assign": "error", "no-console": "off", "no-constant-condition": "off", "no-continue": "off", "no-control-regex": "error", - "no-debugger": "error", - "no-delete-var": "error", "no-div-regex": "off", - "no-dupe-args": "error", - "no-dupe-keys": "error", - "no-duplicate-case": "error", - "no-else-return": "error", - "no-empty": "error", - "no-empty-character-class": "error", "no-eval": "error", - "no-ex-assign": "error", "no-extend-native": "error", - "no-extra-bind": "error", - "no-extra-boolean-cast": "error", "no-extra-parens": "off", "no-extra-semi": "error", "no-extra-strict": "off", "no-fallthrough": "error", "no-floating-decimal": "off", "no-inline-comments": "off", - "no-lonely-if": "error", "no-mixed-requires": "off", - "no-mixed-spaces-and-tabs": "error", - "no-multi-spaces": "error", "no-multi-str": "error", "no-multiple-empty-lines": ["error", {"max": 1}], - "no-native-reassign": "error", - "no-nested-ternary": "error", "no-new-require": "off", - "no-octal": "error", "no-param-reassign": "off", "no-path-concat": "off", "no-plusplus": "off", "no-process-env": "off", "no-process-exit": "off", "no-proto": "error", - "no-redeclare": "error", - "no-regex-spaces": "error", "no-reserved-keys": "off", "no-restricted-modules": "off", "no-return-assign": "error", "no-script-url": "off", - "no-self-compare": "error", "no-sequences": "error", "no-shadow": "error", - "no-shadow-restricted-names": "error", "no-space-before-semi": "off", "no-sparse-arrays": "error", "no-sync": "off", "no-ternary": "off", "no-throw-literal": "error", - "no-trailing-spaces": "error", - "no-undef": "error", "no-underscore-dangle": "off", "no-undefined": "off", "no-unneeded-ternary": "error", - "no-unreachable": "error", "no-unused-vars": ["error", {"vars": "all", "args": "none"}], "no-use-before-define": "off", "no-var": "off", "no-warning-comments": "off", - "no-with": "error", "object-shorthand": "off", "one-var": ["error", "never"], "padded-blocks": ["error", "never"], @@ -165,21 +131,11 @@ module.exports = { // eslint-disable-line no-undef "semi": ["error", "always"], "semi-spacing": ["error", {"before": false, "after": true}], "sort-vars": "off", - "space-after-function-name": "off", - "keyword-spacing": "error", - "space-before-blocks": "error", - "space-before-function-parentheses": "off", - "space-before-function-paren": ["error", "never"], "space-in-brackets": "off", "space-in-parens": ["error", "never"], - "space-infix-ops": ["error", {"int32Hint": true}], - "space-unary-ops": ["error", { "words": true, "nonwords": false }], "space-unary-word-ops": "off", - "spaced-comment": ["error", "always"], "strict": ["error", "global"], - "use-isnan": "error", "valid-jsdoc": "off", - "valid-typeof": "error", "vars-on-top": "off", "wrap-iife": "off", "wrap-regex": "off", From 23f885d2be846b4da230bdb664595dd47e11b03a Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Thu, 27 Apr 2017 12:07:04 +0100 Subject: [PATCH 018/111] Bug 1360166 - Clean up global handling for accessible/tests/. r=surkov Now that we inherit the recommended configurations, many definitions are handled semi-automatically. MozReview-Commit-ID: 1H2MXzk6VdQ --HG-- extra : rebase_source : 25e9e8b9a9f62d4e22873998ff4532fbcbe2e367 --- accessible/tests/browser/.eslintrc.js | 46 ------------------ .../e10s/browser_caching_attributes.js | 3 +- .../e10s/browser_caching_description.js | 3 +- .../browser/e10s/browser_caching_name.js | 3 +- .../browser/e10s/browser_caching_relations.js | 5 +- .../browser/e10s/browser_caching_states.js | 5 +- .../browser/e10s/browser_caching_value.js | 3 +- .../browser/e10s/browser_events_caretmove.js | 2 - .../tests/browser/e10s/browser_events_hide.js | 2 - .../tests/browser/e10s/browser_events_show.js | 2 - .../e10s/browser_events_statechange.js | 5 +- .../browser/e10s/browser_events_textchange.js | 3 -- .../e10s/browser_treeupdate_ariadialog.js | 4 +- .../e10s/browser_treeupdate_ariaowns.js | 3 +- .../browser/e10s/browser_treeupdate_canvas.js | 3 +- .../e10s/browser_treeupdate_cssoverflow.js | 3 +- .../browser/e10s/browser_treeupdate_doc.js | 4 +- .../e10s/browser_treeupdate_gencontent.js | 3 +- .../browser/e10s/browser_treeupdate_hidden.js | 3 +- .../e10s/browser_treeupdate_imagemap.js | 3 +- .../browser/e10s/browser_treeupdate_list.js | 3 +- .../browser_treeupdate_list_editabledoc.js | 4 +- .../e10s/browser_treeupdate_listener.js | 3 +- .../e10s/browser_treeupdate_optgroup.js | 3 +- .../e10s/browser_treeupdate_removal.js | 3 +- .../browser/e10s/browser_treeupdate_table.js | 3 +- .../e10s/browser_treeupdate_textleaf.js | 3 +- .../e10s/browser_treeupdate_visibility.js | 3 +- .../e10s/browser_treeupdate_whitespace.js | 3 +- accessible/tests/browser/e10s/events.js | 5 +- accessible/tests/browser/e10s/head.js | 47 +++++++++++++++++-- accessible/tests/browser/head.js | 1 + accessible/tests/browser/shared-head.js | 44 +---------------- accessible/tests/mochitest/jsat/dom_helper.js | 2 - .../mochitest/treeupdate/test_ariaowns.html | 19 ++++---- 35 files changed, 86 insertions(+), 168 deletions(-) diff --git a/accessible/tests/browser/.eslintrc.js b/accessible/tests/browser/.eslintrc.js index 1c3bd0f116d4..05c742c2adc9 100644 --- a/accessible/tests/browser/.eslintrc.js +++ b/accessible/tests/browser/.eslintrc.js @@ -4,52 +4,6 @@ module.exports = { "extends": [ "plugin:mozilla/browser-test" ], - // All globals made available in the test environment. - "globals": { - // Content scripts have global 'content' object - "content": true, - - "add_task": true, - - // Defined in accessible/tests/mochitest/ common.js, name.js, states.js - "prettyName": true, - "statesToString": true, - "eventTypeToString": true, - "testAttrs": true, - "testAbsentAttrs": true, - "testName": true, - "testDescr": true, - "testStates": true, - "testRelation": true, - "testValue": true, - "testAccessibleTree": true, - "isAccessible": true, - "getAccessibleDOMNodeID": true, - - // Defined for all top level accessibility browser tests. - "setE10sPrefs": true, - "unsetE10sPrefs": true, - "initPromise": true, - "shutdownPromise": true, - "forceGC": true, - - // Defined for all e10s accessibility browser tests. - "addAccessibleTask": true, - "BrowserTestUtils": true, - "ContentTask": true, - "gBrowser": true, - "isDefunct": true, - "loadScripts": true, - "loadFrameScripts": true, - "Logger": true, - "MOCHITESTS_DIR": true, - "waitForEvent": true, - "waitForMultipleEvents": true, - "invokeSetAttribute": true, - "invokeSetStyle": true, - "invokeFocus": true, - "findAccessibleChildByID": true - }, "rules": { "mozilla/no-aArgs": "error", "mozilla/no-cpows-in-tests": "error", diff --git a/accessible/tests/browser/e10s/browser_caching_attributes.js b/accessible/tests/browser/e10s/browser_caching_attributes.js index 449ca9d918e1..12df07b93a86 100644 --- a/accessible/tests/browser/e10s/browser_caching_attributes.js +++ b/accessible/tests/browser/e10s/browser_caching_attributes.js @@ -4,8 +4,7 @@ 'use strict'; -/* global EVENT_FOCUS */ - +/* import-globals-from ../../mochitest/attributes.js */ loadScripts({ name: 'attributes.js', dir: MOCHITESTS_DIR }); /** diff --git a/accessible/tests/browser/e10s/browser_caching_description.js b/accessible/tests/browser/e10s/browser_caching_description.js index 18ee58bd0123..054f628e8bd4 100644 --- a/accessible/tests/browser/e10s/browser_caching_description.js +++ b/accessible/tests/browser/e10s/browser_caching_description.js @@ -4,8 +4,7 @@ 'use strict'; -/* global EVENT_DESCRIPTION_CHANGE, EVENT_NAME_CHANGE, EVENT_REORDER */ - +/* import-globals-from ../../mochitest/name.js */ loadScripts({ name: 'name.js', dir: MOCHITESTS_DIR }); /** diff --git a/accessible/tests/browser/e10s/browser_caching_name.js b/accessible/tests/browser/e10s/browser_caching_name.js index 9a5fd3e26d5b..94c88cc130ce 100644 --- a/accessible/tests/browser/e10s/browser_caching_name.js +++ b/accessible/tests/browser/e10s/browser_caching_name.js @@ -4,8 +4,7 @@ 'use strict'; -/* global EVENT_REORDER, EVENT_TEXT_INSERTED */ - +/* import-globals-from ../../mochitest/name.js */ loadScripts({ name: 'name.js', dir: MOCHITESTS_DIR }); /** diff --git a/accessible/tests/browser/e10s/browser_caching_relations.js b/accessible/tests/browser/e10s/browser_caching_relations.js index 772aee96a643..31f50c405a5a 100644 --- a/accessible/tests/browser/e10s/browser_caching_relations.js +++ b/accessible/tests/browser/e10s/browser_caching_relations.js @@ -4,10 +4,7 @@ 'use strict'; -/* global RELATION_LABELLED_BY, RELATION_LABEL_FOR, RELATION_DESCRIBED_BY, - RELATION_DESCRIPTION_FOR, RELATION_CONTROLLER_FOR, - RELATION_CONTROLLED_BY, RELATION_FLOWS_TO, RELATION_FLOWS_FROM */ - +/* import-globals-from ../../mochitest/relations.js */ loadScripts({ name: 'relations.js', dir: MOCHITESTS_DIR }); /** diff --git a/accessible/tests/browser/e10s/browser_caching_states.js b/accessible/tests/browser/e10s/browser_caching_states.js index 69e4931ea301..58bc440e343c 100644 --- a/accessible/tests/browser/e10s/browser_caching_states.js +++ b/accessible/tests/browser/e10s/browser_caching_states.js @@ -4,9 +4,8 @@ 'use strict'; -/* global EVENT_STATE_CHANGE, STATE_CHECKED, STATE_BUSY, STATE_REQUIRED, - STATE_INVALID, EXT_STATE_ENABLED */ - +/* import-globals-from ../../mochitest/role.js */ +/* import-globals-from ../../mochitest/states.js */ loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR }, { name: 'states.js', dir: MOCHITESTS_DIR }); diff --git a/accessible/tests/browser/e10s/browser_caching_value.js b/accessible/tests/browser/e10s/browser_caching_value.js index 2669cbfab558..f06091d9fd91 100644 --- a/accessible/tests/browser/e10s/browser_caching_value.js +++ b/accessible/tests/browser/e10s/browser_caching_value.js @@ -4,8 +4,7 @@ 'use strict'; -/* global nsIAccessibleValue, EVENT_VALUE_CHANGE, EVENT_TEXT_VALUE_CHANGE */ - +/* import-globals-from ../../mochitest/value.js */ loadScripts({ name: 'value.js', dir: MOCHITESTS_DIR }); /** diff --git a/accessible/tests/browser/e10s/browser_events_caretmove.js b/accessible/tests/browser/e10s/browser_events_caretmove.js index 506945f3036f..f2bc64cb768e 100644 --- a/accessible/tests/browser/e10s/browser_events_caretmove.js +++ b/accessible/tests/browser/e10s/browser_events_caretmove.js @@ -2,8 +2,6 @@ * 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/. */ -/* global EVENT_TEXT_CARET_MOVED, nsIAccessibleCaretMoveEvent */ - 'use strict'; /** diff --git a/accessible/tests/browser/e10s/browser_events_hide.js b/accessible/tests/browser/e10s/browser_events_hide.js index bb9ee3961f13..e996d1517b8b 100644 --- a/accessible/tests/browser/e10s/browser_events_hide.js +++ b/accessible/tests/browser/e10s/browser_events_hide.js @@ -2,8 +2,6 @@ * 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/. */ -/* global EVENT_HIDE */ - 'use strict'; /** diff --git a/accessible/tests/browser/e10s/browser_events_show.js b/accessible/tests/browser/e10s/browser_events_show.js index 5003c14f7939..4d62a10db9b8 100644 --- a/accessible/tests/browser/e10s/browser_events_show.js +++ b/accessible/tests/browser/e10s/browser_events_show.js @@ -2,8 +2,6 @@ * 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/. */ -/* global EVENT_SHOW */ - 'use strict'; /** diff --git a/accessible/tests/browser/e10s/browser_events_statechange.js b/accessible/tests/browser/e10s/browser_events_statechange.js index 7f353efa77d4..ef91359468ff 100644 --- a/accessible/tests/browser/e10s/browser_events_statechange.js +++ b/accessible/tests/browser/e10s/browser_events_statechange.js @@ -2,11 +2,10 @@ * 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/. */ -/* global STATE_CHECKED, EXT_STATE_EDITABLE, nsIAccessibleStateChangeEvent, - EVENT_STATE_CHANGE */ - 'use strict'; +/* import-globals-from ../../mochitest/role.js */ +/* import-globals-from ../../mochitest/states.js */ loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR }, { name: 'states.js', dir: MOCHITESTS_DIR }); diff --git a/accessible/tests/browser/e10s/browser_events_textchange.js b/accessible/tests/browser/e10s/browser_events_textchange.js index a1aed52d15ab..011bf756f92f 100644 --- a/accessible/tests/browser/e10s/browser_events_textchange.js +++ b/accessible/tests/browser/e10s/browser_events_textchange.js @@ -2,9 +2,6 @@ * 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/. */ -/* global EVENT_TEXT_INSERTED, EVENT_TEXT_REMOVED, - nsIAccessibleTextChangeEvent */ - 'use strict'; function checkTextChangeEvent(event, id, text, start, end, isInserted, isFromUserInput) { diff --git a/accessible/tests/browser/e10s/browser_treeupdate_ariadialog.js b/accessible/tests/browser/e10s/browser_treeupdate_ariadialog.js index a9544bc5ce1b..70b1d8afd116 100644 --- a/accessible/tests/browser/e10s/browser_treeupdate_ariadialog.js +++ b/accessible/tests/browser/e10s/browser_treeupdate_ariadialog.js @@ -4,9 +4,7 @@ 'use strict'; -/* global EVENT_SHOW, ROLE_DIALOG, ROLE_PUSHBUTTON, ROLE_TEXT_LEAF, ROLE_ENTRY, - ROLE_DOCUMENT */ - +/* import-globals-from ../../mochitest/role.js */ loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR }); // Test ARIA Dialog diff --git a/accessible/tests/browser/e10s/browser_treeupdate_ariaowns.js b/accessible/tests/browser/e10s/browser_treeupdate_ariaowns.js index bee9cded0389..1fec719d7e95 100644 --- a/accessible/tests/browser/e10s/browser_treeupdate_ariaowns.js +++ b/accessible/tests/browser/e10s/browser_treeupdate_ariaowns.js @@ -4,8 +4,7 @@ 'use strict'; -/* global EVENT_REORDER */ - +/* import-globals-from ../../mochitest/role.js */ loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR }); function* testContainer1(browser, accDoc) { diff --git a/accessible/tests/browser/e10s/browser_treeupdate_canvas.js b/accessible/tests/browser/e10s/browser_treeupdate_canvas.js index e4b3b70f76c6..3b2c8e4bfd5b 100644 --- a/accessible/tests/browser/e10s/browser_treeupdate_canvas.js +++ b/accessible/tests/browser/e10s/browser_treeupdate_canvas.js @@ -4,8 +4,7 @@ 'use strict'; -/* global EVENT_SHOW */ - +/* import-globals-from ../../mochitest/role.js */ loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR }); addAccessibleTask(` diff --git a/accessible/tests/browser/e10s/browser_treeupdate_cssoverflow.js b/accessible/tests/browser/e10s/browser_treeupdate_cssoverflow.js index d8b217380550..8c4a16631b3e 100644 --- a/accessible/tests/browser/e10s/browser_treeupdate_cssoverflow.js +++ b/accessible/tests/browser/e10s/browser_treeupdate_cssoverflow.js @@ -4,8 +4,7 @@ 'use strict'; -/* global EVENT_REORDER */ - +/* import-globals-from ../../mochitest/role.js */ loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR }); addAccessibleTask(` diff --git a/accessible/tests/browser/e10s/browser_treeupdate_doc.js b/accessible/tests/browser/e10s/browser_treeupdate_doc.js index 73c6539e52c2..7ffdebf94138 100644 --- a/accessible/tests/browser/e10s/browser_treeupdate_doc.js +++ b/accessible/tests/browser/e10s/browser_treeupdate_doc.js @@ -4,9 +4,7 @@ 'use strict'; -/* global ROLE_PUSHBUTTON, ROLE_TEXT_LEAF, EVENT_REORDER, ROLE_DOCUMENT, - nsIAccessibleDocument */ - +/* import-globals-from ../../mochitest/role.js */ loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR }); const iframeSrc = `data:text/html, diff --git a/accessible/tests/browser/e10s/browser_treeupdate_gencontent.js b/accessible/tests/browser/e10s/browser_treeupdate_gencontent.js index 12641928880e..e0ff3242b0ae 100644 --- a/accessible/tests/browser/e10s/browser_treeupdate_gencontent.js +++ b/accessible/tests/browser/e10s/browser_treeupdate_gencontent.js @@ -4,8 +4,7 @@ 'use strict'; -/* global EVENT_REORDER */ - +/* import-globals-from ../../mochitest/role.js */ loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR }); addAccessibleTask(` diff --git a/accessible/tests/browser/e10s/browser_treeupdate_hidden.js b/accessible/tests/browser/e10s/browser_treeupdate_hidden.js index 00369ec053e9..50b71b3d9926 100644 --- a/accessible/tests/browser/e10s/browser_treeupdate_hidden.js +++ b/accessible/tests/browser/e10s/browser_treeupdate_hidden.js @@ -4,8 +4,7 @@ 'use strict'; -/* global EVENT_REORDER */ - +/* import-globals-from ../../mochitest/role.js */ loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR }); function* setHidden(browser, value) { diff --git a/accessible/tests/browser/e10s/browser_treeupdate_imagemap.js b/accessible/tests/browser/e10s/browser_treeupdate_imagemap.js index 7f48bf357a0b..a05097d8b60c 100644 --- a/accessible/tests/browser/e10s/browser_treeupdate_imagemap.js +++ b/accessible/tests/browser/e10s/browser_treeupdate_imagemap.js @@ -4,8 +4,7 @@ 'use strict'; -/* global EVENT_REORDER, ROLE_LINK */ - +/* import-globals-from ../../mochitest/role.js */ loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR }); function* testImageMap(browser, accDoc) { diff --git a/accessible/tests/browser/e10s/browser_treeupdate_list.js b/accessible/tests/browser/e10s/browser_treeupdate_list.js index 023adf8e3f2d..e298137556f3 100644 --- a/accessible/tests/browser/e10s/browser_treeupdate_list.js +++ b/accessible/tests/browser/e10s/browser_treeupdate_list.js @@ -4,8 +4,7 @@ 'use strict'; -/* global ROLE_TEXT_LEAF, EVENT_REORDER, ROLE_STATICTEXT, ROLE_LISTITEM */ - +/* import-globals-from ../../mochitest/role.js */ loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR }); function* setDisplayAndWaitForReorder(browser, value) { diff --git a/accessible/tests/browser/e10s/browser_treeupdate_list_editabledoc.js b/accessible/tests/browser/e10s/browser_treeupdate_list_editabledoc.js index 7b01af87abce..013743d14640 100644 --- a/accessible/tests/browser/e10s/browser_treeupdate_list_editabledoc.js +++ b/accessible/tests/browser/e10s/browser_treeupdate_list_editabledoc.js @@ -4,9 +4,7 @@ 'use strict'; -/* global ROLE_TEXT_LEAF, EVENT_REORDER, ROLE_LISTITEM, ROLE_LIST, - ROLE_STATICTEXT */ - +/* import-globals-from ../../mochitest/role.js */ loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR }); addAccessibleTask('
    ', function*(browser, accDoc) { diff --git a/accessible/tests/browser/e10s/browser_treeupdate_listener.js b/accessible/tests/browser/e10s/browser_treeupdate_listener.js index 7b7880312bbe..0da97d6730c4 100644 --- a/accessible/tests/browser/e10s/browser_treeupdate_listener.js +++ b/accessible/tests/browser/e10s/browser_treeupdate_listener.js @@ -4,8 +4,7 @@ 'use strict'; -/* global EVENT_REORDER */ - +/* import-globals-from ../../mochitest/role.js */ loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR }); addAccessibleTask('', diff --git a/accessible/tests/browser/e10s/browser_treeupdate_optgroup.js b/accessible/tests/browser/e10s/browser_treeupdate_optgroup.js index 18953380dcc0..fe806634f4bf 100644 --- a/accessible/tests/browser/e10s/browser_treeupdate_optgroup.js +++ b/accessible/tests/browser/e10s/browser_treeupdate_optgroup.js @@ -4,8 +4,7 @@ 'use strict'; -/* global EVENT_REORDER */ - +/* import-globals-from ../../mochitest/role.js */ loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR }); addAccessibleTask('', function*(browser, accDoc) { diff --git a/accessible/tests/browser/e10s/browser_treeupdate_removal.js b/accessible/tests/browser/e10s/browser_treeupdate_removal.js index 9892bbcd68df..25d909d21145 100644 --- a/accessible/tests/browser/e10s/browser_treeupdate_removal.js +++ b/accessible/tests/browser/e10s/browser_treeupdate_removal.js @@ -4,8 +4,7 @@ 'use strict'; -/* global EVENT_REORDER */ - +/* import-globals-from ../../mochitest/role.js */ loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR }); addAccessibleTask('doc_treeupdate_removal.xhtml', function*(browser, accDoc) { diff --git a/accessible/tests/browser/e10s/browser_treeupdate_table.js b/accessible/tests/browser/e10s/browser_treeupdate_table.js index 9609f51acbdf..bbbd6be3a3b6 100644 --- a/accessible/tests/browser/e10s/browser_treeupdate_table.js +++ b/accessible/tests/browser/e10s/browser_treeupdate_table.js @@ -4,8 +4,7 @@ 'use strict'; -/* global EVENT_REORDER */ - +/* import-globals-from ../../mochitest/role.js */ loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR }); addAccessibleTask(` diff --git a/accessible/tests/browser/e10s/browser_treeupdate_textleaf.js b/accessible/tests/browser/e10s/browser_treeupdate_textleaf.js index da45e2bc9d1c..8e6dab86c8e1 100644 --- a/accessible/tests/browser/e10s/browser_treeupdate_textleaf.js +++ b/accessible/tests/browser/e10s/browser_treeupdate_textleaf.js @@ -4,8 +4,7 @@ 'use strict'; -/* global EVENT_REORDER, ROLE_TEXT_CONTAINER ROLE_PARAGRAPH, ROLE_TEXT_LEAF */ - +/* import-globals-from ../../mochitest/role.js */ loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR }); function* removeTextData(browser, accessible, id, role) { diff --git a/accessible/tests/browser/e10s/browser_treeupdate_visibility.js b/accessible/tests/browser/e10s/browser_treeupdate_visibility.js index 65a55c9149d5..c6752bfcd1f7 100644 --- a/accessible/tests/browser/e10s/browser_treeupdate_visibility.js +++ b/accessible/tests/browser/e10s/browser_treeupdate_visibility.js @@ -4,8 +4,7 @@ 'use strict'; -/* global EVENT_REORDER */ - +/* import-globals-from ../../mochitest/role.js */ loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR }); function* testTreeOnHide(browser, accDoc, containerID, id, before, after) { diff --git a/accessible/tests/browser/e10s/browser_treeupdate_whitespace.js b/accessible/tests/browser/e10s/browser_treeupdate_whitespace.js index c9dbde69175a..03b23c022cab 100644 --- a/accessible/tests/browser/e10s/browser_treeupdate_whitespace.js +++ b/accessible/tests/browser/e10s/browser_treeupdate_whitespace.js @@ -4,8 +4,7 @@ 'use strict'; -/* global EVENT_REORDER */ - +/* import-globals-from ../../mochitest/role.js */ loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR }); addAccessibleTask('doc_treeupdate_whitespace.html', function*(browser, accDoc) { diff --git a/accessible/tests/browser/e10s/events.js b/accessible/tests/browser/e10s/events.js index d7da39d9f49c..bbad02e70035 100644 --- a/accessible/tests/browser/e10s/events.js +++ b/accessible/tests/browser/e10s/events.js @@ -4,8 +4,9 @@ 'use strict'; -/* global nsIAccessibleEvent, nsIAccessibleDocument, - nsIAccessibleStateChangeEvent, nsIAccessibleTextChangeEvent */ +// This is loaded by head.js, so has the same globals, hence we import the +// globals from there. +/* import-globals-from head.js */ /* exported EVENT_REORDER, EVENT_SHOW, EVENT_TEXT_INSERTED, EVENT_TEXT_REMOVED, EVENT_DOCUMENT_LOAD_COMPLETE, EVENT_HIDE, EVENT_TEXT_CARET_MOVED, diff --git a/accessible/tests/browser/e10s/head.js b/accessible/tests/browser/e10s/head.js index 5cc102697ebd..116464c9ef8c 100644 --- a/accessible/tests/browser/e10s/head.js +++ b/accessible/tests/browser/e10s/head.js @@ -4,11 +4,10 @@ 'use strict'; -/* global EVENT_DOCUMENT_LOAD_COMPLETE, CURRENT_CONTENT_DIR, loadFrameScripts */ - -/* exported addAccessibleTask */ +/* exported addAccessibleTask, findAccessibleChildByID, isDefunct */ // Load the shared-head file first. +/* import-globals-from ../shared-head.js */ Services.scriptloader.loadSubScript( 'chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js', this); @@ -79,6 +78,48 @@ function addAccessibleTask(doc, task) { }); } +/** + * Check if an accessible object has a defunct test. + * @param {nsIAccessible} accessible object to test defunct state for + * @return {Boolean} flag indicating defunct state + */ +function isDefunct(accessible) { + let defunct = false; + try { + let extState = {}; + accessible.getState({}, extState); + defunct = extState.value & Ci.nsIAccessibleStates.EXT_STATE_DEFUNCT; + } catch (x) { + defunct = true; + } finally { + if (defunct) { + Logger.log(`Defunct accessible: ${prettyName(accessible)}`); + } + } + return defunct; +} + +/** + * Traverses the accessible tree starting from a given accessible as a root and + * looks for an accessible that matches based on its DOMNode id. + * @param {nsIAccessible} accessible root accessible + * @param {String} id id to look up accessible for + * @return {nsIAccessible?} found accessible if any + */ +function findAccessibleChildByID(accessible, id) { + if (getAccessibleDOMNodeID(accessible) === id) { + return accessible; + } + for (let i = 0; i < accessible.children.length; ++i) { + let found = findAccessibleChildByID(accessible.getChildAt(i), id); + if (found) { + return found; + } + } +} + // Loading and common.js from accessible/tests/mochitest/ for all tests, as // well as events.js. +/* import-globals-from ../../mochitest/common.js */ +/* import-globals-from events.js */ loadScripts({ name: 'common.js', dir: MOCHITESTS_DIR }, 'e10s/events.js'); diff --git a/accessible/tests/browser/head.js b/accessible/tests/browser/head.js index 58b227073447..e44fdac0dafd 100644 --- a/accessible/tests/browser/head.js +++ b/accessible/tests/browser/head.js @@ -33,6 +33,7 @@ function unsetE10sPrefs() { } // Load the shared-head file first. +/* import-globals-from shared-head.js */ Services.scriptloader.loadSubScript( 'chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js', this); diff --git a/accessible/tests/browser/shared-head.js b/accessible/tests/browser/shared-head.js index 83a9fa612fa8..7621fba68541 100644 --- a/accessible/tests/browser/shared-head.js +++ b/accessible/tests/browser/shared-head.js @@ -4,8 +4,8 @@ 'use strict'; -/* exported Logger, MOCHITESTS_DIR, isDefunct, invokeSetAttribute, invokeFocus, - invokeSetStyle, findAccessibleChildByID, getAccessibleDOMNodeID, +/* exported Logger, MOCHITESTS_DIR, invokeSetAttribute, invokeFocus, + invokeSetStyle, getAccessibleDOMNodeID, CURRENT_CONTENT_DIR, loadScripts, loadFrameScripts, Cc, Cu */ const { interfaces: Ci, utils: Cu, classes: Cc } = Components; @@ -77,27 +77,6 @@ let Logger = { } }; -/** - * Check if an accessible object has a defunct test. - * @param {nsIAccessible} accessible object to test defunct state for - * @return {Boolean} flag indicating defunct state - */ -function isDefunct(accessible) { - let defunct = false; - try { - let extState = {}; - accessible.getState({}, extState); - defunct = extState.value & Ci.nsIAccessibleStates.EXT_STATE_DEFUNCT; - } catch (x) { - defunct = true; - } finally { - if (defunct) { - Logger.log(`Defunct accessible: ${prettyName(accessible)}`); - } - } - return defunct; -} - /** * Asynchronously set or remove content element's attribute (in content process * if e10s is enabled). @@ -171,25 +150,6 @@ function invokeFocus(browser, id) { }); } -/** - * Traverses the accessible tree starting from a given accessible as a root and - * looks for an accessible that matches based on its DOMNode id. - * @param {nsIAccessible} accessible root accessible - * @param {String} id id to look up accessible for - * @return {nsIAccessible?} found accessible if any - */ -function findAccessibleChildByID(accessible, id) { - if (getAccessibleDOMNodeID(accessible) === id) { - return accessible; - } - for (let i = 0; i < accessible.children.length; ++i) { - let found = findAccessibleChildByID(accessible.getChildAt(i), id); - if (found) { - return found; - } - } -} - /** * Load a list of scripts into the test * @param {Array} scripts a list of scripts to load diff --git a/accessible/tests/mochitest/jsat/dom_helper.js b/accessible/tests/mochitest/jsat/dom_helper.js index c95d19dc11fa..f244746df689 100644 --- a/accessible/tests/mochitest/jsat/dom_helper.js +++ b/accessible/tests/mochitest/jsat/dom_helper.js @@ -1,7 +1,5 @@ 'use strict'; -/* global getMainChromeWindow, AccessFuTest, GestureSettings, GestureTracker, - SimpleTest, getBoundsForDOMElm, Point, Utils */ /* exported loadJSON, eventMap */ var Ci = Components.interfaces; diff --git a/accessible/tests/mochitest/treeupdate/test_ariaowns.html b/accessible/tests/mochitest/treeupdate/test_ariaowns.html index 8382699653a1..71639e74e565 100644 --- a/accessible/tests/mochitest/treeupdate/test_ariaowns.html +++ b/accessible/tests/mochitest/treeupdate/test_ariaowns.html @@ -587,15 +587,16 @@ ]; this.invoke = () => { - getNode('t9_container').src = - `data:text/html, - - From 3b84e93d4ae0e711ebd91dbd313861f3c5f3a2f8 Mon Sep 17 00:00:00 2001 From: Lie Ryan Date: Sun, 9 Apr 2017 16:05:10 +0000 Subject: [PATCH 025/111] Bug 1352572 - Fix misleading/incorrect comment in streamTest; r=bsmedberg MozReview-Commit-ID: 7c8bLjMuqI2 --HG-- extra : rebase_source : 7bfa1cc78f638bccfaf65c6acac3eab0c01c2881 --- dom/plugins/test/testplugin/nptest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/plugins/test/testplugin/nptest.cpp b/dom/plugins/test/testplugin/nptest.cpp index a59679b8e9e0..01834ac21cba 100644 --- a/dom/plugins/test/testplugin/nptest.cpp +++ b/dom/plugins/test/testplugin/nptest.cpp @@ -2721,7 +2721,7 @@ convertPointY(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVaria static bool streamTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result) { - // .streamTest(url, doPost, doNull, writeCallback, notifyCallback, redirectCallback, allowRedirects) + // .streamTest(url, doPost, postData, writeCallback, notifyCallback, redirectCallback, allowRedirects) if (7 != argCount) return false; From d52bc4b27e450c2aad6d698bc1c97b1e6c45dcd2 Mon Sep 17 00:00:00 2001 From: Lie Ryan Date: Thu, 27 Apr 2017 03:10:59 +0000 Subject: [PATCH 026/111] Bug 1352572 - Implement nptest.cpp:streamTest(postFile) parameter; r=bsmedberg This is an optional parameter that can be used to test streams via file. It may be necessary to back out this change when NPAPI sandbox is completed as the testplugin may no longer be able to access files. MozReview-Commit-ID: FsYxhKKr4hS --HG-- extra : rebase_source : 5ee413531b5b178c92a1d5cf5c2223e624e02296 --- dom/plugins/test/testplugin/README | 3 ++- dom/plugins/test/testplugin/nptest.cpp | 14 +++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/dom/plugins/test/testplugin/README b/dom/plugins/test/testplugin/README index 827c0ac14afc..af2319e3e1d8 100644 --- a/dom/plugins/test/testplugin/README +++ b/dom/plugins/test/testplugin/README @@ -372,7 +372,7 @@ If the plugin is instantiated as a full-page plugin, the following defaults are used: streammode="seek" frame="testframe" range="100,100" -* streamTest(url, doPost, postData, writeCallback, notifyCallback, redirectCallback, allowRedirects) +* streamTest(url, doPost, postData, writeCallback, notifyCallback, redirectCallback, allowRedirects, postFile = false) This will test how NPN_GetURLNotify and NPN_PostURLNotify behave when they are called with arbitrary (malformed) URLs. The function will return `true` if NPN_[Get/Post]URLNotify succeeds, and `false` if it fails. @@ -383,6 +383,7 @@ NPN_[Get/Post]URLNotify succeeds, and `false` if it fails. @notifyCallback will be called when the urlnotify is received with the notify result @redirectCallback will be called from urlredirectnotify if a redirect is attempted @allowRedirects boolean value indicating whether or not to allow redirects +@postFile boolean optional, defaults to false, set to true if postData contains a filename * postFileToURLTest(url) Calls NPN_PostURL/NPN_PostURLNotify to make a POST request to the URL with diff --git a/dom/plugins/test/testplugin/nptest.cpp b/dom/plugins/test/testplugin/nptest.cpp index 01834ac21cba..2d505c8eafd4 100644 --- a/dom/plugins/test/testplugin/nptest.cpp +++ b/dom/plugins/test/testplugin/nptest.cpp @@ -2721,8 +2721,8 @@ convertPointY(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVaria static bool streamTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result) { - // .streamTest(url, doPost, postData, writeCallback, notifyCallback, redirectCallback, allowRedirects) - if (7 != argCount) + // .streamTest(url, doPost, postData, writeCallback, notifyCallback, redirectCallback, allowRedirects, postFile = false) + if (!(7 <= argCount && argCount <= 8)) return false; NPP npp = static_cast(npobj)->npp; @@ -2779,6 +2779,14 @@ streamTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* return false; bool allowRedirects = NPVARIANT_TO_BOOLEAN(args[6]); + bool postFile = false; + if (argCount >= 8) { + if (!NPVARIANT_IS_BOOLEAN(args[7])) { + return false; + } + postFile = NPVARIANT_TO_BOOLEAN(args[7]); + } + URLNotifyData* ndata = new URLNotifyData; ndata->cookie = "dynamic-cookie"; ndata->writeCallback = writeCallback; @@ -2797,7 +2805,7 @@ streamTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* if (doPost) { err = NPN_PostURLNotify(npp, urlstr, nullptr, postData.UTF8Length, postData.UTF8Characters, - false, ndata); + postFile, ndata); } else { err = NPN_GetURLNotify(npp, urlstr, nullptr, ndata); From 32b857541b7d11ebf2940d5d997cd1d8dca6ae65 Mon Sep 17 00:00:00 2001 From: Lie Ryan Date: Tue, 11 Apr 2017 13:27:50 +0000 Subject: [PATCH 027/111] Bug 1352572 - Add negative test for NPN_PostURLNotify(); r=bsmedberg Note that this test never actually fails short of passing file parameter to NPN_PostURLNotify actually causing the browser to crash. It can't distinguish between the case when file is working or not. MozReview-Commit-ID: 1G590ZWpHsE --HG-- extra : rebase_source : c294bc109b893c81b6ee4c3114bb039eab77af08 --- dom/plugins/test/mochitest/test_streamNotify.html | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dom/plugins/test/mochitest/test_streamNotify.html b/dom/plugins/test/mochitest/test_streamNotify.html index 6db407946cde..43e2fbc3e593 100644 --- a/dom/plugins/test/mochitest/test_streamNotify.html +++ b/dom/plugins/test/mochitest/test_streamNotify.html @@ -85,6 +85,15 @@ }, null, true), "streamTest GET bad data: URI"); ok(!p.postFileToURLTest("post.sjs"), "postFileToURLTest POST a file"); + + ok(!p.streamTest("post.sjs", true, "non-existent-file", + function(r, t) { + ok(false, "Shouldn't get write callback from file post"); + }, function(r, t) { + ok(false, "Shouldn't get notify callback from file post"); + }, function(r, t) { + ok(false, "Shouldn't get redirect callback from file post"); + }, true, true), "streamTest POST a file"); } From 9db89db4950379628c591e61b71bf42d9795d30f Mon Sep 17 00:00:00 2001 From: Lie Ryan Date: Sat, 6 May 2017 07:27:08 +0000 Subject: [PATCH 028/111] Bug 1352572 - Return NPERR_GENERIC_ERROR if plugin calls NPN_PostURLNotify(file=true); r=bsmedberg NPN_PostURLNotify(file=true) is no longer supported in NPAPI. MozReview-Commit-ID: 12JlYduC7R8 --HG-- extra : rebase_source : dc9bd752f74b727d003c1371211095bc6656b8d3 --- dom/plugins/ipc/PluginModuleChild.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp index a47def2716c2..aeecd8aeff88 100644 --- a/dom/plugins/ipc/PluginModuleChild.cpp +++ b/dom/plugins/ipc/PluginModuleChild.cpp @@ -1169,6 +1169,11 @@ _posturlnotify(NPP aNPP, if (!aBuffer) return NPERR_INVALID_PARAM; + if (aIsFile) { + PLUGIN_LOG_DEBUG(("NPN_PostURLNotify with file=true is no longer supported")); + return NPERR_GENERIC_ERROR; + } + nsCString url = NullableString(aRelativeURL); auto* sn = new StreamNotifyChild(url); From 70866b3ba52f52c4d5252dee7614f4533033cc0f Mon Sep 17 00:00:00 2001 From: Lie Ryan Date: Wed, 12 Apr 2017 14:28:50 +0000 Subject: [PATCH 029/111] Bug 1352572 - Remove unused code that implement NPN_PostURLNotify(file=true) and NPN_PostURL(file=true); r=bsmedberg - Remove nsNPAPIPlugin.cpp:MakeNewNPAPIStreamInternal(file) parameter - Remove nsPluginHost::PostURL(isFile) parameter - Remove nsPluginHost::CreateTempFileToPost() unused function MozReview-Commit-ID: 7bCBzGz9oSM --HG-- extra : rebase_source : f59948b85e0da7baa9aec90878ebd6b76a5a3ca3 --- dom/plugins/base/nsNPAPIPlugin.cpp | 8 +- dom/plugins/base/nsPluginHost.cpp | 153 +++-------------------------- dom/plugins/base/nsPluginHost.h | 2 - 3 files changed, 19 insertions(+), 144 deletions(-) diff --git a/dom/plugins/base/nsNPAPIPlugin.cpp b/dom/plugins/base/nsNPAPIPlugin.cpp index 31fa7aa1484f..862d480e182d 100644 --- a/dom/plugins/base/nsNPAPIPlugin.cpp +++ b/dom/plugins/base/nsNPAPIPlugin.cpp @@ -391,7 +391,7 @@ MakeNewNPAPIStreamInternal(NPP npp, const char *relativeURL, const char *target, eNPPStreamTypeInternal type, bool bDoNotify = false, void *notifyData = nullptr, uint32_t len = 0, - const char *buf = nullptr, NPBool file = false) + const char *buf = nullptr) { if (!npp) return NPERR_INVALID_INSTANCE_ERROR; @@ -432,7 +432,7 @@ MakeNewNPAPIStreamInternal(NPP npp, const char *relativeURL, const char *target, } case eNPPStreamTypeInternal_Post: { - if (NS_FAILED(pluginHost->PostURL(inst, relativeURL, len, buf, file, + if (NS_FAILED(pluginHost->PostURL(inst, relativeURL, len, buf, target, listener, nullptr, nullptr, false, 0, nullptr))) return NPERR_GENERIC_ERROR; @@ -753,7 +753,7 @@ _posturlnotify(NPP npp, const char *relativeURL, const char *target, return MakeNewNPAPIStreamInternal(npp, relativeURL, target, eNPPStreamTypeInternal_Post, true, - notifyData, len, buf, file); + notifyData, len, buf); } NPError @@ -773,7 +773,7 @@ _posturl(NPP npp, const char *relativeURL, const char *target, return MakeNewNPAPIStreamInternal(npp, relativeURL, target, eNPPStreamTypeInternal_Post, false, nullptr, - len, buf, file); + len, buf); } NPError diff --git a/dom/plugins/base/nsPluginHost.cpp b/dom/plugins/base/nsPluginHost.cpp index e11b5f5ae979..d365c2b2392b 100644 --- a/dom/plugins/base/nsPluginHost.cpp +++ b/dom/plugins/base/nsPluginHost.cpp @@ -509,7 +509,6 @@ nsresult nsPluginHost::PostURL(nsISupports* pluginInst, const char* url, uint32_t postDataLen, const char* postData, - bool isFile, const char* target, nsNPAPIPluginStreamListener* streamListener, const char* altHost, @@ -529,45 +528,24 @@ nsresult nsPluginHost::PostURL(nsISupports* pluginInst, nsNPAPIPluginInstance* instance = static_cast(pluginInst); nsCOMPtr postStream; - if (isFile) { - nsCOMPtr file; - rv = CreateTempFileToPost(postData, getter_AddRefs(file)); - if (NS_FAILED(rv)) - return rv; + char *dataToPost; + uint32_t newDataToPostLen; + ParsePostBufferToFixHeaders(postData, postDataLen, &dataToPost, &newDataToPostLen); + if (!dataToPost) + return NS_ERROR_UNEXPECTED; - nsCOMPtr fileStream; - rv = NS_NewLocalFileInputStream(getter_AddRefs(fileStream), - file, - PR_RDONLY, - 0600, - nsIFileInputStream::DELETE_ON_CLOSE | - nsIFileInputStream::CLOSE_ON_EOF); - if (NS_FAILED(rv)) - return rv; - - rv = NS_NewBufferedInputStream(getter_AddRefs(postStream), fileStream, 8192); - if (NS_FAILED(rv)) - return rv; - } else { - char *dataToPost; - uint32_t newDataToPostLen; - ParsePostBufferToFixHeaders(postData, postDataLen, &dataToPost, &newDataToPostLen); - if (!dataToPost) - return NS_ERROR_UNEXPECTED; - - nsCOMPtr sis = do_CreateInstance("@mozilla.org/io/string-input-stream;1", &rv); - if (!sis) { - free(dataToPost); - return rv; - } - - // data allocated by ParsePostBufferToFixHeaders() is managed and - // freed by the string stream. - postDataLen = newDataToPostLen; - sis->AdoptData(dataToPost, postDataLen); - postStream = sis; + nsCOMPtr sis = do_CreateInstance("@mozilla.org/io/string-input-stream;1", &rv); + if (!sis) { + free(dataToPost); + return rv; } + // data allocated by ParsePostBufferToFixHeaders() is managed and + // freed by the string stream. + postDataLen = newDataToPostLen; + sis->AdoptData(dataToPost, postDataLen); + postStream = sis; + if (target) { RefPtr owner = instance->GetOwner(); if (owner) { @@ -3587,107 +3565,6 @@ nsPluginHost::ParsePostBufferToFixHeaders(const char *inPostData, uint32_t inPos return NS_OK; } -nsresult -nsPluginHost::CreateTempFileToPost(const char *aPostDataURL, nsIFile **aTmpFile) -{ - nsresult rv; - int64_t fileSize; - nsAutoCString filename; - - // stat file == get size & convert file:///c:/ to c: if needed - nsCOMPtr inFile; - rv = NS_GetFileFromURLSpec(nsDependentCString(aPostDataURL), - getter_AddRefs(inFile)); - if (NS_FAILED(rv)) { - nsCOMPtr localFile; - rv = NS_NewNativeLocalFile(nsDependentCString(aPostDataURL), false, - getter_AddRefs(localFile)); - if (NS_FAILED(rv)) return rv; - inFile = localFile; - } - rv = inFile->GetFileSize(&fileSize); - if (NS_FAILED(rv)) return rv; - rv = inFile->GetNativePath(filename); - if (NS_FAILED(rv)) return rv; - - if (fileSize != 0) { - nsCOMPtr inStream; - rv = NS_NewLocalFileInputStream(getter_AddRefs(inStream), inFile); - if (NS_FAILED(rv)) return rv; - - // Create a temporary file to write the http Content-length: - // %ld\r\n\" header and "\r\n" == end of headers for post data to - - nsCOMPtr tempFile; - rv = GetPluginTempDir(getter_AddRefs(tempFile)); - if (NS_FAILED(rv)) - return rv; - - nsAutoCString inFileName; - inFile->GetNativeLeafName(inFileName); - // XXX hack around bug 70083 - inFileName.Insert(NS_LITERAL_CSTRING("post-"), 0); - rv = tempFile->AppendNative(inFileName); - - if (NS_FAILED(rv)) - return rv; - - // make it unique, and mode == 0600, not world-readable - rv = tempFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0600); - if (NS_FAILED(rv)) - return rv; - - nsCOMPtr outStream; - if (NS_SUCCEEDED(rv)) { - rv = NS_NewLocalFileOutputStream(getter_AddRefs(outStream), - tempFile, - (PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE), - 0600); // 600 so others can't read our form data - } - NS_ASSERTION(NS_SUCCEEDED(rv), "Post data file couldn't be created!"); - if (NS_FAILED(rv)) - return rv; - - char buf[1024]; - uint32_t br, bw; - bool firstRead = true; - while (true) { - // Read() mallocs if buffer is null - rv = inStream->Read(buf, 1024, &br); - if (NS_FAILED(rv) || (int32_t)br <= 0) - break; - if (firstRead) { - //"For protocols in which the headers must be distinguished from the body, - // such as HTTP, the buffer or file should contain the headers, followed by - // a blank line, then the body. If no custom headers are required, simply - // add a blank line ('\n') to the beginning of the file or buffer. - - char *parsedBuf; - // assuming first 1K (or what we got) has all headers in, - // lets parse it through nsPluginHost::ParsePostBufferToFixHeaders() - ParsePostBufferToFixHeaders((const char *)buf, br, &parsedBuf, &bw); - rv = outStream->Write(parsedBuf, bw, &br); - free(parsedBuf); - if (NS_FAILED(rv) || (bw != br)) - break; - - firstRead = false; - continue; - } - bw = br; - rv = outStream->Write(buf, bw, &br); - if (NS_FAILED(rv) || (bw != br)) - break; - } - - inStream->Close(); - outStream->Close(); - if (NS_SUCCEEDED(rv)) - tempFile.forget(aTmpFile); - } - return rv; -} - nsresult nsPluginHost::NewPluginNativeWindow(nsPluginNativeWindow ** aPluginNativeWindow) { diff --git a/dom/plugins/base/nsPluginHost.h b/dom/plugins/base/nsPluginHost.h index 6f929798e63c..ac800a6e2dea 100644 --- a/dom/plugins/base/nsPluginHost.h +++ b/dom/plugins/base/nsPluginHost.h @@ -130,7 +130,6 @@ public: const char* url, uint32_t postDataLen, const char* postData, - bool isFile, const char* target, nsNPAPIPluginStreamListener* streamListener, const char* altHost, @@ -144,7 +143,6 @@ public: uint32_t inPostDataLen, char **outPostData, uint32_t *outPostDataLen); - nsresult CreateTempFileToPost(const char *aPostDataURL, nsIFile **aTmpFile); nsresult NewPluginNativeWindow(nsPluginNativeWindow ** aPluginNativeWindow); void AddIdleTimeTarget(nsIPluginInstanceOwner* objectFrame, bool isVisible); From 782bcc8ba0c3091f6318583fad76c6909ee75bc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Sat, 6 May 2017 01:20:29 +0200 Subject: [PATCH 030/111] Bug 1362595 - Clean up handling of hidden tabs in restoreWindow. r=mikedeboer restoreWindow only opens new tabs rather than re-use pre-existing tabs, so there's no point in calling showTab anymore. hideTab also will not hide the selected tab, so the "all tabs to be restored are hidden" case can't happen. MozReview-Commit-ID: FzmRcjprkuN --HG-- extra : rebase_source : 9e7bbdb4c56220b148636e332c4d518b46c71a37 --- browser/components/sessionstore/SessionStore.jsm | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/browser/components/sessionstore/SessionStore.jsm b/browser/components/sessionstore/SessionStore.jsm index a740c0f02b05..88c252f4f6b8 100644 --- a/browser/components/sessionstore/SessionStore.jsm +++ b/browser/components/sessionstore/SessionStore.jsm @@ -3278,8 +3278,6 @@ var SessionStoreInternal = { initialTabs = Array.slice(tabbrowser.tabs); } - let numVisibleTabs = 0; - let restoreTabsLazily = this._prefBranch.getBoolPref("sessionstore.restore_tabs_lazily") && this._prefBranch.getBoolPref("sessionstore.restore_on_demand"); @@ -3309,9 +3307,6 @@ var SessionStoreInternal = { if (winData.tabs[t].hidden) { tabbrowser.hideTab(tabs[t]); - } else { - tabbrowser.showTab(tabs[t]); - numVisibleTabs++; } } @@ -3335,12 +3330,6 @@ var SessionStoreInternal = { } } - // if all tabs to be restored are hidden, make the first one visible - if (!numVisibleTabs && winData.tabs.length) { - winData.tabs[0].hidden = false; - tabbrowser.showTab(tabs[0]); - } - // We want to correlate the window with data from the last session, so // assign another id if we have one. Otherwise clear so we don't do // anything with it. From c15d6d33912f905ea0b2f58c57398a747c21a200 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Tue, 9 May 2017 19:11:45 +0200 Subject: [PATCH 031/111] Bug 1363118 - Rename browser.shell.skipDefaultBrowserCheck pref for clarity. r=Gijs MozReview-Commit-ID: G7a825GWul --HG-- extra : rebase_source : b0fc372b702ef35ca900e12d5dd67e07bfcbede0 --- browser/app/profile/firefox.js | 2 +- browser/components/nsBrowserGlue.js | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 19dc4101560c..a748a9d7fff6 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -238,7 +238,7 @@ pref("browser.shell.skipDefaultBrowserCheckOnFirstRun", false); #else pref("browser.shell.skipDefaultBrowserCheckOnFirstRun", true); #endif -pref("browser.shell.skipDefaultBrowserCheck", true); +pref("browser.shell.didSkipDefaultBrowserCheckOnFirstRun", false); pref("browser.shell.defaultBrowserCheckCount", 0); pref("browser.defaultbrowser.notificationbar", false); diff --git a/browser/components/nsBrowserGlue.js b/browser/components/nsBrowserGlue.js index e5a39bb5faa7..c98649d6d27d 100644 --- a/browser/components/nsBrowserGlue.js +++ b/browser/components/nsBrowserGlue.js @@ -1070,7 +1070,7 @@ BrowserGlue.prototype = { const skipDefaultBrowserCheck = Services.prefs.getBoolPref("browser.shell.skipDefaultBrowserCheckOnFirstRun") && - Services.prefs.getBoolPref("browser.shell.skipDefaultBrowserCheck"); + !Services.prefs.getBoolPref("browser.shell.didSkipDefaultBrowserCheckOnFirstRun"); const usePromptLimit = !AppConstants.RELEASE_OR_BETA; let promptCount = @@ -1104,7 +1104,7 @@ BrowserGlue.prototype = { // browser has been run a few times. if (willPrompt) { if (skipDefaultBrowserCheck) { - Services.prefs.setBoolPref("browser.shell.skipDefaultBrowserCheck", false); + Services.prefs.setBoolPref("browser.shell.didSkipDefaultBrowserCheckOnFirstRun", true); willPrompt = false; } else { promptCount++; @@ -1666,8 +1666,9 @@ BrowserGlue.prototype = { AlertsService.showAlertNotification(null, title, body, true, null, clickCallback); }, + // eslint-disable-next-line complexity _migrateUI: function BG__migrateUI() { - const UI_VERSION = 44; + const UI_VERSION = 45; const BROWSER_DOCURL = "chrome://browser/content/browser.xul"; let currentUIVersion; @@ -1961,6 +1962,15 @@ BrowserGlue.prototype = { Services.prefs.clearUserPref("alerts.disableSlidingEffect"); } + if (currentUIVersion < 45) { + const LEGACY_PREF = "browser.shell.skipDefaultBrowserCheck"; + if (Services.prefs.prefHasUserValue(LEGACY_PREF)) { + Services.prefs.setBoolPref("browser.shell.didSkipDefaultBrowserCheckOnFirstRun", + !Services.prefs.getBoolPref(LEGACY_PREF)); + Services.prefs.clearUserPref(LEGACY_PREF); + } + } + // Update the migration version. Services.prefs.setIntPref("browser.migration.version", UI_VERSION); }, From fd32e8da4a0df88351a27f7323e430d57fac55ae Mon Sep 17 00:00:00 2001 From: Hemant Singh Patwal Date: Tue, 9 May 2017 19:48:02 +0530 Subject: [PATCH 032/111] Bug 1359614 - Move the security/manager/.eslintrc.js to security/.eslintrc.js and fix the ESLint issues raised. r=standard8 MozReview-Commit-ID: AlfInBsIPnF --HG-- rename : security/manager/.eslintrc.js => security/.eslintrc.js extra : rebase_source : 4dfdd45a4f1e4d3e45e2ef353dd0bb343a3d1adb --- security/{manager => }/.eslintrc.js | 0 security/sandbox/test/.eslintrc.js | 5 ++++ .../test/browser_content_sandbox_fs.js | 28 +++++++++++-------- .../test/browser_content_sandbox_syscalls.js | 17 ++++++----- .../test/browser_content_sandbox_utils.js | 9 +++--- 5 files changed, 34 insertions(+), 25 deletions(-) rename security/{manager => }/.eslintrc.js (100%) create mode 100644 security/sandbox/test/.eslintrc.js diff --git a/security/manager/.eslintrc.js b/security/.eslintrc.js similarity index 100% rename from security/manager/.eslintrc.js rename to security/.eslintrc.js diff --git a/security/sandbox/test/.eslintrc.js b/security/sandbox/test/.eslintrc.js new file mode 100644 index 000000000000..e66abe2c2807 --- /dev/null +++ b/security/sandbox/test/.eslintrc.js @@ -0,0 +1,5 @@ +"use strict"; + +module.exports = { + "extends": "plugin:mozilla/browser-test" +}; diff --git a/security/sandbox/test/browser_content_sandbox_fs.js b/security/sandbox/test/browser_content_sandbox_fs.js index cac0e00adf62..a29e09c09f12 100644 --- a/security/sandbox/test/browser_content_sandbox_fs.js +++ b/security/sandbox/test/browser_content_sandbox_fs.js @@ -1,5 +1,7 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ + /* import-globals-from browser_content_sandbox_utils.js */ + "use strict"; var prefs = Cc["@mozilla.org/preferences-service;1"] .getService(Ci.nsIPrefBranch); @@ -51,9 +53,9 @@ function readDir(path) { numEntries++; }).then(function () { iterator.close(); - return {ok: true, numEntries: numEntries}; + return {ok: true, numEntries}; }).catch(function () { - return {ok: false, numEntries: numEntries}; + return {ok: false, numEntries}; }); return promise; } @@ -108,6 +110,7 @@ function minProfileReadSandboxLevel(level) { return 3; default: Assert.ok(false, "Unknown OS"); + return 0; } } @@ -123,6 +126,7 @@ function minHomeReadSandboxLevel(level) { return 3; default: Assert.ok(false, "Unknown OS"); + return 0; } } @@ -141,7 +145,7 @@ function minHomeReadSandboxLevel(level) { // Tests reading various files and directories from file and web // content processes. // -add_task(function*() { +add_task(function* () { // This test is only relevant in e10s if (!gMultiProcessBrowser) { ok(false, "e10s is enabled"); @@ -298,7 +302,7 @@ function* testFileAccess() { // If ~/Library/Caches/TemporaryItems exists, when level <= 2 we // make sure it's readable. For level 3, we make sure it isn't. let homeTempDir = GetHomeDir(); - homeTempDir.appendRelativePath('Library/Caches/TemporaryItems'); + homeTempDir.appendRelativePath("Library/Caches/TemporaryItems"); if (homeTempDir.exists()) { let shouldBeReadable, minLevel; if (level >= minHomeReadSandboxLevel()) { @@ -313,7 +317,7 @@ function* testFileAccess() { ok: shouldBeReadable, browser: webBrowser, file: homeTempDir, - minLevel: minLevel, + minLevel, }); } } @@ -330,7 +334,7 @@ function* testFileAccess() { // Mac sandbox rules use /private/var because /var is a symlink // to /private/var on OS X. Make sure that hasn't changed. varDir.normalize(); - Assert.ok(varDir.path === '/private/var', '/var resolves to /private/var'); + Assert.ok(varDir.path === "/private/var", "/var resolves to /private/var"); tests.push({ desc: "/var", @@ -354,11 +358,11 @@ function* testFileAccess() { // Test if we can read from $TMPDIR because we expect it // to be within /private/var. Reading from it should be // prevented in a 'web' process. - let macTempDir = GetDirFromEnvVariable('TMPDIR'); + let macTempDir = GetDirFromEnvVariable("TMPDIR"); macTempDir.normalize(); - Assert.ok(macTempDir.path.startsWith('/private/var'), - '$TMPDIR is in /private/var'); + Assert.ok(macTempDir.path.startsWith("/private/var"), + "$TMPDIR is in /private/var"); tests.push({ desc: `$TMPDIR (${macTempDir.path})`, @@ -418,11 +422,11 @@ function* testFileAccess() { } // remove tests not enabled by the current sandbox level - tests = tests.filter((test) => { return (test.minLevel <= level); }); + tests = tests.filter((test) => (test.minLevel <= level)); for (let test of tests) { - let testFunc = test.file.isDirectory? readDir : readFile; - let okString = test.ok? "allowed" : "blocked"; + let testFunc = test.file.isDirectory ? readDir : readFile; + let okString = test.ok ? "allowed" : "blocked"; let processType = test.browser === webBrowser ? "web" : "file"; let result = yield ContentTask.spawn(test.browser, test.file.path, diff --git a/security/sandbox/test/browser_content_sandbox_syscalls.js b/security/sandbox/test/browser_content_sandbox_syscalls.js index e4760f98fe8f..1027d0a4a4f2 100644 --- a/security/sandbox/test/browser_content_sandbox_syscalls.js +++ b/security/sandbox/test/browser_content_sandbox_syscalls.js @@ -1,5 +1,7 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ + /* import-globals-from browser_content_sandbox_utils.js */ +"use strict"; var prefs = Cc["@mozilla.org/preferences-service;1"] .getService(Ci.nsIPrefBranch); @@ -60,12 +62,11 @@ function openWriteCreateFlags() { let O_WRONLY = 0x001; let O_CREAT = 0x200; return (O_WRONLY | O_CREAT); - } else { + } // Linux let O_WRONLY = 0x01; let O_CREAT = 0x40; return (O_WRONLY | O_CREAT); - } } // Returns the name of the native library needed for native syscalls @@ -79,6 +80,7 @@ function getOSLib() { return "libc.so.6"; default: Assert.ok(false, "Unknown OS"); + return 0; } } @@ -119,7 +121,7 @@ function areContentSyscallsSandboxed(level) { // Tests executing OS API calls in the content process. Limited to Mac // and Linux calls for now. // -add_task(function*() { +add_task(function* () { // This test is only relevant in e10s if (!gMultiProcessBrowser) { ok(false, "e10s is enabled"); @@ -175,8 +177,7 @@ add_task(function*() { } // use open syscall - if (isLinux() || isMac()) - { + if (isLinux() || isMac()) { // open a file for writing in $HOME, this should fail let path = fileInHomeDir().path; let flags = openWriteCreateFlags(); @@ -185,8 +186,7 @@ add_task(function*() { } // use open syscall - if (isLinux() || isMac()) - { + if (isLinux() || isMac()) { // open a file for writing in the content temp dir, this should work // and the open handler in the content process closes the file for us let path = fileInTempDir().path; @@ -196,8 +196,7 @@ add_task(function*() { } // use fork syscall - if (isLinux() || isMac()) - { + if (isLinux() || isMac()) { let rv = yield ContentTask.spawn(browser, {lib}, callFork); ok(rv == -1, "calling fork is not permitted"); } diff --git a/security/sandbox/test/browser_content_sandbox_utils.js b/security/sandbox/test/browser_content_sandbox_utils.js index c47209b749d2..d51cbf825284 100644 --- a/security/sandbox/test/browser_content_sandbox_utils.js +++ b/security/sandbox/test/browser_content_sandbox_utils.js @@ -1,5 +1,6 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; const uuidGenerator = Cc["@mozilla.org/uuid-generator;1"] .getService(Ci.nsIUUIDGenerator); @@ -10,9 +11,9 @@ const environment = Cc["@mozilla.org/process/environment;1"] * Utility functions for the browser content sandbox tests. */ -function isMac() { return Services.appinfo.OS == "Darwin" } -function isWin() { return Services.appinfo.OS == "WINNT" } -function isLinux() { return Services.appinfo.OS == "Linux" } +function isMac() { return Services.appinfo.OS == "Darwin"; } +function isWin() { return Services.appinfo.OS == "WINNT"; } +function isLinux() { return Services.appinfo.OS == "Linux"; } function isNightly() { let version = SpecialPowers.Cc["@mozilla.org/xre/app-info;1"]. @@ -79,7 +80,7 @@ function GetProfileEntry(name) { } function GetDir(path) { - let dir = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsILocalFile); + let dir = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile); dir.initWithPath(path); Assert.ok(dir.isDirectory(), `${path} is a directory`); return (dir); From 30dd990bb9f97fcd8cbf5f3f2c9cb8574298af22 Mon Sep 17 00:00:00 2001 From: Brian Grinstead Date: Sat, 6 May 2017 13:01:59 -0700 Subject: [PATCH 033/111] Bug 1361140 - Key openRequests and openResponses by channel instead of id for faster lookups;r=Honza MozReview-Commit-ID: LKpy7SCYcZj --HG-- extra : rebase_source : f0e9a2183a07b4312c333aef0734bf1df6eea327 --- devtools/shared/webconsole/network-monitor.js | 36 ++++++------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/devtools/shared/webconsole/network-monitor.js b/devtools/shared/webconsole/network-monitor.js index 30ac92eeecca..dca333880133 100644 --- a/devtools/shared/webconsole/network-monitor.js +++ b/devtools/shared/webconsole/network-monitor.js @@ -537,22 +537,14 @@ NetworkResponseListener.prototype = { return; } - let openResponse = null; - - for (let id in this.owner.openResponses) { - let item = this.owner.openResponses[id]; - if (item.channel === this.httpActivity.channel) { - openResponse = item; - break; - } - } - + let channel = this.httpActivity.channel; + let openResponse = this.owner.openResponses.get(channel.channelId); if (!openResponse) { return; } this._foundOpenResponse = true; - delete this.owner.openResponses[openResponse.id]; + this.owner.openResponses.delete(channel.channelId); this.httpActivity.owner.addResponseHeaders(openResponse.headers); this.httpActivity.owner.addResponseCookies(openResponse.cookies); @@ -709,8 +701,8 @@ NetworkResponseListener.prototype = { function NetworkMonitor(filters, owner) { this.filters = filters; this.owner = owner; - this.openRequests = {}; - this.openResponses = {}; + this.openRequests = new Map(); + this.openResponses = new Map(); this._httpResponseExaminer = DevToolsUtils.makeInfallible(this._httpResponseExaminer).bind(this); this._httpModifyExaminer = @@ -894,7 +886,7 @@ NetworkMonitor.prototype = { response.httpVersion = "HTTP/" + httpVersionMaj.value + "." + httpVersionMin.value; - this.openResponses[response.id] = response; + this.openResponses.set(channel.channelId, response); if (topic === "http-on-examine-cached-response") { // Service worker requests emits cached-reponse notification on non-e10s, @@ -1178,13 +1170,7 @@ NetworkMonitor.prototype = { * The HTTP activity object, or null if it is not found. */ _findActivityObject: function (channel) { - for (let id in this.openRequests) { - let item = this.openRequests[id]; - if (item.channel === channel) { - return item; - } - } - return null; + return this.openRequests.get(channel.channelId) || null; }, /** @@ -1226,7 +1212,7 @@ NetworkMonitor.prototype = { owner: null, }; - this.openRequests[httpActivity.id] = httpActivity; + this.openRequests.set(channel.channelId, httpActivity); } return httpActivity; @@ -1377,7 +1363,7 @@ NetworkMonitor.prototype = { _onTransactionClose: function (httpActivity) { let result = this._setupHarTimings(httpActivity); httpActivity.owner.addEventTimings(result.total, result.timings); - delete this.openRequests[httpActivity.id]; + this.openRequests.delete(httpActivity.channel.channelId); }, /** @@ -1496,8 +1482,8 @@ NetworkMonitor.prototype = { "service-worker-synthesized-response"); this.interceptedChannels.clear(); - this.openRequests = {}; - this.openResponses = {}; + this.openRequests.clear(); + this.openResponses.clear(); this.owner = null; this.filters = null; this._throttler = null; From 8e6d07eea76e8c1c60c5e2e689662ba71a22af92 Mon Sep 17 00:00:00 2001 From: Vangelis Katsikaros Date: Sun, 30 Apr 2017 15:41:52 +0300 Subject: [PATCH 034/111] Bug 1358956 - Remove the first separator from the status bar. r=Honza MozReview-Commit-ID: JyxmI475sog --HG-- extra : rebase_source : a8688d0a0ddce7148dda18c5ce699f6a3fbd57ee --- devtools/client/netmonitor/src/assets/styles/netmonitor.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devtools/client/netmonitor/src/assets/styles/netmonitor.css b/devtools/client/netmonitor/src/assets/styles/netmonitor.css index ba7c1758dd7d..d322ca67cda3 100644 --- a/devtools/client/netmonitor/src/assets/styles/netmonitor.css +++ b/devtools/client/netmonitor/src/assets/styles/netmonitor.css @@ -119,7 +119,7 @@ body, white-space: nowrap; } -.status-bar-label::before { +.status-bar-label:not(:first-of-type)::before { content: ""; display: inline-block; margin-inline-end: 10px; From 6b2ba203986e4ff2647d80a0f40931b04adb5d9f Mon Sep 17 00:00:00 2001 From: Ricky Chien Date: Mon, 8 May 2017 23:59:50 +0800 Subject: [PATCH 035/111] Bug 1363062 - Fix broken data-hidden-from-search=true search result r=mconley MozReview-Commit-ID: 8W62qNSidcx --HG-- extra : rebase_source : ef06763e69b1cff93cf66f8ba1d7a1da7c9f9bf2 --- browser/components/preferences/in-content/findInPage.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/browser/components/preferences/in-content/findInPage.js b/browser/components/preferences/in-content/findInPage.js index adfab0696cf5..d012422b4f99 100644 --- a/browser/components/preferences/in-content/findInPage.js +++ b/browser/components/preferences/in-content/findInPage.js @@ -202,9 +202,8 @@ var gSearchResultsPane = { let resultsFound = false; // Building the range for highlighted areas - let rootPreferences = document.getElementById("mainPrefPane") - let rootPreferencesChildren = rootPreferences - .querySelectorAll(":not([data-hidden-from-search])"); + let rootPreferencesChildren = document + .querySelectorAll("#mainPrefPane > *:not([data-hidden-from-search])"); // Showing all the children to bind JS, Access Keys, etc for (let i = 0; i < rootPreferencesChildren.length; i++) { From 714fbbd92ff4601f247273edec14bb21f9025d0d Mon Sep 17 00:00:00 2001 From: Dan Banner Date: Sat, 6 May 2017 13:45:28 +0100 Subject: [PATCH 036/111] Bug 1343584 - Remove leftover click-to-play-warning-stripes.png file r=florian MozReview-Commit-ID: A7Xa3EI2iPS --HG-- extra : rebase_source : 5b8e55b78e3da9011e67d1194ef646002d4fde3f --- .../test/static/browser_all_files_referenced.js | 2 -- .../linux/click-to-play-warning-stripes.png | Bin 1563 -> 0 bytes browser/themes/linux/jar.mn | 1 - .../themes/osx/click-to-play-warning-stripes.png | Bin 1563 -> 0 bytes browser/themes/osx/jar.mn | 1 - .../windows/click-to-play-warning-stripes.png | Bin 1266 -> 0 bytes browser/themes/windows/jar.mn | 1 - 7 files changed, 5 deletions(-) delete mode 100644 browser/themes/linux/click-to-play-warning-stripes.png delete mode 100644 browser/themes/osx/click-to-play-warning-stripes.png delete mode 100644 browser/themes/windows/click-to-play-warning-stripes.png diff --git a/browser/base/content/test/static/browser_all_files_referenced.js b/browser/base/content/test/static/browser_all_files_referenced.js index efdf2bacfc0d..cf187d981610 100644 --- a/browser/base/content/test/static/browser_all_files_referenced.js +++ b/browser/base/content/test/static/browser_all_files_referenced.js @@ -120,8 +120,6 @@ var whitelist = new Set([ // Bug 1339424 (wontfix?) {file: "chrome://browser/locale/taskbar.properties", platforms: ["linux", "macosx"]}, - // Bug 1343584 - {file: "chrome://browser/skin/click-to-play-warning-stripes.png"}, // Bug 1343824 {file: "chrome://browser/skin/customizableui/customize-illustration-rtl@2x.png", platforms: ["linux", "win"]}, diff --git a/browser/themes/linux/click-to-play-warning-stripes.png b/browser/themes/linux/click-to-play-warning-stripes.png deleted file mode 100644 index 29f15f7b8c20a39a79454fc8b81852daa36548a2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1563 zcmV+$2ITpPP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iyn( z5efmLUF78e00o;#L_t(&-nE&%k}E|Fg^$!dfA{i}5s?uPkdW{OyalgKL`DP;z-6Y# zZXJT|vBzF}J?br7wY6L2S|5L{mUN_%7-Yys#laT|h9DR_UA`*ejOR+>qxpdjoI~lvEM?^!+!>AAkEH zKaBzF*(URR&mH761h?kUX*g&0+a-ts@P!^URLH;lkke2gnL#-iN`i<{xt=Udy&rNc z*R=<)ni5n-5ZC*(!={iy1>b(|)0g>-dG$k{vyGQXK08vmzDFTrP_8FiTOwH@JMdO7 zLUuxO1t!QKg0DXJ>7V(G#SN)AXB#g$x%=$rupfs!XLbZ2cY1mww9k(UximoroHIt- zLmtS<4RY-DV~`KtkMgijDn1RGmgR)mS?Q)BAR9+BgUIpv8iFEKNN;r=dkxvxk$kEd z?=vR^!KV%>orpQLLXr+hgrG=kPU8@;xFZ>~K;m7^xV=e|s)8Y6O=oE;JZ2nT3EubS z3RxoA2noE_)IDSjSkLB%9Qy+4F+6+7sSob!I$a@;-5M2yP$5Za>XQJ6?D(EiT1bUd zcO4k}phk8cOBh2Cs9>eFU01S1Qjd=XP*E&vZfYUZaE;_n^G&fOYm3<;+C|MmG*wrU zeP*>X0`BDa;0Hn?1m&{k(>N#=f3Z_DM!r3}eTyu5a-(U2hSxMGNa<;Idu;E_b`XK8 za8CKu7D*K|bdDmhY34cQEdM)XJ>sC?ob1$gutALI;7H1(iBva8+EQ`EVvcCLry>dRxV@@UX_wT>WZbIN&qM>9O~tx^W@V)(^Z z@0MiQ+b3&!2p~bg!)>c3pDnA|^kTfz`=TRdi4;YAkp#dwS)QCj^H?EC1_9{k%>-d{ z$~Fz*rL&W}d<4LHbq*gZ31CS%k9}}$BgR1?MJK#39GU&MDVO=9WlSTfhU;%e5F0KwBgWq=%6LVopX+ z3%Q5fcTqi{xj9Pr-gO!R2)H0ib0y~0=xrg7A>T3e7qbk4QVLMZ@~k{o6;BZ$AXwHd zlK$%YY%iei&gulE2>bS~rMjxioTF&XDRXRzWUm6@(+(1Mj^nnYqdY`yTWCWbe(nnw z(P{=RKAq&VdKd3ceKTPN(qrrNc9kry`A%9PZ)VW<9x~mV0fB(xdy+N|m*K;|{U`>c zUf1k8SP?09;(%=2=cG3mFOe(`Qrv_)O;1HHHnPr=2W7RjKVAlPzzvD|n6Kqvr#_$# zJTB4L3|T6xYmnThrMIeHTb9E@?jza)d9kZR10>i2dGQjUFGXsa{0E@+4MWpu(?b9N N002ovPDHLkV1i?V(r^F( diff --git a/browser/themes/linux/jar.mn b/browser/themes/linux/jar.mn index cccdb2440887..b5e802c7a88f 100644 --- a/browser/themes/linux/jar.mn +++ b/browser/themes/linux/jar.mn @@ -12,7 +12,6 @@ browser.jar: * skin/classic/browser/syncedtabs/sidebar.css (syncedtabs/sidebar.css) * skin/classic/browser/browser.css * skin/classic/browser/compacttheme.css - skin/classic/browser/click-to-play-warning-stripes.png skin/classic/browser/Info.png skin/classic/browser/menuPanel-customize.png skin/classic/browser/menuPanel-customize@2x.png diff --git a/browser/themes/osx/click-to-play-warning-stripes.png b/browser/themes/osx/click-to-play-warning-stripes.png deleted file mode 100644 index 29f15f7b8c20a39a79454fc8b81852daa36548a2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1563 zcmV+$2ITpPP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iyn( z5efmLUF78e00o;#L_t(&-nE&%k}E|Fg^$!dfA{i}5s?uPkdW{OyalgKL`DP;z-6Y# zZXJT|vBzF}J?br7wY6L2S|5L{mUN_%7-Yys#laT|h9DR_UA`*ejOR+>qxpdjoI~lvEM?^!+!>AAkEH zKaBzF*(URR&mH761h?kUX*g&0+a-ts@P!^URLH;lkke2gnL#-iN`i<{xt=Udy&rNc z*R=<)ni5n-5ZC*(!={iy1>b(|)0g>-dG$k{vyGQXK08vmzDFTrP_8FiTOwH@JMdO7 zLUuxO1t!QKg0DXJ>7V(G#SN)AXB#g$x%=$rupfs!XLbZ2cY1mww9k(UximoroHIt- zLmtS<4RY-DV~`KtkMgijDn1RGmgR)mS?Q)BAR9+BgUIpv8iFEKNN;r=dkxvxk$kEd z?=vR^!KV%>orpQLLXr+hgrG=kPU8@;xFZ>~K;m7^xV=e|s)8Y6O=oE;JZ2nT3EubS z3RxoA2noE_)IDSjSkLB%9Qy+4F+6+7sSob!I$a@;-5M2yP$5Za>XQJ6?D(EiT1bUd zcO4k}phk8cOBh2Cs9>eFU01S1Qjd=XP*E&vZfYUZaE;_n^G&fOYm3<;+C|MmG*wrU zeP*>X0`BDa;0Hn?1m&{k(>N#=f3Z_DM!r3}eTyu5a-(U2hSxMGNa<;Idu;E_b`XK8 za8CKu7D*K|bdDmhY34cQEdM)XJ>sC?ob1$gutALI;7H1(iBva8+EQ`EVvcCLry>dRxV@@UX_wT>WZbIN&qM>9O~tx^W@V)(^Z z@0MiQ+b3&!2p~bg!)>c3pDnA|^kTfz`=TRdi4;YAkp#dwS)QCj^H?EC1_9{k%>-d{ z$~Fz*rL&W}d<4LHbq*gZ31CS%k9}}$BgR1?MJK#39GU&MDVO=9WlSTfhU;%e5F0KwBgWq=%6LVopX+ z3%Q5fcTqi{xj9Pr-gO!R2)H0ib0y~0=xrg7A>T3e7qbk4QVLMZ@~k{o6;BZ$AXwHd zlK$%YY%iei&gulE2>bS~rMjxioTF&XDRXRzWUm6@(+(1Mj^nnYqdY`yTWCWbe(nnw z(P{=RKAq&VdKd3ceKTPN(qrrNc9kry`A%9PZ)VW<9x~mV0fB(xdy+N|m*K;|{U`>c zUf1k8SP?09;(%=2=cG3mFOe(`Qrv_)O;1HHHnPr=2W7RjKVAlPzzvD|n6Kqvr#_$# zJTB4L3|T6xYmnThrMIeHTb9E@?jza)d9kZR10>i2dGQjUFGXsa{0E@+4MWpu(?b9N N002ovPDHLkV1i?V(r^F( diff --git a/browser/themes/osx/jar.mn b/browser/themes/osx/jar.mn index 03afb3db26f4..bc3fc3b03504 100644 --- a/browser/themes/osx/jar.mn +++ b/browser/themes/osx/jar.mn @@ -11,7 +11,6 @@ browser.jar: * skin/classic/browser/syncedtabs/sidebar.css (syncedtabs/sidebar.css) * skin/classic/browser/browser.css * skin/classic/browser/compacttheme.css - skin/classic/browser/click-to-play-warning-stripes.png skin/classic/browser/Info.png skin/classic/browser/subtle-pattern.png skin/classic/browser/menu-back.png diff --git a/browser/themes/windows/click-to-play-warning-stripes.png b/browser/themes/windows/click-to-play-warning-stripes.png deleted file mode 100644 index cb4b71e5003cde32f8ffb1ce12f3122da9902fee..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1266 zcmeAS@N?(olHy`uVBq!ia0vp^RzR%7!3-psUq#PhU|>uN@Ck7Rayi(TIM|pu*qJ!k znK{{*IN6vv*_k-mnYlQaxHy=(Ihc7knRz*x1h|+4cvuAa*+ux-_2v2X75Gin_${>f z5kl9n4aoE}%+ACPpSEpc+QFg8eb#pr9`+3GxdD(%1ka6fi*n zGaRtM04p4@p#pYfz<~-lAwcuwn@9!*rjwp7jv*DdN~hL_3pt9kzh`>m7nQnR?LkIY z@RActR^}`Vo#Eo8nW~bw)Jtcn>a_d&6{o|_}|9!mEZW@NQc%(?_>RYWT%Y5 z&gj?7KRb5h+!c%Y_W$nFr?M0HZ(Vt}@%QJj6*k+7*1PddQ9o{WH~((KruSQTRZsj@ ze`{uX{^svO;UyNiCe?4QpL}Zc`M5{cEZ@Z!EB4pQF0nA#{r|GbCKskt3m$85%yJZ{ zxgpn4@KRRJq**We;iggni5EV3{1477KCmfNjs5iIzgLWE*2I5a@aOB^tBZFDYw@2~ z4dwm1n(4IGWA39nWNcq?t-2cK6<)B_+Vu1(Hp_r0*JXQHjFlrEMS2>$Yp3cQz3x9P zT(s-(8LP=(&J}N56Kxm%VaSFz;qd;=2WGm?tU348c?#1h$tglA=XzY@bt0ahKNu<4%zFP+E6*K1 zLBq$OG=_O&W*Gv>r;hbwGzx0yV?6pebPg0^* zZVXJl@Jen9o9V*p6()ARcRW*5tvZcdXHDG^^=V6zQ6oRk%Fgp5a?=aXO85t|r1@nA zO`FjWWO&KQBzR?K+^k7TWr;IACbchJIQ!I+1MOEhwAb5^$xlXwFn;q4Z^H z5n91~GG?nJf*!3_t_;)iDx09UZ(Yiy#PuvwRCvpkW32kLb(KPnxm=$xu}}KxInNK5 z8n0R@Y36FN2%ee3bDZ&|+l@p|jwyw4ZA%|a3aC;#xRyO=hft8qk_3%YKNN~NpUZze WWOFf%^VVNbUh;JHb6Mw<&;$VRadyW5 diff --git a/browser/themes/windows/jar.mn b/browser/themes/windows/jar.mn index 81cead2570b6..96935f9e563e 100644 --- a/browser/themes/windows/jar.mn +++ b/browser/themes/windows/jar.mn @@ -12,7 +12,6 @@ browser.jar: * skin/classic/browser/browser.css * skin/classic/browser/compacttheme.css skin/classic/browser/caption-buttons.svg - skin/classic/browser/click-to-play-warning-stripes.png skin/classic/browser/Info.png skin/classic/browser/livemark-folder.png skin/classic/browser/menu-back.png From 80e77833bc1ccfad6bc791bcacd42d34699b7d37 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Tue, 9 May 2017 14:47:17 -0400 Subject: [PATCH 037/111] Bug 1362861 - Pass the correct arch to nm on macOS. r=dthayer,kmag MozReview-Commit-ID: C8vfSUu8dM8 --HG-- extra : rebase_source : a7bf559a4093dd9a0447e195dd3e8dccd67619df --- .../extensions/ext-geckoProfiler.js | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/browser/components/extensions/ext-geckoProfiler.js b/browser/components/extensions/ext-geckoProfiler.js index 05e1c9b0f99b..8d38c4cca756 100644 --- a/browser/components/extensions/ext-geckoProfiler.js +++ b/browser/components/extensions/ext-geckoProfiler.js @@ -136,11 +136,13 @@ async function spawnProcess(name, cmdArgs, processData, stdin = null) { await readAllData(proc.stdout, processData); } -async function getSymbolsFromNM(path) { +async function getSymbolsFromNM(path, arch) { const parser = new NMParser(); const args = [path]; - if (Services.appinfo.OS !== "Darwin") { + if (Services.appinfo.OS === "Darwin") { + args.unshift("-arch", arch); + } else { // Mac's `nm` doesn't support the demangle option, so we have to // post-process the symbols with c++filt. args.unshift("--demangle"); @@ -209,8 +211,8 @@ function filePathForSymFileInObjDir(binaryPath, debugName, breakpadId) { const symbolCache = new Map(); function primeSymbolStore(libs) { - for (const {debugName, breakpadId, path} of libs) { - symbolCache.set(urlForSymFile(debugName, breakpadId), path); + for (const {debugName, breakpadId, path, arch} of libs) { + symbolCache.set(urlForSymFile(debugName, breakpadId), {path, arch}); } } @@ -305,10 +307,10 @@ this.geckoProfiler = class extends ExtensionAPI { primeSymbolStore(Services.profiler.sharedLibraries); } - const path = symbolCache.get(urlForSymFile(debugName, breakpadId)); + const cachedLibInfo = symbolCache.get(urlForSymFile(debugName, breakpadId)); const symbolRules = Services.prefs.getCharPref(PREF_GET_SYMBOL_RULES, "localBreakpad,remoteBreakpad"); - const haveAbsolutePath = path && OS.Path.split(path).absolute; + const haveAbsolutePath = cachedLibInfo && OS.Path.split(cachedLibInfo.path).absolute; // We have multiple options for obtaining symbol information for the given // binary. @@ -322,6 +324,7 @@ this.geckoProfiler = class extends ExtensionAPI { switch (rule) { case "localBreakpad": if (haveAbsolutePath) { + const {path} = cachedLibInfo; const filepath = filePathForSymFileInObjDir(path, debugName, breakpadId); if (filepath) { // NOTE: here and below, "return await" is used to ensure we catch any @@ -335,7 +338,11 @@ this.geckoProfiler = class extends ExtensionAPI { const url = urlForSymFile(debugName, breakpadId); return await parseSym({url}); case "nm": - return await getSymbolsFromNM(path); + if (haveAbsolutePath) { + const {path, arch} = cachedLibInfo; + return await getSymbolsFromNM(path, arch); + } + break; } } catch (e) { // Each of our options can go wrong for a variety of reasons, so on failure From c24d78e194866ea617ec2b12484d1a32d79fc200 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 3 May 2017 14:47:35 -0600 Subject: [PATCH 038/111] Bug 1334304 - use MOZ_FORMAT_PRINTF in accessible/base/Logging.h; r=surkov MozReview-Commit-ID: 5cpxhepA7br --HG-- extra : rebase_source : f865188eaf0a40fd5cddec4a61e117e0014cbcb9 --- accessible/base/Logging.cpp | 20 ++++++++++---------- accessible/base/Logging.h | 5 +++-- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/accessible/base/Logging.cpp b/accessible/base/Logging.cpp index afc37ef85e51..95b2711bbd0a 100644 --- a/accessible/base/Logging.cpp +++ b/accessible/base/Logging.cpp @@ -396,7 +396,7 @@ void logging::DocLoad(const char* aMsg, nsIWebProgress* aWebProgress, nsIRequest* aRequest, uint32_t aStateFlags) { - MsgBegin(sDocLoadTitle, aMsg); + MsgBegin(sDocLoadTitle, "%s", aMsg); nsCOMPtr DOMWindow; aWebProgress->GetDOMWindow(getter_AddRefs(DOMWindow)); @@ -433,7 +433,7 @@ logging::DocLoad(const char* aMsg, nsIWebProgress* aWebProgress, void logging::DocLoad(const char* aMsg, nsIDocument* aDocumentNode) { - MsgBegin(sDocLoadTitle, aMsg); + MsgBegin(sDocLoadTitle, "%s", aMsg); DocAccessible* document = GetExistingDocAccessible(aDocumentNode); LogDocInfo(aDocumentNode, document); @@ -497,7 +497,7 @@ logging::DocCreate(const char* aMsg, nsIDocument* aDocumentNode, DocAccessible* document = aDocument ? aDocument : GetExistingDocAccessible(aDocumentNode); - MsgBegin(sDocCreateTitle, aMsg); + MsgBegin(sDocCreateTitle, "%s", aMsg); LogDocInfo(aDocumentNode, document); MsgEnd(); } @@ -509,7 +509,7 @@ logging::DocDestroy(const char* aMsg, nsIDocument* aDocumentNode, DocAccessible* document = aDocument ? aDocument : GetExistingDocAccessible(aDocumentNode); - MsgBegin(sDocDestroyTitle, aMsg); + MsgBegin(sDocDestroyTitle, "%s", aMsg); LogDocInfo(aDocumentNode, document); MsgEnd(); } @@ -526,7 +526,7 @@ void logging::FocusNotificationTarget(const char* aMsg, const char* aTargetDescr, Accessible* aTarget) { - MsgBegin(sFocusTitle, aMsg); + MsgBegin(sFocusTitle, "%s", aMsg); AccessibleNNode(aTargetDescr, aTarget); MsgEnd(); } @@ -535,7 +535,7 @@ void logging::FocusNotificationTarget(const char* aMsg, const char* aTargetDescr, nsINode* aTargetNode) { - MsgBegin(sFocusTitle, aMsg); + MsgBegin(sFocusTitle, "%s", aMsg); Node(aTargetDescr, aTargetNode); MsgEnd(); } @@ -544,7 +544,7 @@ void logging::FocusNotificationTarget(const char* aMsg, const char* aTargetDescr, nsISupports* aTargetThing) { - MsgBegin(sFocusTitle, aMsg); + MsgBegin(sFocusTitle, "%s", aMsg); if (aTargetThing) { nsCOMPtr targetNode(do_QueryInterface(aTargetThing)); @@ -628,7 +628,7 @@ logging::TreeInfo(const char* aMsg, uint32_t aExtraFlags, ...) } } else { - MsgBegin("TREE", aMsg); + MsgBegin("TREE", "%s", aMsg); } va_end(vl); MsgEnd(); @@ -677,7 +677,7 @@ logging::Tree(const char* aTitle, const char* aMsgText, Accessible* aRoot, GetTreePrefix aPrefixFunc, void* aGetTreePrefixData) { - logging::MsgBegin(aTitle, aMsgText); + logging::MsgBegin(aTitle, "%s", aMsgText); nsAutoString level; Accessible* root = aRoot; @@ -717,7 +717,7 @@ void logging::DOMTree(const char* aTitle, const char* aMsgText, DocAccessible* aDocument) { - logging::MsgBegin(aTitle, aMsgText); + logging::MsgBegin(aTitle, "%s", aMsgText); nsAutoString level; nsINode* root = aDocument->DocumentNode(); do { diff --git a/accessible/base/Logging.h b/accessible/base/Logging.h index a5d2c16b2fb5..b3fdff752b6c 100644 --- a/accessible/base/Logging.h +++ b/accessible/base/Logging.h @@ -9,6 +9,7 @@ #include "nscore.h" #include "nsStringFwd.h" +#include "mozilla/Attributes.h" class nsIDocument; class nsINode; @@ -152,7 +153,7 @@ void DOMTree(const char* aTitle, const char* aMsgText, DocAccessible* aDoc); * boundaries of the message body designated by '{' and '}' (2 spaces indent for * body). */ -void MsgBegin(const char* aTitle, const char* aMsgText, ...); +void MsgBegin(const char* aTitle, const char* aMsgText, ...) MOZ_FORMAT_PRINTF(2, 3); void MsgEnd(); /** @@ -165,7 +166,7 @@ void SubMsgEnd(); /** * Log the entry into message body (4 spaces indent). */ -void MsgEntry(const char* aEntryText, ...); +void MsgEntry(const char* aEntryText, ...) MOZ_FORMAT_PRINTF(1, 2); /** * Log the text, two spaces offset is used. From 219948bce9699088bc445b80675d8dcabe9b48aa Mon Sep 17 00:00:00 2001 From: Matt Howell Date: Tue, 9 May 2017 10:47:24 -0700 Subject: [PATCH 039/111] Bug 1363275 - Make the updater progress dialog DPI-aware on Windows. r=rstrong MozReview-Commit-ID: FPjcbzW2RPY --HG-- extra : rebase_source : 8c5e957c23e62e915dc11c2efe7c83846148ec63 --- .../updater/updater.exe.comctl32.manifest | 22 ++++++++++++------- .../update/updater/updater.exe.manifest | 22 ++++++++++++------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/toolkit/mozapps/update/updater/updater.exe.comctl32.manifest b/toolkit/mozapps/update/updater/updater.exe.comctl32.manifest index 6bb850199b05..9df0057e6489 100644 --- a/toolkit/mozapps/update/updater/updater.exe.comctl32.manifest +++ b/toolkit/mozapps/update/updater/updater.exe.comctl32.manifest @@ -26,12 +26,18 @@ - - - - - - - - + + + + + + + + + + + True/PM + PerMonitorV2,PerMonitor + + diff --git a/toolkit/mozapps/update/updater/updater.exe.manifest b/toolkit/mozapps/update/updater/updater.exe.manifest index 619b4abfe185..6646ec653490 100644 --- a/toolkit/mozapps/update/updater/updater.exe.manifest +++ b/toolkit/mozapps/update/updater/updater.exe.manifest @@ -14,12 +14,18 @@ - - - - - - - - + + + + + + + + + + + True/PM + PerMonitorV2,PerMonitor + + From cced8e85ebc06f974b5c6d754eb02716daa4bbbd Mon Sep 17 00:00:00 2001 From: squeaks Date: Tue, 9 May 2017 11:29:59 -0700 Subject: [PATCH 040/111] Bug 1360586: Removed unused maximized variable r=automatedtester MozReview-Commit-ID: Bd11JNGuuhk --HG-- extra : rebase_source : 03f5ef5bd4c3f652556820567eaf6670c7d1b2b5 --- .../marionette_harness/tests/unit/test_window_maximize.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/testing/marionette/harness/marionette_harness/tests/unit/test_window_maximize.py b/testing/marionette/harness/marionette_harness/tests/unit/test_window_maximize.py index 06c56b22e782..b66892884a34 100644 --- a/testing/marionette/harness/marionette_harness/tests/unit/test_window_maximize.py +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_window_maximize.py @@ -78,8 +78,6 @@ class TestWindowMaximize(MarionetteTestCase): self.assert_window_restored(restored) def test_stress(self): - maximized = False - for i in range(1, 25): expect_maximized = bool(i % 2) From c2bb6816bbc558c6d22dc084357dcaffb3d56e7e Mon Sep 17 00:00:00 2001 From: Gijs Kruitbosch Date: Tue, 9 May 2017 11:58:59 -0400 Subject: [PATCH 041/111] Bug 1354113 - add library,add-ons,preferences,customize items, r=jaws MozReview-Commit-ID: 3bfi30tvUTB --HG-- extra : rebase_source : a8f393493b036c096e265b608a82ba85ac068c19 --- .../customizableui/content/panelUI.inc.xul | 29 +++++++++++++++++++ .../customizableui/content/panelUI.js | 6 ++++ browser/themes/shared/jar.inc.mn | 4 +++ browser/themes/shared/menu-icons/addons.svg | 6 ++++ .../themes/shared/menu-icons/customize.svg | 6 ++++ browser/themes/shared/menu-icons/library.svg | 6 ++++ browser/themes/shared/menu-icons/settings.svg | 6 ++++ browser/themes/shared/menupanel.inc.css | 20 +++++++++++++ 8 files changed, 83 insertions(+) create mode 100644 browser/themes/shared/menu-icons/addons.svg create mode 100644 browser/themes/shared/menu-icons/customize.svg create mode 100644 browser/themes/shared/menu-icons/library.svg create mode 100644 browser/themes/shared/menu-icons/settings.svg diff --git a/browser/components/customizableui/content/panelUI.inc.xul b/browser/components/customizableui/content/panelUI.inc.xul index 2751693ad203..c4e1cf7e09a3 100644 --- a/browser/components/customizableui/content/panelUI.inc.xul +++ b/browser/components/customizableui/content/panelUI.inc.xul @@ -546,6 +546,35 @@ command="cmd_printPreview" #endif /> + + + + + diff --git a/browser/components/customizableui/content/panelUI.js b/browser/components/customizableui/content/panelUI.js index 8c2d091da2b3..a1c7682e2ac5 100644 --- a/browser/components/customizableui/content/panelUI.js +++ b/browser/components/customizableui/content/panelUI.js @@ -301,6 +301,9 @@ const PanelUI = { updateEditUIVisibility(); // Fall through case "popupshown": + if (gPhotonStructure && aEvent.type == "popupshown") { + CustomizableUI.addPanelCloseListeners(this.panel); + } // Fall through case "popuphiding": if (aEvent.type == "popuphiding") { @@ -310,6 +313,9 @@ const PanelUI = { case "popuphidden": this._updateNotifications(); this._updatePanelButton(aEvent.target); + if (gPhotonStructure && aEvent.type == "popuphidden") { + CustomizableUI.removePanelCloseListeners(this.panel); + } break; case "mousedown": if (aEvent.button == 0) diff --git a/browser/themes/shared/jar.inc.mn b/browser/themes/shared/jar.inc.mn index 38e5a5e094d5..ba82fd5ea316 100644 --- a/browser/themes/shared/jar.inc.mn +++ b/browser/themes/shared/jar.inc.mn @@ -186,6 +186,10 @@ skin/classic/browser/urlbar-star.svg (../shared/urlbar-star.svg) skin/classic/browser/urlbar-tab.svg (../shared/urlbar-tab.svg) skin/classic/browser/page-action.svg (../shared/page-action.svg) + skin/classic/browser/menu-icons/addons.svg (../shared/menu-icons/addons.svg) + skin/classic/browser/menu-icons/customize.svg (../shared/menu-icons/customize.svg) + skin/classic/browser/menu-icons/library.svg (../shared/menu-icons/library.svg) skin/classic/browser/menu-icons/new-window.svg (../shared/menu-icons/new-window.svg) skin/classic/browser/menu-icons/print.svg (../shared/menu-icons/print.svg) skin/classic/browser/menu-icons/private-window.svg (../shared/menu-icons/private-window.svg) + skin/classic/browser/menu-icons/settings.svg (../shared/menu-icons/settings.svg) diff --git a/browser/themes/shared/menu-icons/addons.svg b/browser/themes/shared/menu-icons/addons.svg new file mode 100644 index 000000000000..e7aabfc76d6c --- /dev/null +++ b/browser/themes/shared/menu-icons/addons.svg @@ -0,0 +1,6 @@ + + + + diff --git a/browser/themes/shared/menu-icons/customize.svg b/browser/themes/shared/menu-icons/customize.svg new file mode 100644 index 000000000000..582897398888 --- /dev/null +++ b/browser/themes/shared/menu-icons/customize.svg @@ -0,0 +1,6 @@ + + + + diff --git a/browser/themes/shared/menu-icons/library.svg b/browser/themes/shared/menu-icons/library.svg new file mode 100644 index 000000000000..e31d038a5eaf --- /dev/null +++ b/browser/themes/shared/menu-icons/library.svg @@ -0,0 +1,6 @@ + + + + diff --git a/browser/themes/shared/menu-icons/settings.svg b/browser/themes/shared/menu-icons/settings.svg new file mode 100644 index 000000000000..db0aa3d03460 --- /dev/null +++ b/browser/themes/shared/menu-icons/settings.svg @@ -0,0 +1,6 @@ + + + + diff --git a/browser/themes/shared/menupanel.inc.css b/browser/themes/shared/menupanel.inc.css index 15af39e0f523..20e3abf52ed5 100644 --- a/browser/themes/shared/menupanel.inc.css +++ b/browser/themes/shared/menupanel.inc.css @@ -196,3 +196,23 @@ toolbarpaletteitem[place="palette"] > #zoom-controls > #zoom-in-button { list-style-image: url(chrome://browser/skin/menu-icons/print.svg); -moz-context-properties: fill; } + +#appMenu-library-button { + list-style-image: url(chrome://browser/skin/menu-icons/library.svg); + -moz-context-properties: fill; +} + +#appMenu-addons-button { + list-style-image: url(chrome://browser/skin/menu-icons/addons.svg); + -moz-context-properties: fill; +} + +#appMenu-preferences-button { + list-style-image: url(chrome://browser/skin/menu-icons/settings.svg); + -moz-context-properties: fill; +} + +#appMenu-customize-button { + list-style-image: url(chrome://browser/skin/menu-icons/customize.svg); + -moz-context-properties: fill; +} From 8cbfcc8c502a6039e4b5fdc0731dc1523b59a30b Mon Sep 17 00:00:00 2001 From: Johann Hofmann Date: Tue, 9 May 2017 16:08:16 -0400 Subject: [PATCH 042/111] Bug 1363406 - Only apply padding to the bookmark menu button in the nav bar. r=dao This patch reverts a change that bug 1352364 accidentally introduced that led to the bookmark menu button shrinking in the bookmarks toolbar. MozReview-Commit-ID: AkamENzseK2 --HG-- extra : rebase_source : ffb0a821b274562f60a2ee3fbcd5302c511694c8 --- browser/themes/shared/toolbarbuttons.inc.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/themes/shared/toolbarbuttons.inc.css b/browser/themes/shared/toolbarbuttons.inc.css index 4040ac845bdf..08b476605a96 100644 --- a/browser/themes/shared/toolbarbuttons.inc.css +++ b/browser/themes/shared/toolbarbuttons.inc.css @@ -357,7 +357,7 @@ toolbar[brighttext] .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker { -moz-appearance: none !important; } -#bookmarks-menu-button[cui-areatype="toolbar"]:not([overflowedItem=true]) > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon { +#nav-bar #bookmarks-menu-button[cui-areatype="toolbar"]:not([overflowedItem=true]) > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon { padding-top: var(--toolbarbutton-vertical-inner-padding); padding-bottom: var(--toolbarbutton-vertical-inner-padding); } From 7e3c287071405a061c699383dc3c1384f491de4b Mon Sep 17 00:00:00 2001 From: Doug Thayer Date: Thu, 4 May 2017 10:12:52 -0700 Subject: [PATCH 043/111] Bug 1356675 - Show manual update on cant-apply status r=rstrong If there is an update available but the user can't apply it, we publish a notification on the update-available topic with the status "cant-apply". This was previously being ignored by browser.js. This should fix the bug in question on Windows 10. MozReview-Commit-ID: 1twRvYEXbiT --HG-- extra : rebase_source : c116239a35db022f7be13e693702fdff58882fc5 --- browser/base/content/browser.js | 4 ++ .../base/content/test/appUpdate/browser.ini | 2 + .../appUpdate/browser_updatesCantApply.js | 37 +++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 browser/base/content/test/appUpdate/browser_updatesCantApply.js diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index d775b16243e3..366852f66129 100755 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -2931,6 +2931,10 @@ var gMenuButtonUpdateBadge = { this.clearCallbacks(); this.showUpdateAvailableNotification(update, false); break; + case "cant-apply": + this.clearCallbacks(); + this.showManualUpdateNotification(update, false); + break; } }, diff --git a/browser/base/content/test/appUpdate/browser.ini b/browser/base/content/test/appUpdate/browser.ini index a4f340c28c75..81e319890f66 100644 --- a/browser/base/content/test/appUpdate/browser.ini +++ b/browser/base/content/test/appUpdate/browser.ini @@ -9,6 +9,8 @@ support-files = skip-if = asan reason = Bug 1168003 [browser_updatesBasicPromptNoStaging.js] +[browser_updatesCantApply.js] +skip-if = os != 'win' [browser_updatesCompleteAndPartialPatchesWithBadCompleteSize.js] [browser_updatesCompleteAndPartialPatchesWithBadPartialSize.js] [browser_updatesCompleteAndPartialPatchesWithBadSizes.js] diff --git a/browser/base/content/test/appUpdate/browser_updatesCantApply.js b/browser/base/content/test/appUpdate/browser_updatesCantApply.js new file mode 100644 index 000000000000..5795eed62eb1 --- /dev/null +++ b/browser/base/content/test/appUpdate/browser_updatesCantApply.js @@ -0,0 +1,37 @@ +add_task(function* testBasicPrompt() { + SpecialPowers.pushPrefEnv({set: [ + [PREF_APP_UPDATE_SERVICE_ENABLED, false], + ]}); + let updateParams = "promptWaitTime=0"; + + let file = getWriteTestFile(); + file.create(file.NORMAL_FILE_TYPE, 0o444); + file.fileAttributesWin |= file.WFA_READONLY; + file.fileAttributesWin &= ~file.WFA_READWRITE; + + yield runUpdateTest(updateParams, 1, [ + { + notificationId: "update-manual", + button: "button", + *cleanup() { + yield BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); + is(gBrowser.selectedBrowser.currentURI.spec, + URL_MANUAL_UPDATE, "Landed on manual update page.") + gBrowser.removeTab(gBrowser.selectedTab); + getWriteTestFile(); + } + }, + ]); +}); + +function getWriteTestFile() { + let file = getAppBaseDir(); + file.append(FILE_UPDATE_TEST); + file.QueryInterface(Ci.nsILocalFileWin); + if (file.exists()) { + file.fileAttributesWin |= file.WFA_READWRITE; + file.fileAttributesWin &= ~file.WFA_READONLY; + file.remove(true); + } + return file; +} From 7e2e8d71b5498ae94b7ca32ee8a69e69c5bc21e2 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Tue, 9 May 2017 15:40:50 -0400 Subject: [PATCH 044/111] Bug 1353349 - Don't attempt to put empty profiles into the processes array. r=froydnj MozReview-Commit-ID: HFjLEaqippx --HG-- extra : rebase_source : f66d2188495fbc68bf68fe1ce47a6e2b65eb544f --- tools/profiler/gecko/ProfileGatherer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/profiler/gecko/ProfileGatherer.cpp b/tools/profiler/gecko/ProfileGatherer.cpp index 2688e9b08c8e..724738be8b95 100644 --- a/tools/profiler/gecko/ProfileGatherer.cpp +++ b/tools/profiler/gecko/ProfileGatherer.cpp @@ -47,7 +47,9 @@ ProfileGatherer::GatheredOOPProfile(const nsACString& aProfile) MOZ_RELEASE_ASSERT(mWriter.isSome(), "Should always have a writer if mGathering is true"); - mWriter->Splice(PromiseFlatCString(aProfile).get()); + if (!aProfile.IsEmpty()) { + mWriter->Splice(PromiseFlatCString(aProfile).get()); + } mPendingProfiles--; From 87efd9ffb2a4ac85060a3e72bd86ae80303995ce Mon Sep 17 00:00:00 2001 From: Johann Hofmann Date: Tue, 9 May 2017 16:43:15 -0400 Subject: [PATCH 045/111] Bug 1363046 - Update neterror/certerror page design for Photon. r=dao MozReview-Commit-ID: 5RakjD72FwV --HG-- extra : source : 7a5b9d4390e707a8f7adb7ebf0f7d0ba662c4491 --- browser/base/content/aboutNetError.xhtml | 37 ++++++++------- browser/themes/shared/aboutNetError.css | 46 +++++++------------ browser/themes/shared/error-pages.css | 3 +- .../themes/shared/in-content/common.inc.css | 16 +++---- .../shared/in-content/info-pages.inc.css | 16 +++++-- 5 files changed, 56 insertions(+), 62 deletions(-) diff --git a/browser/base/content/aboutNetError.xhtml b/browser/base/content/aboutNetError.xhtml index 2d76d3c4342a..3feab8639456 100644 --- a/browser/base/content/aboutNetError.xhtml +++ b/browser/base/content/aboutNetError.xhtml @@ -575,7 +575,6 @@
    -

    @@ -605,6 +604,15 @@

    &errorReporting.learnMore;

    + +
    +

    + + +

    +
    +

    &prefReset.longDesc;

    @@ -613,7 +621,6 @@
    -
    @@ -622,28 +629,20 @@
    - -
    -

    - - -

    -
    -

    - +

    + +
    +
    + +
    + +
    +
    - -
    - -
    - -
    -
    - - - - - - - - - diff --git a/browser/themes/shared/contextmenu.inc.css b/browser/themes/shared/contextmenu.inc.css index 8b5914cf870d..117acb4f0b8a 100644 --- a/browser/themes/shared/contextmenu.inc.css +++ b/browser/themes/shared/contextmenu.inc.css @@ -12,32 +12,32 @@ width: 16px; height: 16px; margin: 7px; - filter: url(chrome://global/skin/filters.svg#fill); + -moz-context-properties: fill; fill: currentColor; } #context-back { - list-style-image: url("chrome://browser/skin/content-contextmenu.svg#back"); + list-style-image: url("chrome://browser/skin/back.svg"); } #context-forward { - list-style-image: url("chrome://browser/skin/content-contextmenu.svg#forward"); + list-style-image: url("chrome://browser/skin/forward.svg"); } #context-reload { - list-style-image: url("chrome://browser/skin/content-contextmenu.svg#reload"); + list-style-image: url("chrome://browser/skin/reload.svg"); } #context-stop { - list-style-image: url("chrome://browser/skin/content-contextmenu.svg#stop"); + list-style-image: url("chrome://browser/skin/stop.svg"); } #context-bookmarkpage { - list-style-image: url("chrome://browser/skin/content-contextmenu.svg#bookmark"); + list-style-image: url("chrome://browser/skin/bookmark-hollow.svg"); } #context-bookmarkpage[starred=true] { - list-style-image: url("chrome://browser/skin/content-contextmenu.svg#bookmarked"); + list-style-image: url("chrome://browser/skin/bookmark.svg"); } #context-back:-moz-locale-dir(rtl), diff --git a/browser/themes/shared/jar.inc.mn b/browser/themes/shared/jar.inc.mn index ba82fd5ea316..143d25c3d246 100644 --- a/browser/themes/shared/jar.inc.mn +++ b/browser/themes/shared/jar.inc.mn @@ -15,7 +15,6 @@ skin/classic/browser/aboutSocialError.css (../shared/aboutSocialError.css) skin/classic/browser/aboutTabCrashed.css (../shared/aboutTabCrashed.css) skin/classic/browser/aboutWelcomeBack.css (../shared/aboutWelcomeBack.css) - skin/classic/browser/content-contextmenu.svg (../shared/content-contextmenu.svg) skin/classic/browser/addons/addon-install-blocked.svg (../shared/addons/addon-install-blocked.svg) skin/classic/browser/addons/addon-install-confirm.svg (../shared/addons/addon-install-confirm.svg) skin/classic/browser/addons/addon-install-downloading.svg (../shared/addons/addon-install-downloading.svg) @@ -119,10 +118,12 @@ skin/classic/browser/open.svg (../shared/icons/open.svg) skin/classic/browser/print.svg (../shared/icons/print.svg) skin/classic/browser/privateBrowsing.svg (../shared/icons/privateBrowsing.svg) + skin/classic/browser/reload.svg (../shared/icons/reload.svg) skin/classic/browser/save.svg (../shared/icons/save.svg) skin/classic/browser/settings.svg (../shared/icons/settings.svg) skin/classic/browser/share.svg (../shared/icons/share.svg) skin/classic/browser/sidebars.svg (../shared/icons/sidebars.svg) + skin/classic/browser/stop.svg (../shared/icons/stop.svg) skin/classic/browser/sync.svg (../shared/icons/sync.svg) skin/classic/browser/webIDE.svg (../shared/icons/webIDE.svg) skin/classic/browser/zoom-in.svg (../shared/icons/zoom-in.svg) From a3816690230d20c54701888a69313af4d92ffce5 Mon Sep 17 00:00:00 2001 From: Jing-wei Wu Date: Fri, 21 Apr 2017 18:31:03 +0800 Subject: [PATCH 066/111] Bug 1329131 - Part 1: Implement the functionality of listing all bookmark folders except special folders. r=Grisha MozReview-Commit-ID: AK79E6kkXFI --HG-- extra : rebase_source : 2f3730fd29c4d304342e631cb4a4f9289fe15ce5 --- .../java/org/mozilla/gecko/db/BrowserDB.java | 15 +- .../org/mozilla/gecko/db/LocalBrowserDB.java | 27 +++ .../mozilla/gecko/db/LocalBrowserDBTest.java | 190 +++++++++++++++++- 3 files changed, 214 insertions(+), 18 deletions(-) diff --git a/mobile/android/base/java/org/mozilla/gecko/db/BrowserDB.java b/mobile/android/base/java/org/mozilla/gecko/db/BrowserDB.java index b33880f380cb..8cf74cb3dbfc 100644 --- a/mobile/android/base/java/org/mozilla/gecko/db/BrowserDB.java +++ b/mobile/android/base/java/org/mozilla/gecko/db/BrowserDB.java @@ -4,7 +4,6 @@ package org.mozilla.gecko.db; -import java.io.File; import java.util.Collection; import java.util.EnumSet; import java.util.List; @@ -23,6 +22,7 @@ import android.database.ContentObserver; import android.database.Cursor; import android.graphics.drawable.BitmapDrawable; import android.net.Uri; +import android.support.annotation.Nullable; import android.support.v4.content.CursorLoader; /** @@ -108,9 +108,10 @@ public abstract class BrowserDB { public abstract boolean isBookmark(ContentResolver cr, String uri); public abstract boolean addBookmark(ContentResolver cr, String title, String uri); public abstract Uri addBookmarkFolder(ContentResolver cr, String title, long parentId); - public abstract Cursor getBookmarkForUrl(ContentResolver cr, String url); - public abstract Cursor getBookmarksForPartialUrl(ContentResolver cr, String partialUrl); - public abstract Cursor getBookmarkById(ContentResolver cr, long id); + @Nullable public abstract Cursor getBookmarkForUrl(ContentResolver cr, String url); + @Nullable public abstract Cursor getBookmarksForPartialUrl(ContentResolver cr, String partialUrl); + @Nullable public abstract Cursor getBookmarkById(ContentResolver cr, long id); + @Nullable public abstract Cursor getAllBookmarkFolders(ContentResolver cr); public abstract void removeBookmarksWithURL(ContentResolver cr, String uri); public abstract void removeBookmarkWithId(ContentResolver cr, long id); public abstract void registerBookmarkObserver(ContentResolver cr, ContentObserver observer); @@ -123,7 +124,7 @@ public abstract class BrowserDB { /** * Can return null. */ - public abstract Cursor getBookmarksInFolder(ContentResolver cr, long folderId); + @Nullable public abstract Cursor getBookmarksInFolder(ContentResolver cr, long folderId); public abstract int getBookmarkCountForFolder(ContentResolver cr, long folderId); @@ -151,7 +152,7 @@ public abstract class BrowserDB { * * Returns null if the provided list of URLs is empty or null. */ - public abstract Cursor getThumbnailsForUrls(ContentResolver cr, + @Nullable public abstract Cursor getThumbnailsForUrls(ContentResolver cr, List urls); public abstract void removeThumbnails(ContentResolver cr); @@ -190,7 +191,7 @@ public abstract class BrowserDB { * @param contentResolver to load the cursor. * @param limit Maximum number of results to return. */ - public abstract Cursor getHighlightCandidates(ContentResolver contentResolver, int limit); + @Nullable public abstract Cursor getHighlightCandidates(ContentResolver contentResolver, int limit); /** * Block a page from the highlights list. diff --git a/mobile/android/base/java/org/mozilla/gecko/db/LocalBrowserDB.java b/mobile/android/base/java/org/mozilla/gecko/db/LocalBrowserDB.java index 2d3771025d7f..55d0f6805e89 100644 --- a/mobile/android/base/java/org/mozilla/gecko/db/LocalBrowserDB.java +++ b/mobile/android/base/java/org/mozilla/gecko/db/LocalBrowserDB.java @@ -1450,6 +1450,7 @@ public class LocalBrowserDB extends BrowserDB { * Returns null if the provided list of URLs is empty or null. */ @Override + @Nullable public Cursor getThumbnailsForUrls(ContentResolver cr, List urls) { final int urlCount = urls.size(); if (urlCount == 0) { @@ -1793,6 +1794,7 @@ public class LocalBrowserDB extends BrowserDB { @Override @RobocopTarget + @Nullable public Cursor getBookmarkForUrl(ContentResolver cr, String url) { Cursor c = cr.query(bookmarksUriWithLimit(1), new String[] { Bookmarks._ID, @@ -1815,6 +1817,7 @@ public class LocalBrowserDB extends BrowserDB { } @Override + @Nullable public Cursor getBookmarkById(ContentResolver cr, long id) { final Cursor c = cr.query(mBookmarksUriWithProfile, new String[] { Bookmarks._ID, @@ -1837,6 +1840,30 @@ public class LocalBrowserDB extends BrowserDB { } @Override + @Nullable + public Cursor getAllBookmarkFolders(ContentResolver cr) { + final Cursor cursor = cr.query(mBookmarksUriWithProfile, + DEFAULT_BOOKMARK_COLUMNS, + Bookmarks.TYPE + " = ? AND " + + Bookmarks.GUID + " NOT IN (?, ?, ?, ?, ?) AND " + + Bookmarks.IS_DELETED + " = 0", + new String[] { String.valueOf(Bookmarks.TYPE_FOLDER), + Bookmarks.SCREENSHOT_FOLDER_GUID, + Bookmarks.FAKE_READINGLIST_SMARTFOLDER_GUID, + Bookmarks.TAGS_FOLDER_GUID, + Bookmarks.PLACES_FOLDER_GUID, + Bookmarks.PINNED_FOLDER_GUID }, + null); + if (desktopBookmarksExist(cr)) { + final Cursor desktopCursor = getSpecialFolderCursor(Bookmarks.FAKE_DESKTOP_FOLDER_ID, + Bookmarks.FAKE_DESKTOP_FOLDER_GUID); + return new MergeCursor(new Cursor[] { cursor, desktopCursor }); + } + return cursor; + } + + @Override + @Nullable public Cursor getBookmarksForPartialUrl(ContentResolver cr, String partialUrl) { Cursor c = cr.query(mBookmarksUriWithProfile, new String[] { Bookmarks.GUID, Bookmarks._ID, Bookmarks.URL }, diff --git a/mobile/android/tests/background/junit4/src/org/mozilla/gecko/db/LocalBrowserDBTest.java b/mobile/android/tests/background/junit4/src/org/mozilla/gecko/db/LocalBrowserDBTest.java index f5800a77caa9..9a52dedb1d9a 100644 --- a/mobile/android/tests/background/junit4/src/org/mozilla/gecko/db/LocalBrowserDBTest.java +++ b/mobile/android/tests/background/junit4/src/org/mozilla/gecko/db/LocalBrowserDBTest.java @@ -3,12 +3,14 @@ package org.mozilla.gecko.db; +import android.annotation.SuppressLint; import android.content.ContentProviderClient; import android.content.ContentResolver; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.os.RemoteException; +import android.support.annotation.Nullable; import org.junit.After; import org.junit.Before; @@ -20,6 +22,9 @@ import org.mozilla.gecko.sync.repositories.android.BrowserContractHelpers; import org.robolectric.RuntimeEnvironment; import org.robolectric.shadows.ShadowContentResolver; +import java.util.HashMap; +import java.util.Map; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; @@ -31,6 +36,7 @@ public class LocalBrowserDBTest { private static final long INVALID_ID = -1; private final String BOOKMARK_URL = "https://www.mozilla.org"; private final String BOOKMARK_TITLE = "mozilla"; + private final String BOOKMARK_GUID = "guid1"; private final String UPDATE_URL = "https://bugzilla.mozilla.org"; private final String UPDATE_TITLE = "bugzilla"; @@ -59,7 +65,7 @@ public class LocalBrowserDBTest { } @Test - public void testRemoveBookmarkWithURL() { + public void testRemoveBookmarkWithURL() throws Exception { BrowserDB db = new LocalBrowserDB("default"); ContentResolver cr = context.getContentResolver(); @@ -98,7 +104,7 @@ public class LocalBrowserDBTest { } @Test - public void testRemoveBookmarkWithId() { + public void testRemoveBookmarkWithId() throws Exception { BrowserDB db = new LocalBrowserDB("default"); ContentResolver cr = context.getContentResolver(); @@ -228,7 +234,7 @@ public class LocalBrowserDBTest { final String updatedTitle = cursor.getString(cursor.getColumnIndexOrThrow(BrowserContract.Bookmarks.TITLE)); assertEquals(updatedTitle, UPDATE_TITLE); - final long parentId = cursor.getLong(cursor.getColumnIndex(BrowserContract.Bookmarks.PARENT)); + final long parentId = cursor.getLong(cursor.getColumnIndexOrThrow(BrowserContract.Bookmarks.PARENT)); assertEquals(parentId, newParentId); } finally { cursor.close(); @@ -251,8 +257,6 @@ public class LocalBrowserDBTest { final long rootFolderId = getBookmarkIdFromGuid(BrowserContract.Bookmarks.MOBILE_FOLDER_GUID); final long lastModifiedBeforeAdd = getModifiedDate(rootFolderId); final Uri folderUri = db.addBookmarkFolder(cr, FOLDER_NAME, rootFolderId); - assertNotNull(folderUri); - // Get id from Uri long folderId = Long.valueOf(folderUri.getLastPathSegment()); @@ -305,6 +309,53 @@ public class LocalBrowserDBTest { assertTrue(lastModifiedAfterAdd > lastModifiedBeforeAdd); } + @Test + public void testGetAllBookmarkFolders() throws Exception { + final BrowserDB db = new LocalBrowserDB("default"); + final ContentResolver cr = context.getContentResolver(); + + // Get folder sparse array directly through BrowserProvider + final Map folderMap = getFolderMap(); + final int folderCount = folderMap.size(); + + final long parentId = getBookmarkIdFromGuid(BrowserContract.Bookmarks.MOBILE_FOLDER_GUID); + assertNotEquals(parentId, INVALID_ID); + + // Create 2 folders into 'mobile bookmarks' and put to folderSparseArray. + final Uri childUri1 = db.addBookmarkFolder(cr, "child-1", parentId); + final Folder childFolder1 = getFolder(childUri1); + assertNotNull(childFolder1); + folderMap.put(childFolder1.id, childFolder1); + + final Uri childUri2 = db.addBookmarkFolder(cr, "child-2", parentId); + final Folder childFolder2 = getFolder(childUri2); + assertNotNull(childFolder2); + folderMap.put(childFolder2.id, childFolder2); + + // Create a bookmark, adding a bookmark should not increase folder count. + db.addBookmark(cr, BOOKMARK_TITLE, BOOKMARK_URL); + + final Cursor cursor = db.getAllBookmarkFolders(cr); + assertNotNull(cursor); + + try { + // Current folder count should equal (folderCount + 2) since we added 2 folders. + final int currentFolderCount = cursor.getCount(); + assertEquals(folderCount + 2, currentFolderCount); + + while (cursor.moveToNext()) { + final long id = cursor.getLong(cursor.getColumnIndexOrThrow(BrowserContract.Bookmarks._ID)); + final String title = cursor.getString(cursor.getColumnIndexOrThrow(BrowserContract.Bookmarks.TITLE)); + final String guid = cursor.getString(cursor.getColumnIndexOrThrow(BrowserContract.Bookmarks.GUID)); + final Folder actual = new Folder(id, title, guid); + final Folder expected = folderMap.get(id); + assertEquals(expected, actual); + } + } finally { + cursor.close(); + } + } + private long getBookmarkIdFromGuid(String guid) throws RemoteException { Cursor cursor = bookmarkClient.query(BrowserContract.Bookmarks.CONTENT_URI, new String[] { BrowserContract.Bookmarks._ID }, @@ -324,12 +375,12 @@ public class LocalBrowserDBTest { return id; } - private long getModifiedDate(long id) { - Cursor cursor = provider.query(BrowserContract.Bookmarks.CONTENT_URI, - new String[] { BrowserContract.Bookmarks.DATE_MODIFIED }, - BrowserContract.Bookmarks._ID + " = ?", - new String[] { String.valueOf(id) }, - null); + private long getModifiedDate(long id) throws RemoteException { + Cursor cursor = bookmarkClient.query(BrowserContract.Bookmarks.CONTENT_URI, + new String[] { BrowserContract.Bookmarks.DATE_MODIFIED }, + BrowserContract.Bookmarks._ID + " = ?", + new String[] { String.valueOf(id) }, + null); assertNotNull(cursor); long modified = -1; @@ -342,4 +393,121 @@ public class LocalBrowserDBTest { assertNotEquals(modified, -1); return modified; } + + private Map getFolderMap() throws RemoteException { + final String selection = BrowserContract.Bookmarks.TYPE + " = ? AND " + + BrowserContract.Bookmarks.GUID + " NOT IN (?, ?, ?, ?, ?) AND " + + BrowserContract.Bookmarks.IS_DELETED + " = 0"; + final String[] selectionArgs = { String.valueOf(BrowserContract.Bookmarks.TYPE_FOLDER), + BrowserContract.Bookmarks.SCREENSHOT_FOLDER_GUID, + BrowserContract.Bookmarks.FAKE_READINGLIST_SMARTFOLDER_GUID, + BrowserContract.Bookmarks.TAGS_FOLDER_GUID, + BrowserContract.Bookmarks.PLACES_FOLDER_GUID, + BrowserContract.Bookmarks.PINNED_FOLDER_GUID }; + + final Cursor cursor = bookmarkClient.query(BrowserContract.Bookmarks.CONTENT_URI, + new String[] { BrowserContract.Bookmarks._ID, + BrowserContract.Bookmarks.TITLE, + BrowserContract.Bookmarks.GUID }, + selection, + selectionArgs, + null); + assertNotNull(cursor); + + @SuppressLint("UseSparseArrays") final Map array = new HashMap<>(); + try { + while (cursor.moveToNext()) { + final long id = cursor.getLong(cursor.getColumnIndexOrThrow(BrowserContract.Bookmarks._ID)); + final String title = cursor.getString(cursor.getColumnIndexOrThrow(BrowserContract.Bookmarks.TITLE)); + final String guid = cursor.getString(cursor.getColumnIndexOrThrow(BrowserContract.Bookmarks.GUID)); + + final Folder folder = new Folder(id, title, guid); + array.put(id, folder); + } + } finally { + cursor.close(); + } + return array; + } + + @Nullable + private Folder getFolder(Uri uri) throws RemoteException { + final Cursor cursor = bookmarkClient.query(uri, + new String[] { BrowserContract.Bookmarks._ID, + BrowserContract.Bookmarks.TITLE, + BrowserContract.Bookmarks.GUID }, + null, + null, + null); + assertNotNull(cursor); + try { + if (cursor.moveToFirst()) { + final long id = cursor.getLong(cursor.getColumnIndexOrThrow(BrowserContract.Bookmarks._ID)); + final String title = cursor.getString(cursor.getColumnIndexOrThrow(BrowserContract.Bookmarks.TITLE)); + final String guid = cursor.getString(cursor.getColumnIndexOrThrow(BrowserContract.Bookmarks.GUID)); + return new Folder(id, title, guid); + } + } finally { + cursor.close(); + } + return null; + } + + /** + * A private struct to make it easier to access folder data. + */ + private static class Folder { + private final long id; + private final String title; + private final String guid; + + private Folder(long id, String title, String guid) { + this.id = id; + this.title = title; + this.guid = guid; + } + + @Override + public boolean equals(Object o) { + if (o == null) { + return false; + } + if (!(o instanceof Folder)) { + return false; + } + if (this == o) { + return true; + } + + final Folder other = (Folder) o; + if (this.id != other.id) { + return false; + } + if (this.title == null) { + if (other.title != null) { + return false; + } + } else if (!this.title.equals(other.title)) { + return false; + } + if (this.guid == null) { + if (other.guid != null) { + return false; + } + } else if (!this.guid.equals(other.guid)) { + return false; + } + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + (int) id; + result = prime * result + ((title == null) ? 0 : title.hashCode()); + result = prime * result + ((guid == null) ? 0 : guid.hashCode()); + return result; + } + } } From e1fe7cc7e380eaf1b04c3a337b190b5a62491440 Mon Sep 17 00:00:00 2001 From: Jing-wei Wu Date: Mon, 24 Apr 2017 00:41:46 +0800 Subject: [PATCH 067/111] Bug 1329131 - Part 2: Implement selecting bookmark folder page. r=Grisha MozReview-Commit-ID: 6uEC9iauvZj --HG-- extra : rebase_source : fd022ccdc3841c697aef7e5b2305afd04fd1ab5e --- .../gecko/bookmarks/BookmarkEditFragment.java | 27 +- .../gecko/bookmarks/SelectFolderCallback.java | 10 + .../gecko/bookmarks/SelectFolderFragment.java | 434 ++++++++++++++++++ .../mozilla/gecko/home/BookmarksPanel.java | 10 +- .../org/mozilla/gecko/home/HomeFragment.java | 16 +- .../base/locales/en-US/android_strings.dtd | 1 + mobile/android/base/moz.build | 2 + .../resources/drawable-hdpi/orange_check.png | Bin 0 -> 20431 bytes .../resources/drawable-xhdpi/orange_check.png | Bin 0 -> 20509 bytes .../drawable-xxhdpi/orange_check.png | Bin 0 -> 20637 bytes .../resources/layout/bookmark_folder_item.xml | 71 +++ .../layout/bookmark_folder_select.xml | 30 ++ .../android/base/resources/values/colors.xml | 1 + .../android/base/resources/values/dimens.xml | 4 + mobile/android/base/strings.xml.in | 1 + 15 files changed, 602 insertions(+), 5 deletions(-) create mode 100644 mobile/android/base/java/org/mozilla/gecko/bookmarks/SelectFolderCallback.java create mode 100644 mobile/android/base/java/org/mozilla/gecko/bookmarks/SelectFolderFragment.java create mode 100644 mobile/android/base/resources/drawable-hdpi/orange_check.png create mode 100644 mobile/android/base/resources/drawable-xhdpi/orange_check.png create mode 100644 mobile/android/base/resources/drawable-xxhdpi/orange_check.png create mode 100644 mobile/android/base/resources/layout/bookmark_folder_item.xml create mode 100644 mobile/android/base/resources/layout/bookmark_folder_select.xml diff --git a/mobile/android/base/java/org/mozilla/gecko/bookmarks/BookmarkEditFragment.java b/mobile/android/base/java/org/mozilla/gecko/bookmarks/BookmarkEditFragment.java index af9e4f67ad2f..ce6a9f4af1e7 100644 --- a/mobile/android/base/java/org/mozilla/gecko/bookmarks/BookmarkEditFragment.java +++ b/mobile/android/base/java/org/mozilla/gecko/bookmarks/BookmarkEditFragment.java @@ -38,7 +38,7 @@ import java.lang.ref.WeakReference; /** * A dialog fragment that allows editing bookmark's url, title and changing the parent." */ -public class BookmarkEditFragment extends DialogFragment { +public class BookmarkEditFragment extends DialogFragment implements SelectFolderCallback { private static final String ARG_ID = "id"; private static final String ARG_URL = "url"; @@ -161,6 +161,19 @@ public class BookmarkEditFragment extends DialogFragment { } }); + folderText.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (bookmark == null) { + return; + } + + final SelectFolderFragment dialog = SelectFolderFragment.newInstance(bookmark.parentId, bookmark.id); + dialog.setTargetFragment(BookmarkEditFragment.this, 0); + dialog.show(getActivity().getSupportFragmentManager(), "select-bookmark-folder"); + } + }); + return view; } @@ -196,6 +209,18 @@ public class BookmarkEditFragment extends DialogFragment { super.onSaveInstanceState(outState); } + @Override + public void onFolderChanged(long parentId, String title) { + if (bookmark == null) { + // Don't update view if bookmark isn't initialized yet. + return; + } + + bookmark.parentId = parentId; + bookmark.folder = title; + invalidateView(bookmark); + } + private void invalidateView(Bookmark bookmark) { this.bookmark = bookmark; diff --git a/mobile/android/base/java/org/mozilla/gecko/bookmarks/SelectFolderCallback.java b/mobile/android/base/java/org/mozilla/gecko/bookmarks/SelectFolderCallback.java new file mode 100644 index 000000000000..d9f5af601cb3 --- /dev/null +++ b/mobile/android/base/java/org/mozilla/gecko/bookmarks/SelectFolderCallback.java @@ -0,0 +1,10 @@ +/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- + * This Source Code Form is subject to the terms of the Mozilla Public + * 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/. */ + +package org.mozilla.gecko.bookmarks; + +interface SelectFolderCallback { + void onFolderChanged(long folderId, String title); +} diff --git a/mobile/android/base/java/org/mozilla/gecko/bookmarks/SelectFolderFragment.java b/mobile/android/base/java/org/mozilla/gecko/bookmarks/SelectFolderFragment.java new file mode 100644 index 000000000000..05864de38ffc --- /dev/null +++ b/mobile/android/base/java/org/mozilla/gecko/bookmarks/SelectFolderFragment.java @@ -0,0 +1,434 @@ +/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- + * This Source Code Form is subject to the terms of the Mozilla Public + * 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/. */ + +package org.mozilla.gecko.bookmarks; + +import android.annotation.SuppressLint; +import android.content.ContentResolver; +import android.content.Context; +import android.content.res.Resources; +import android.database.Cursor; +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.v4.app.DialogFragment; +import android.support.v4.app.Fragment; +import android.support.v4.app.LoaderManager; +import android.support.v4.content.AsyncTaskLoader; +import android.support.v4.content.Loader; +import android.support.v4.view.ViewCompat; +import android.support.v7.widget.LinearLayoutManager; +import android.support.v7.widget.RecyclerView; +import android.support.v7.widget.Toolbar; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; + +import org.mozilla.gecko.R; +import org.mozilla.gecko.db.BrowserContract; +import org.mozilla.gecko.db.BrowserDB; +import org.mozilla.gecko.widget.FadedSingleColorTextView; + +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * A dialog fragment that allows selecting a bookmark folder. + */ +public class SelectFolderFragment extends DialogFragment { + + private static final String ARG_PARENT_ID = "parentId"; + private static final String ARG_BOOKMARK_ID = "bookmarkId"; + + private static final int LOADER_ID_FOLDERS = 0; + + private long parentId; + private long bookmarkId; + + private Toolbar toolbar; + private RecyclerView folderView; + private FolderListAdapter foldersAdapter; + + private SelectFolderCallback callback; + + public static SelectFolderFragment newInstance(long parentId, long bookmarkId) { + final Bundle args = new Bundle(); + args.putLong(ARG_PARENT_ID, parentId); + args.putLong(ARG_BOOKMARK_ID, bookmarkId); + + final SelectFolderFragment fragment = new SelectFolderFragment(); + fragment.setArguments(args); + + return fragment; + } + + @Override + public void onAttach(Context context) { + super.onAttach(context); + + final Fragment fragment = getTargetFragment(); + if (fragment != null && fragment instanceof SelectFolderCallback) { + callback = (SelectFolderCallback) fragment; + } + } + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setStyle(DialogFragment.STYLE_NO_TITLE, R.style.Bookmark_Gecko); + + final Bundle args = getArguments(); + if (args != null) { + parentId = args.getLong(ARG_PARENT_ID); + bookmarkId = args.getLong(ARG_BOOKMARK_ID); + } + } + + @Nullable + @Override + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { + final View view = inflater.inflate(R.layout.bookmark_folder_select, container); + toolbar = (Toolbar) view.findViewById(R.id.toolbar); + folderView = (RecyclerView) view.findViewById(R.id.folder_recycler_view); + + toolbar.setNavigationOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + dismiss(); + } + }); + + foldersAdapter = new FolderListAdapter(); + folderView.setAdapter(foldersAdapter); + + folderView.setHasFixedSize(true); + + final LinearLayoutManager llm = new LinearLayoutManager(getContext()); + folderView.setLayoutManager(llm); + + return view; + } + + @Override + public void onResume() { + super.onResume(); + + getLoaderManager().initLoader(LOADER_ID_FOLDERS, null, new FoldersLoaderCallbacks()); + } + + @Override + public void onPause() { + super.onPause(); + + getLoaderManager().destroyLoader(LOADER_ID_FOLDERS); + } + + public void onFolderSelected(final Folder folder) { + // Ignore fake folders. + if (folder.id == BrowserContract.Bookmarks.FAKE_DESKTOP_FOLDER_ID) { + return; + } + + final String title; + if (BrowserContract.Bookmarks.MOBILE_FOLDER_GUID.equals(folder.guid)) { + title = getString(R.string.bookmarks_folder_mobile); + } else { + title = folder.title; + } + + if (callback != null) { + callback.onFolderChanged(folder.id, title); + } + dismiss(); + } + + /** + * A private struct to make it easier to pass bookmark data across threads + */ + private static class Folder { + private final long id; + private final String title; + private final String guid; + + int paddingLevel = 0; + + private Folder(long id, String title, String guid) { + this.id = id; + this.title = title; + this.guid = guid; + } + } + + private class FoldersLoaderCallbacks implements LoaderManager.LoaderCallbacks> { + @Override + public Loader> onCreateLoader(int id, Bundle args) { + return new FoldersLoader(getContext(), bookmarkId); + } + + @Override + public void onLoadFinished(Loader> loader, final List folders) { + if (folders == null) { + return; + } + foldersAdapter.addAll(folders); + } + + @Override + public void onLoaderReset(Loader> loader) { + } + } + + /** + * An AsyncTaskLoader to load {@link Folder} from a cursor. + */ + private static class FoldersLoader extends AsyncTaskLoader> { + private final ContentResolver cr; + private final BrowserDB db; + private long bookmarkId; + private List folders; + + private FoldersLoader(Context context, long bookmarkId) { + super(context); + + cr = context.getContentResolver(); + db = BrowserDB.from(context); + this.bookmarkId = bookmarkId; + } + + @Override + public List loadInBackground() { + // The data order in cursor is 'ASC TYPE, ASC POSITION, ASC ID'. + final Cursor cursor = db.getAllBookmarkFolders(cr); + if (cursor == null) { + return null; + } + + final int capacity = cursor.getCount(); + + @SuppressLint("UseSparseArrays") final Map> folderMap = new HashMap<>(capacity); + try { + while (cursor.moveToNext()) { + final long id = cursor.getLong(cursor.getColumnIndexOrThrow(BrowserContract.Bookmarks._ID)); + final String title = cursor.getString(cursor.getColumnIndexOrThrow(BrowserContract.Bookmarks.TITLE)); + final String guid = cursor.getString(cursor.getColumnIndexOrThrow(BrowserContract.Bookmarks.GUID)); + + final long parentId; + switch (guid) { + case BrowserContract.Bookmarks.TOOLBAR_FOLDER_GUID: + case BrowserContract.Bookmarks.UNFILED_FOLDER_GUID: + case BrowserContract.Bookmarks.MENU_FOLDER_GUID: + parentId = BrowserContract.Bookmarks.FAKE_DESKTOP_FOLDER_ID; + break; + + case BrowserContract.Bookmarks.MOBILE_FOLDER_GUID: + case BrowserContract.Bookmarks.FAKE_DESKTOP_FOLDER_GUID: + parentId = BrowserContract.Bookmarks.FIXED_ROOT_ID; + break; + + default: + parentId = cursor.getLong(cursor.getColumnIndexOrThrow(BrowserContract.Bookmarks.PARENT)); + break; + } + + List childFolders = folderMap.get(parentId); + if (childFolders == null) { + childFolders = new ArrayList<>(); + } + childFolders.add(new Folder(id, title, guid)); + + folderMap.put(parentId, childFolders); + } + } finally { + cursor.close(); + } + + folders = flattenChildFolders(folderMap, capacity); + return folders; + } + + private List flattenChildFolders(Map> map, int capacity) { + final List result = new ArrayList<>(capacity); + + // Here we use ArrayDeque as a stack because it's considered faster than java.util.Stack. + // https://developer.android.com/reference/java/util/ArrayDeque.html + final ArrayDeque folderQueue = new ArrayDeque<>(capacity); + + // Add "mobile bookmarks" and "desktop bookmarks" into arrayDeque. + final List first2Children = map.get((long) BrowserContract.Bookmarks.FIXED_ROOT_ID); + for (Folder child : first2Children) { + if (!BrowserContract.Bookmarks.MOBILE_FOLDER_GUID.equals(child.guid) && + !BrowserContract.Bookmarks.FAKE_DESKTOP_FOLDER_GUID.equals(child.guid)) { + continue; + } + folderQueue.add(child); + } + + while (!folderQueue.isEmpty()) { + final Folder folder = folderQueue.pop(); + result.add(folder); + + final List children = map.get(folder.id); + if (children == null || children.size() == 0) { + continue; + } + for (int i = children.size() - 1; i >= 0; --i) { + final Folder child = children.get(i); + + // Ignore itself and descendant folders because we don't allow to select itself or its descendants. + if (child.id == bookmarkId) { + continue; + } + + child.paddingLevel = folder.paddingLevel + 1; + folderQueue.push(child); + } + } + return result; + } + + @Override + public void deliverResult(List folderList) { + if (isReset()) { + folders = null; + return; + } + + folders = folderList; + + if (isStarted()) { + super.deliverResult(folderList); + } + } + + @Override + protected void onStartLoading() { + if (folders != null) { + deliverResult(folders); + } + + if (takeContentChanged() || folders == null) { + forceLoad(); + } + } + + @Override + protected void onStopLoading() { + cancelLoad(); + } + + @Override + public void onCanceled(List folderList) { + folders = null; + } + + @Override + protected void onReset() { + super.onReset(); + + // Ensure the loader is stopped. + onStopLoading(); + + folders = null; + } + } + + private class FolderListAdapter extends RecyclerView.Adapter { + private final int firstStartPadding; + private final int startPadding; + private final List folders; + + private FolderListAdapter() { + final Resources res = getResources(); + firstStartPadding = (int) res.getDimension(R.dimen.bookmark_folder_first_child_padding); + startPadding = (int) res.getDimension(R.dimen.bookmark_folder_child_padding); + + folders = new ArrayList<>(); + } + + private void addAll(List folderList) { + folders.clear(); + folders.addAll(folderList); + + notifyDataSetChanged(); + } + + @Override + public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + final View itemView = LayoutInflater.from(parent.getContext()) + .inflate(R.layout.bookmark_folder_item, parent, false); + return new ViewHolder(itemView); + } + + @Override + public void onBindViewHolder(ViewHolder holder, int position) { + final Folder folder = folders.get(position); + + if (BrowserContract.Bookmarks.MOBILE_FOLDER_GUID.equals(folder.guid)) { + holder.titleView.setText(R.string.bookmarks_folder_mobile); + } else if (folder.id == BrowserContract.Bookmarks.FAKE_DESKTOP_FOLDER_ID) { + holder.titleView.setText(R.string.bookmarks_folder_desktop); + } else { + holder.titleView.setText(folder.title); + } + + final int startPadding; + if (folder.paddingLevel == 0) { + startPadding = 0; + } else { + startPadding = firstStartPadding + (folder.paddingLevel - 1) * this.startPadding; + } + + ViewCompat.setPaddingRelative(holder.container, + startPadding, + holder.container.getPaddingTop(), + ViewCompat.getPaddingEnd(holder.container), + holder.container.getPaddingBottom()); + + final boolean isSelected = (folder.id == parentId); + holder.selectView.setVisibility(isSelected ? View.VISIBLE : View.GONE); + + if (folder.paddingLevel == 0) { + holder.divider.setVisibility(View.VISIBLE); + holder.itemView.setBackgroundResource(R.color.about_page_header_grey); + } else { + holder.divider.setVisibility(View.GONE); + holder.itemView.setBackgroundResource(R.color.bookmark_folder_bg_color); + } + } + + @Override + public int getItemCount() { + return folders.size(); + } + + class ViewHolder extends RecyclerView.ViewHolder { + private final View divider; + private final View container; + private final FadedSingleColorTextView titleView; + private final ImageView selectView; + + public ViewHolder(View itemView) { + super(itemView); + + divider = itemView.findViewById(R.id.divider); + container = itemView.findViewById(R.id.container); + titleView = (FadedSingleColorTextView) itemView.findViewById(R.id.title); + selectView = (ImageView) itemView.findViewById(R.id.select); + + itemView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + final Folder folder = folders.get(getAdapterPosition()); + onFolderSelected(folder); + } + }); + } + } + } +} diff --git a/mobile/android/base/java/org/mozilla/gecko/home/BookmarksPanel.java b/mobile/android/base/java/org/mozilla/gecko/home/BookmarksPanel.java index 6e20104994f1..6bdbdda39026 100644 --- a/mobile/android/base/java/org/mozilla/gecko/home/BookmarksPanel.java +++ b/mobile/android/base/java/org/mozilla/gecko/home/BookmarksPanel.java @@ -105,8 +105,9 @@ public class BookmarksPanel extends HomeFragment implements BookmarkEditFragment @Override public HomeContextMenuInfo makeInfoForCursor(View view, int position, long id, Cursor cursor) { final int type = cursor.getInt(cursor.getColumnIndexOrThrow(Bookmarks.TYPE)); - if (type == Bookmarks.TYPE_FOLDER) { - // We don't show a context menu for folders + final boolean enableFullBookmarkManagement = BookmarkUtils.isEnabled(getContext()); + if (!enableFullBookmarkManagement && type == Bookmarks.TYPE_FOLDER) { + // We don't show a context menu for folders if full bookmark management isn't enabled. return null; } final HomeContextMenuInfo info = new HomeContextMenuInfo(view, position, id); @@ -114,6 +115,11 @@ public class BookmarksPanel extends HomeFragment implements BookmarkEditFragment info.title = cursor.getString(cursor.getColumnIndexOrThrow(Bookmarks.TITLE)); info.bookmarkId = cursor.getInt(cursor.getColumnIndexOrThrow(Bookmarks._ID)); info.itemType = RemoveItemType.BOOKMARKS; + + if (type == Bookmarks.TYPE_FOLDER) { + info.isFolder = true; + info.url = ""; + } return info; } }); diff --git a/mobile/android/base/java/org/mozilla/gecko/home/HomeFragment.java b/mobile/android/base/java/org/mozilla/gecko/home/HomeFragment.java index 4a882cf53030..1d5eb0c317aa 100644 --- a/mobile/android/base/java/org/mozilla/gecko/home/HomeFragment.java +++ b/mobile/android/base/java/org/mozilla/gecko/home/HomeFragment.java @@ -17,6 +17,7 @@ import org.mozilla.gecko.R; import org.mozilla.gecko.SnackbarBuilder; import org.mozilla.gecko.Telemetry; import org.mozilla.gecko.TelemetryContract; +import org.mozilla.gecko.bookmarks.BookmarkUtils; import org.mozilla.gecko.db.BrowserDB; import org.mozilla.gecko.db.BrowserContract.SuggestedSites; import org.mozilla.gecko.distribution.PartnerBookmarksProviderProxy; @@ -164,8 +165,9 @@ public abstract class HomeFragment extends Fragment { HomeContextMenuInfo info = (HomeContextMenuInfo) menuInfo; - // Don't show the context menu for folders. - if (info.isFolder) { + // Don't show the context menu for folders if full bookmark management isn't enabled. + final boolean enableFullBookmarkManagement = BookmarkUtils.isEnabled(getContext()); + if (info.isFolder && !enableFullBookmarkManagement) { return; } @@ -199,6 +201,16 @@ public abstract class HomeFragment extends Fragment { } final boolean distSetAsHomepage = GeckoSharedPrefs.forProfile(view.getContext()).getBoolean(GeckoPreferences.PREFS_SET_AS_HOMEPAGE, false); menu.findItem(R.id.home_set_as_homepage).setVisible(distSetAsHomepage); + + // Hide unused menu items for bookmark folder. + if (info.isFolder) { + menu.findItem(R.id.home_open_new_tab).setVisible(false); + menu.findItem(R.id.home_open_private_tab).setVisible(false); + menu.findItem(R.id.home_copyurl).setVisible(false); + menu.findItem(R.id.home_share).setVisible(false); + menu.findItem(R.id.home_add_to_launcher).setVisible(false); + menu.findItem(R.id.home_set_as_homepage).setVisible(false); + } } @Override diff --git a/mobile/android/base/locales/en-US/android_strings.dtd b/mobile/android/base/locales/en-US/android_strings.dtd index bdd92ec12428..e551a9703ed4 100644 --- a/mobile/android/base/locales/en-US/android_strings.dtd +++ b/mobile/android/base/locales/en-US/android_strings.dtd @@ -547,6 +547,7 @@ + diff --git a/mobile/android/base/moz.build b/mobile/android/base/moz.build index b46c3fe503c2..272ee7f5a740 100644 --- a/mobile/android/base/moz.build +++ b/mobile/android/base/moz.build @@ -504,6 +504,8 @@ gbjar.sources += ['java/org/mozilla/gecko/' + x for x in [ 'bookmarks/BookmarkEditFragment.java', 'bookmarks/BookmarkUtils.java', 'bookmarks/EditBookmarkTask.java', + 'bookmarks/SelectFolderCallback.java', + 'bookmarks/SelectFolderFragment.java', 'BootReceiver.java', 'BrowserApp.java', 'BrowserLocaleManager.java', diff --git a/mobile/android/base/resources/drawable-hdpi/orange_check.png b/mobile/android/base/resources/drawable-hdpi/orange_check.png new file mode 100644 index 0000000000000000000000000000000000000000..17b0b3c745be2ea9f7858f1a0483b31887749507 GIT binary patch literal 20431 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 OTpXu49JO1p;(q{BB%AX9 literal 0 HcmV?d00001 diff --git a/mobile/android/base/resources/drawable-xhdpi/orange_check.png b/mobile/android/base/resources/drawable-xhdpi/orange_check.png new file mode 100644 index 0000000000000000000000000000000000000000..2973a97beb4876edebe1a0a6bb6b5bef3239e6e7 GIT binary patch literal 20509 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 literal 0 HcmV?d00001 diff --git a/mobile/android/base/resources/drawable-xxhdpi/orange_check.png b/mobile/android/base/resources/drawable-xxhdpi/orange_check.png new file mode 100644 index 0000000000000000000000000000000000000000..a3cf4f75b296831838434be0af6ae5e495eff15a GIT binary patch literal 20637 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 B_1ypf literal 0 HcmV?d00001 diff --git a/mobile/android/base/resources/layout/bookmark_folder_item.xml b/mobile/android/base/resources/layout/bookmark_folder_item.xml new file mode 100644 index 000000000000..b52b15c3f6d1 --- /dev/null +++ b/mobile/android/base/resources/layout/bookmark_folder_item.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mobile/android/base/resources/layout/bookmark_folder_select.xml b/mobile/android/base/resources/layout/bookmark_folder_select.xml new file mode 100644 index 000000000000..b98bd026259f --- /dev/null +++ b/mobile/android/base/resources/layout/bookmark_folder_select.xml @@ -0,0 +1,30 @@ + + + + + + + + + \ No newline at end of file diff --git a/mobile/android/base/resources/values/colors.xml b/mobile/android/base/resources/values/colors.xml index 7054aceb8f2f..99cc9baaa072 100644 --- a/mobile/android/base/resources/values/colors.xml +++ b/mobile/android/base/resources/values/colors.xml @@ -147,4 +147,5 @@ #555555 + #FCFCFC diff --git a/mobile/android/base/resources/values/dimens.xml b/mobile/android/base/resources/values/dimens.xml index 2d3c8e71e2a7..d4c63c8bc811 100644 --- a/mobile/android/base/resources/values/dimens.xml +++ b/mobile/android/base/resources/values/dimens.xml @@ -235,4 +235,8 @@ 56dp 16dp + + + 40dp + 16dp diff --git a/mobile/android/base/strings.xml.in b/mobile/android/base/strings.xml.in index ae0f1fb69c85..4524c9ad10c7 100644 --- a/mobile/android/base/strings.xml.in +++ b/mobile/android/base/strings.xml.in @@ -435,6 +435,7 @@ &bookmark_edit_name; &bookmark_edit_location; &bookmark_edit_keyword; + &bookmark_select_folder; &pref_use_master_password; &masterpassword_create_title; From df53f009c6d0357278c939ab0d1e34486a2205bc Mon Sep 17 00:00:00 2001 From: Tom Ritter Date: Tue, 9 May 2017 13:00:58 -0500 Subject: [PATCH 068/111] Bug 1331335 Add SSE2 Flags to all of libANGLE r=jgilbert MozReview-Commit-ID: LjzlucR7sPx --HG-- extra : rebase_source : ce0850feb57062abbab371ed89688546ac6af3e7 --- gfx/angle/src/libANGLE/moz.build | 1 + 1 file changed, 1 insertion(+) mode change 100644 => 100755 gfx/angle/src/libANGLE/moz.build diff --git a/gfx/angle/src/libANGLE/moz.build b/gfx/angle/src/libANGLE/moz.build old mode 100644 new mode 100755 index 0ab94b928702..8dbe59687ff3 --- a/gfx/angle/src/libANGLE/moz.build +++ b/gfx/angle/src/libANGLE/moz.build @@ -331,6 +331,7 @@ if CONFIG['MOZ_HAS_WINSDK_WITH_D3D']: 'renderer/d3d/d3d11/win32/NativeWindow11Win32.cpp', ] +CXXFLAGS += CONFIG['SSE2_FLAGS'] if CONFIG['GNU_CXX']: CXXFLAGS += [ From 59c8ad9b72a2bfedcccbc63c0777073f7999341a Mon Sep 17 00:00:00 2001 From: Chris Pearce Date: Wed, 10 May 2017 16:00:21 +1200 Subject: [PATCH 069/111] Bug 1363605 - Widevine should support SW_SECURE_CRYPTO video robustness. r=gerald Turns out that Chrome treats the robustness values as SW_SECURE_DECODE to mean that SW_SECURE_CRYPTO is also supported. So we'd better follow suit... MozReview-Commit-ID: 6J68IsSQhyL --HG-- extra : rebase_source : 08baf83f0812f52670f1643e7e86ced0a0972f64 --- dom/media/eme/MediaKeySystemAccess.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/dom/media/eme/MediaKeySystemAccess.cpp b/dom/media/eme/MediaKeySystemAccess.cpp index b5620a1ddfb9..53e124c6a6ab 100644 --- a/dom/media/eme/MediaKeySystemAccess.cpp +++ b/dom/media/eme/MediaKeySystemAccess.cpp @@ -310,6 +310,7 @@ GetSupportedKeySystems() widevine.mSessionTypes.AppendElement(MediaKeySessionType::Persistent_license); #endif widevine.mAudioRobustness.AppendElement(NS_LITERAL_STRING("SW_SECURE_CRYPTO")); + widevine.mVideoRobustness.AppendElement(NS_LITERAL_STRING("SW_SECURE_CRYPTO")); widevine.mVideoRobustness.AppendElement(NS_LITERAL_STRING("SW_SECURE_DECODE")); #if defined(XP_WIN) // Widevine CDM doesn't include an AAC decoder. So if WMF can't From 4376a0cf6117c340833a8e8fe1225342c242c0ef Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Tue, 9 May 2017 15:21:22 +0900 Subject: [PATCH 070/111] Bug 1325281 Get rid of nsIEditorIMESupport r=m_kato MozReview-Commit-ID: KGJnho4uy1s --HG-- extra : rebase_source : 1755ad59ed625076fbadb05db9bb5d4a1fea07cb --- editor/libeditor/EditorBase.cpp | 1 - editor/libeditor/EditorBase.h | 8 ++------ editor/moz.build | 1 - editor/nsIEditorIMESupport.idl | 11 ----------- 4 files changed, 2 insertions(+), 19 deletions(-) delete mode 100644 editor/nsIEditorIMESupport.idl diff --git a/editor/libeditor/EditorBase.cpp b/editor/libeditor/EditorBase.cpp index 0c12fb069923..edfe858078ff 100644 --- a/editor/libeditor/EditorBase.cpp +++ b/editor/libeditor/EditorBase.cpp @@ -203,7 +203,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(EditorBase) NS_INTERFACE_MAP_ENTRY(nsIPhonetic) NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) - NS_INTERFACE_MAP_ENTRY(nsIEditorIMESupport) NS_INTERFACE_MAP_ENTRY(nsIEditor) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIEditor) NS_INTERFACE_MAP_END diff --git a/editor/libeditor/EditorBase.h b/editor/libeditor/EditorBase.h index aabf83b123a6..932c5652d371 100644 --- a/editor/libeditor/EditorBase.h +++ b/editor/libeditor/EditorBase.h @@ -15,8 +15,7 @@ #include "nsCOMPtr.h" // for already_AddRefed, nsCOMPtr #include "nsCycleCollectionParticipant.h" #include "nsGkAtoms.h" -#include "nsIEditor.h" // for nsIEditor::EDirection, etc. -#include "nsIEditorIMESupport.h" // for NS_DECL_NSIEDITORIMESUPPORT, etc. +#include "nsIEditor.h" // for nsIEditor, etc. #include "nsIObserver.h" // for NS_DECL_NSIOBSERVER, etc. #include "nsIPhonetic.h" // for NS_DECL_NSIPHONETIC, etc. #include "nsIPlaintextEditor.h" // for nsIPlaintextEditor, etc. @@ -145,7 +144,7 @@ struct IMEState; * delegate the actual commands to the editor independent of the XPFE * implementation. */ -class EditorBase : public nsIEditorIMESupport +class EditorBase : public nsIEditor , public nsSupportsWeakReference , public nsIPhonetic { @@ -197,9 +196,6 @@ public: // nsIEditor methods NS_DECL_NSIEDITOR - // nsIEditorIMESupport methods - NS_DECL_NSIEDITORIMESUPPORT - // nsIPhonetic NS_DECL_NSIPHONETIC diff --git a/editor/moz.build b/editor/moz.build index 35185341b907..cd5f3f510dac 100644 --- a/editor/moz.build +++ b/editor/moz.build @@ -16,7 +16,6 @@ XPIDL_SOURCES += [ 'nsIDocumentStateListener.idl', 'nsIEditActionListener.idl', 'nsIEditor.idl', - 'nsIEditorIMESupport.idl', 'nsIEditorMailSupport.idl', 'nsIEditorObserver.idl', 'nsIEditorSpellCheck.idl', diff --git a/editor/nsIEditorIMESupport.idl b/editor/nsIEditorIMESupport.idl deleted file mode 100644 index 1b6859e27c84..000000000000 --- a/editor/nsIEditorIMESupport.idl +++ /dev/null @@ -1,11 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * 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 "nsIEditor.idl" - -[scriptable, uuid(0ba7f490-afb8-46dd-87fc-bc6137fbc899)] -interface nsIEditorIMESupport : nsIEditor -{ -}; From b1a0b88c98ac110b60cef664d5c8f6bb90b6bbcd Mon Sep 17 00:00:00 2001 From: Tom Tung Date: Fri, 21 Apr 2017 13:29:31 +0800 Subject: [PATCH 071/111] Bug 1348050 - Part 1: Mark channel as urgent-start when the Fetch and XHR are triggered by user input events. r=baku,mayhemer Raise the urgent-start flag in the ClassOfService when the Fetch and XHR are triggered by user input events. The urgent-start classification will tell the network requests scheduler to perform it with the highest priority and also ignoring any parallelism or overall connection limits. MozReview-Commit-ID: 2YavWbuFaln --HG-- extra : rebase_source : 40f41d1a4b9e323c0cf5710c6d5f2a1e45e93076 --- dom/fetch/FetchDriver.cpp | 8 ++++++++ dom/xhr/XMLHttpRequestMainThread.cpp | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/dom/fetch/FetchDriver.cpp b/dom/fetch/FetchDriver.cpp index dd34a4425732..20ecc7ef078e 100644 --- a/dom/fetch/FetchDriver.cpp +++ b/dom/fetch/FetchDriver.cpp @@ -30,6 +30,7 @@ #include "mozilla/dom/File.h" #include "mozilla/dom/workers/Workers.h" +#include "mozilla/EventStateManager.h" #include "mozilla/ipc/PBackgroundSharedTypes.h" #include "mozilla/Unused.h" @@ -255,6 +256,13 @@ FetchDriver::HttpFetch() #endif chan->SetNotificationCallbacks(this); + nsCOMPtr cos(do_QueryInterface(chan)); + // Mark channel as urgent-start if the Fetch is triggered by user input + // events. + if (cos && EventStateManager::IsHandlingUserInput()) { + cos->AddClassFlags(nsIClassOfService::UrgentStart); + } + // Step 3.5 begins "HTTP network or cache fetch". // HTTP network or cache fetch // --------------------------- diff --git a/dom/xhr/XMLHttpRequestMainThread.cpp b/dom/xhr/XMLHttpRequestMainThread.cpp index f2bccfaf6e82..8ea4b289f0ed 100644 --- a/dom/xhr/XMLHttpRequestMainThread.cpp +++ b/dom/xhr/XMLHttpRequestMainThread.cpp @@ -27,6 +27,7 @@ #include "mozilla/dom/PromiseNativeHandler.h" #include "mozilla/EventDispatcher.h" #include "mozilla/EventListenerManager.h" +#include "mozilla/EventStateManager.h" #include "mozilla/LoadInfo.h" #include "mozilla/LoadContext.h" #include "mozilla/MemoryReporting.h" @@ -2652,6 +2653,12 @@ XMLHttpRequestMainThread::InitiateFetch(nsIInputStream* aUploadStream, nsCOMPtr cos(do_QueryInterface(mChannel)); if (cos) { cos->AddClassFlags(nsIClassOfService::Unblocked); + + // Mark channel as urgent-start if the XHR is triggered by user input + // events. + if (EventStateManager::IsHandlingUserInput()) { + cos->AddClassFlags(nsIClassOfService::UrgentStart); + } } // Disable Necko-internal response timeouts. From a93ae19e1dc2c5bf932aad090efc3a104e2d26d0 Mon Sep 17 00:00:00 2001 From: Tom Tung Date: Tue, 25 Apr 2017 17:37:22 +0800 Subject: [PATCH 072/111] Bug 1348050 - Part 2: Create a chrome mochitest for Fetch and XHR to ensure we set the urgent-start flag only when they are triggered by user input events. r=baku,mayhemer Create a test to guarantee current behaviors. We should only set urgent-start when it is triggered by user input events rather the other events or no any events. MozReview-Commit-ID: 1ehiD3ua5Kl MozReview-Commit-ID: H6bL8PpzijJ --HG-- extra : rebase_source : ae66b05eded40907d690ac69ea37a739413b9e51 --- dom/base/test/chrome.ini | 1 + dom/base/test/test_urgent_start.html | 220 +++++++++++++++++++++++++++ 2 files changed, 221 insertions(+) create mode 100644 dom/base/test/test_urgent_start.html diff --git a/dom/base/test/chrome.ini b/dom/base/test/chrome.ini index 85b2f57f803f..f991aacd130c 100644 --- a/dom/base/test/chrome.ini +++ b/dom/base/test/chrome.ini @@ -30,4 +30,5 @@ skip-if = buildapp == 'mulet' support-files = file_navigator_resolve_identity_xrays.xul [test_sandboxed_blob_uri.html] [test_sendQueryContentAndSelectionSetEvent.html] +[test_urgent_start.html] [test_websocket_frame.html] diff --git a/dom/base/test/test_urgent_start.html b/dom/base/test/test_urgent_start.html new file mode 100644 index 000000000000..90e0c4f52445 --- /dev/null +++ b/dom/base/test/test_urgent_start.html @@ -0,0 +1,220 @@ + + + + + Test for urgent-start on Fetch and XHR + + + + + +
    +
    +
    + + From 0e308b0c4fe4abd85b0506249aca1d87740974de Mon Sep 17 00:00:00 2001 From: Tom Tung Date: Tue, 25 Apr 2017 09:17:38 +0800 Subject: [PATCH 073/111] Bug 1348050 - Part 3: Mark channel as urgent-start for loading image. r=baku,mayhemer This part is mainly to mark the channel as urgent-start if src related attributes in HTMLImageElement and HTMLInputElement is set and the channel is open due to user interaction. Unfortunately, we cannot just check the event state just after creating channel since some loading image tasks will be queue and execute in stable state. Thus, I store the event state in elements and pass it to the place where create the channel. MozReview-Commit-ID: GBdAkPfVzsn --HG-- extra : rebase_source : 715352317b4b600f8a7f78b7bc22b894bb272d27 --- docshell/base/nsContextMenuInfo.cpp | 3 +- dom/base/nsContentUtils.cpp | 4 ++- dom/base/nsContentUtils.h | 5 +++- dom/base/nsImageLoadingContent.cpp | 9 +++++- dom/base/nsImageLoadingContent.h | 7 +++++ dom/html/HTMLImageElement.cpp | 45 +++++++++++++++++++++++++++-- dom/html/HTMLInputElement.cpp | 12 ++++++++ dom/svg/SVGFEImageElement.cpp | 4 +++ dom/svg/SVGImageElement.cpp | 5 ++++ image/imgLoader.cpp | 8 +++++ image/imgLoader.h | 1 + layout/generic/nsImageFrame.cpp | 1 + widget/cocoa/nsMenuItemIconX.mm | 1 + 13 files changed, 99 insertions(+), 6 deletions(-) diff --git a/docshell/base/nsContextMenuInfo.cpp b/docshell/base/nsContextMenuInfo.cpp index 5052dda65550..0df163d38fa2 100644 --- a/docshell/base/nsContextMenuInfo.cpp +++ b/docshell/base/nsContextMenuInfo.cpp @@ -302,7 +302,8 @@ nsContextMenuInfo::GetBackgroundImageRequestInternal(nsIDOMNode* aDOMNode, doc->GetReferrerPolicy(), principal, nullptr, nullptr, nullptr, nullptr, nsIRequest::LOAD_NORMAL, nullptr, nsIContentPolicy::TYPE_INTERNAL_IMAGE, - EmptyString(), aRequest); + EmptyString(), + /* aUseUrgentStartForChannel */ false, aRequest); } } diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index b463cdb5365a..bc989f0892b2 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -3512,7 +3512,8 @@ nsContentUtils::LoadImage(nsIURI* aURI, nsINode* aContext, imgINotificationObserver* aObserver, int32_t aLoadFlags, const nsAString& initiatorType, imgRequestProxy** aRequest, - uint32_t aContentPolicyType) + uint32_t aContentPolicyType, + bool aUseUrgentStartForChannel) { NS_PRECONDITION(aURI, "Must have a URI"); NS_PRECONDITION(aContext, "Must have a context"); @@ -3551,6 +3552,7 @@ nsContentUtils::LoadImage(nsIURI* aURI, nsINode* aContext, nullptr, /* cache key */ aContentPolicyType, /* content policy type */ initiatorType, /* the load initiator */ + aUseUrgentStartForChannel, /* urgent-start flag */ aRequest); } diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h index 707fb95c5289..0d418adccbdc 100644 --- a/dom/base/nsContentUtils.h +++ b/dom/base/nsContentUtils.h @@ -769,6 +769,8 @@ public: * @param aLoadFlags the load flags to use. See nsIRequest * @param [aContentPolicyType=nsIContentPolicy::TYPE_INTERNAL_IMAGE] (Optional) * The CP content type to use + * @param aUseUrgentStartForChannel,(Optional) a flag to mark on channel if it + * is triggered by user input events. * @return the imgIRequest for the image load */ static nsresult LoadImage(nsIURI* aURI, @@ -781,7 +783,8 @@ public: int32_t aLoadFlags, const nsAString& initiatorType, imgRequestProxy** aRequest, - uint32_t aContentPolicyType = nsIContentPolicy::TYPE_INTERNAL_IMAGE); + uint32_t aContentPolicyType = nsIContentPolicy::TYPE_INTERNAL_IMAGE, + bool aUseUrgentStartForChannel = false); /** * Obtain an image loader that respects the given document/channel's privacy status. diff --git a/dom/base/nsImageLoadingContent.cpp b/dom/base/nsImageLoadingContent.cpp index ec1dfa00bd46..2d2659bda401 100644 --- a/dom/base/nsImageLoadingContent.cpp +++ b/dom/base/nsImageLoadingContent.cpp @@ -44,6 +44,7 @@ #include "mozAutoDocUpdate.h" #include "mozilla/AsyncEventDispatcher.h" +#include "mozilla/EventStateManager.h" #include "mozilla/EventStates.h" #include "mozilla/dom/Element.h" #include "mozilla/dom/ImageTracker.h" @@ -92,6 +93,7 @@ nsImageLoadingContent::nsImageLoadingContent() mUserDisabled(false), mSuppressed(false), mNewRequestsWillNeedAnimationReset(false), + mUseUrgentStartForChannel(false), mStateChangerDepth(0), mCurrentRequestRegistered(false), mPendingRequestRegistered(false) @@ -884,7 +886,12 @@ nsImageLoadingContent::LoadImage(nsIURI* aNewURI, this, loadFlags, content->LocalName(), getter_AddRefs(req), - policyType); + policyType, + mUseUrgentStartForChannel); + + // Reset the flag to avoid loading from XPCOM or somewhere again else without + // initiated by user interaction. + mUseUrgentStartForChannel = false; // Tell the document to forget about the image preload, if any, for // this URI, now that we might have another imgRequestProxy for it. diff --git a/dom/base/nsImageLoadingContent.h b/dom/base/nsImageLoadingContent.h index 8138151491f1..80e6136eed17 100644 --- a/dom/base/nsImageLoadingContent.h +++ b/dom/base/nsImageLoadingContent.h @@ -455,6 +455,13 @@ protected: */ bool mNewRequestsWillNeedAnimationReset : 1; + /** + * Flag to indicate whether the channel should be mark as urgent-start. + * It should be set in *Element and passed to nsContentUtils::LoadImage. + * True if we want to set nsIClassOfService::UrgentStart to the channel to + * get the response ASAP for better user responsiveness. + */ + bool mUseUrgentStartForChannel; private: /* The number of nested AutoStateChangers currently tracking our state. */ uint8_t mStateChangerDepth; diff --git a/dom/html/HTMLImageElement.cpp b/dom/html/HTMLImageElement.cpp index d9af850f40ed..f16af2511753 100644 --- a/dom/html/HTMLImageElement.cpp +++ b/dom/html/HTMLImageElement.cpp @@ -79,9 +79,11 @@ namespace dom { class ImageLoadTask : public Runnable { public: - ImageLoadTask(HTMLImageElement *aElement, bool aAlwaysLoad) + ImageLoadTask(HTMLImageElement *aElement, bool aAlwaysLoad, + bool aUseUrgentStartForChannel) : mElement(aElement) , mAlwaysLoad(aAlwaysLoad) + , mUseUrgentStartForChannel(aUseUrgentStartForChannel) { mDocument = aElement->OwnerDoc(); mDocument->BlockOnload(); @@ -91,6 +93,7 @@ public: { if (mElement->mPendingImageLoadTask == this) { mElement->mPendingImageLoadTask = nullptr; + mElement->mUseUrgentStartForChannel = mUseUrgentStartForChannel; mElement->LoadSelectedImage(true, true, mAlwaysLoad); } mDocument->UnblockOnload(false); @@ -106,6 +109,10 @@ private: RefPtr mElement; nsCOMPtr mDocument; bool mAlwaysLoad; + + // True if we want to set nsIClassOfService::UrgentStart to the channel to + // get the response ASAP for better user responsiveness. + bool mUseUrgentStartForChannel; }; HTMLImageElement::HTMLImageElement(already_AddRefed& aNodeInfo) @@ -410,6 +417,10 @@ HTMLImageElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName, if (aName == nsGkAtoms::src && aNameSpaceID == kNameSpaceID_None && !aValue) { + // Mark channel as urgent-start before load image if the image load is + // initaiated by a user interaction. + mUseUrgentStartForChannel = EventStateManager::IsHandlingUserInput(); + // SetAttr handles setting src since it needs to catch img.src = // img.src, so we only need to handle the unset case if (InResponsiveMode()) { @@ -424,9 +435,17 @@ HTMLImageElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName, } } else if (aName == nsGkAtoms::srcset && aNameSpaceID == kNameSpaceID_None) { + // Mark channel as urgent-start before load image if the image load is + // initaiated by a user interaction. + mUseUrgentStartForChannel = EventStateManager::IsHandlingUserInput(); + PictureSourceSrcsetChanged(this, attrVal.String(), aNotify); } else if (aName == nsGkAtoms::sizes && aNameSpaceID == kNameSpaceID_None) { + // Mark channel as urgent-start before load image if the image load is + // initaiated by a user interaction. + mUseUrgentStartForChannel = EventStateManager::IsHandlingUserInput(); + PictureSourceSizesChanged(this, attrVal.String(), aNotify); } @@ -505,6 +524,10 @@ HTMLImageElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName, if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::src) { + // Mark channel as urgent-start before load image if the image load is + // initaiated by a user interaction. + mUseUrgentStartForChannel = EventStateManager::IsHandlingUserInput(); + if (InResponsiveMode()) { if (mResponsiveSelector && mResponsiveSelector->Content() == this) { @@ -562,6 +585,10 @@ HTMLImageElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName, // reload after the attribute has been set if the reload is triggerred by // cross origin changing. if (forceReload) { + // Mark channel as urgent-start before load image if the image load is + // initaiated by a user interaction. + mUseUrgentStartForChannel = EventStateManager::IsHandlingUserInput(); + if (InResponsiveMode()) { // per spec, full selection runs when this changes, even though // it doesn't directly affect the source selection @@ -600,6 +627,10 @@ HTMLImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent, mInDocResponsiveContent = true; } + // Mark channel as urgent-start before load image if the image load is + // initaiated by a user interaction. + mUseUrgentStartForChannel = EventStateManager::IsHandlingUserInput(); + // Run selection algorithm when an img element is inserted into a document // in order to react to changes in the environment. See note of // https://html.spec.whatwg.org/multipage/embedded-content.html#img-environment-changes @@ -612,6 +643,10 @@ HTMLImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent, // image load task is asynchronous we don't need to take special // care to avoid doing so when being filled by the parser. + // Mark channel as urgent-start before load image if the image load is + // initaiated by a user interaction. + mUseUrgentStartForChannel = EventStateManager::IsHandlingUserInput(); + // FIXME: Bug 660963 it would be nice if we could just have // ClearBrokenState update our state and do it fast... ClearBrokenState(); @@ -830,6 +865,10 @@ HTMLImageElement::CopyInnerTo(Element* aDest, bool aPreallocateChildren) // reaches a stable state. if (!dest->InResponsiveMode() && dest->HasAttr(kNameSpaceID_None, nsGkAtoms::src)) { + // Mark channel as urgent-start before load image if the image load is + // initaiated by a user interaction. + mUseUrgentStartForChannel = EventStateManager::IsHandlingUserInput(); + nsContentUtils::AddScriptRunner( NewRunnableMethod(dest, &HTMLImageElement::MaybeLoadImage)); } @@ -913,7 +952,9 @@ HTMLImageElement::QueueImageLoadTask(bool aAlwaysLoad) if (mPendingImageLoadTask) { alwaysLoad = alwaysLoad || mPendingImageLoadTask->AlwaysLoad(); } - RefPtr task = new ImageLoadTask(this, alwaysLoad); + RefPtr task = new ImageLoadTask(this, + alwaysLoad, + mUseUrgentStartForChannel); // The task checks this to determine if it was the last // queued event, and so earlier tasks are implicitly canceled. mPendingImageLoadTask = task; diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp index 20653682d213..4733c70f78a7 100644 --- a/dom/html/HTMLInputElement.cpp +++ b/dom/html/HTMLInputElement.cpp @@ -1361,6 +1361,10 @@ HTMLInputElement::BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName, } else if (aNotify && aName == nsGkAtoms::src && mType == NS_FORM_INPUT_IMAGE) { if (aValue) { + // Mark channel as urgent-start before load image if the image load is + // initaiated by a user interaction. + mUseUrgentStartForChannel = EventStateManager::IsHandlingUserInput(); + LoadImage(aValue->String(), true, aNotify, eImageLoadType_Normal); } else { // Null value means the attr got unset; drop the image @@ -5101,6 +5105,10 @@ HTMLInputElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent, // Our base URI may have changed; claim that our URI changed, and the // nsImageLoadingContent will decide whether a new image load is warranted. if (HasAttr(kNameSpaceID_None, nsGkAtoms::src)) { + // Mark channel as urgent-start before load image if the image load is + // initaiated by a user interaction. + mUseUrgentStartForChannel = EventStateManager::IsHandlingUserInput(); + // FIXME: Bug 660963 it would be nice if we could just have // ClearBrokenState update our state and do it fast... ClearBrokenState(); @@ -5292,6 +5300,10 @@ HTMLInputElement::HandleTypeChange(uint8_t aNewType, bool aNotify) // whether we have an image to load; nsAutoString src; if (GetAttr(kNameSpaceID_None, nsGkAtoms::src, src)) { + // Mark channel as urgent-start before load image if the image load is + // initaiated by a user interaction. + mUseUrgentStartForChannel = EventStateManager::IsHandlingUserInput(); + LoadImage(src, false, aNotify, eImageLoadType_Normal); } } diff --git a/dom/svg/SVGFEImageElement.cpp b/dom/svg/SVGFEImageElement.cpp index 2eb267208862..437b4c605037 100644 --- a/dom/svg/SVGFEImageElement.cpp +++ b/dom/svg/SVGFEImageElement.cpp @@ -6,6 +6,7 @@ #include "mozilla/dom/SVGFEImageElement.h" +#include "mozilla/EventStateManager.h" #include "mozilla/EventStates.h" #include "mozilla/dom/SVGFEImageElementBinding.h" #include "mozilla/dom/SVGFilterElement.h" @@ -91,6 +92,9 @@ SVGFEImageElement::LoadSVGImage(bool aForce, bool aNotify) } } + // Mark channel as urgent-start before load image if the image load is + // initaiated by a user interaction. + mUseUrgentStartForChannel = EventStateManager::IsHandlingUserInput(); return LoadImage(href, aForce, aNotify, eImageLoadType_Normal); } diff --git a/dom/svg/SVGImageElement.cpp b/dom/svg/SVGImageElement.cpp index b6d5a983660c..a0a0bf99354b 100644 --- a/dom/svg/SVGImageElement.cpp +++ b/dom/svg/SVGImageElement.cpp @@ -5,6 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "mozilla/ArrayUtils.h" +#include "mozilla/EventStateManager.h" #include "mozilla/EventStates.h" #include "mozilla/dom/SVGImageElement.h" @@ -133,6 +134,10 @@ SVGImageElement::LoadSVGImage(bool aForce, bool aNotify) if (baseURI && !href.IsEmpty()) NS_MakeAbsoluteURI(href, href, baseURI); + // Mark channel as urgent-start before load image if the image load is + // initaiated by a user interaction. + mUseUrgentStartForChannel = EventStateManager::IsHandlingUserInput(); + return LoadImage(href, aForce, aNotify, eImageLoadType_Normal); } diff --git a/image/imgLoader.cpp b/image/imgLoader.cpp index 29626727c6b9..419ff1128485 100644 --- a/image/imgLoader.cpp +++ b/image/imgLoader.cpp @@ -30,6 +30,7 @@ #include "nsStreamUtils.h" #include "nsIHttpChannel.h" #include "nsICacheInfoChannel.h" +#include "nsIClassOfService.h" #include "nsIInterfaceRequestor.h" #include "nsIInterfaceRequestorUtils.h" #include "nsIProgressEventSink.h" @@ -2089,6 +2090,7 @@ imgLoader::LoadImageXPCOM(nsIURI* aURI, aCacheKey, aContentPolicyType, EmptyString(), + /* aUseUrgentStartForChannel */ false, &proxy); *_retval = proxy; return rv; @@ -2108,6 +2110,7 @@ imgLoader::LoadImage(nsIURI* aURI, nsISupports* aCacheKey, nsContentPolicyType aContentPolicyType, const nsAString& initiatorType, + bool aUseUrgentStartForChannel, imgRequestProxy** _retval) { MOZ_RELEASE_ASSERT(NS_IsMainThread()); @@ -2277,6 +2280,11 @@ imgLoader::LoadImage(nsIURI* aURI, ("[this=%p] imgLoader::LoadImage -- Created new imgRequest" " [request=%p]\n", this, request.get())); + nsCOMPtr cos(do_QueryInterface(newChannel)); + if (cos && aUseUrgentStartForChannel) { + cos->AddClassFlags(nsIClassOfService::UrgentStart); + } + nsCOMPtr channelLoadGroup; newChannel->GetLoadGroup(getter_AddRefs(channelLoadGroup)); rv = request->Init(aURI, aURI, /* aHadInsecureRedirect = */ false, diff --git a/image/imgLoader.h b/image/imgLoader.h index d01f6e4c255d..a2f64618a159 100644 --- a/image/imgLoader.h +++ b/image/imgLoader.h @@ -307,6 +307,7 @@ public: nsISupports* aCacheKey, nsContentPolicyType aContentPolicyType, const nsAString& initiatorType, + bool aUseUrgentStartForChannel, imgRequestProxy** _retval); MOZ_MUST_USE nsresult diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index 5f5233279538..51acf122b652 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -2230,6 +2230,7 @@ nsImageFrame::LoadIcon(const nsAString& aSpec, nullptr, contentPolicyType, EmptyString(), + false, /* aUseUrgentStartForChannel */ aRequest); } diff --git a/widget/cocoa/nsMenuItemIconX.mm b/widget/cocoa/nsMenuItemIconX.mm index 1970eda9672a..00fb6e91a56d 100644 --- a/widget/cocoa/nsMenuItemIconX.mm +++ b/widget/cocoa/nsMenuItemIconX.mm @@ -319,6 +319,7 @@ nsMenuItemIconX::LoadIcon(nsIURI* aIconURI) mLoadingPrincipal, loadGroup, this, mContent, document, nsIRequest::LOAD_NORMAL, nullptr, mContentType, EmptyString(), + /* aUseUrgentStartForChannel */ false, getter_AddRefs(mIconRequest)); if (NS_FAILED(rv)) return rv; From 150ceb8855e5f7e423782e16fe865f1a074960aa Mon Sep 17 00:00:00 2001 From: Tom Tung Date: Fri, 28 Apr 2017 15:27:10 +0800 Subject: [PATCH 074/111] Bug 1348050 - Part 4: Mark channel as urgent-start for loading media. r=baku The part is mainly to set urgent-start for loading media when it's initiated by user interaction. For the HTMLMedia element, it has its algorithm to pre-load the media and users will get feedback once they play the media. Thus, I only set urgent-start when the media element has autoplay attribute since the sooner enough resource is loaded the sooner the media will be played. MozReview-Commit-ID: 7nu3PUt8iYo --HG-- extra : rebase_source : f1abfecdccb74f4ec79a057534c2e9a1bfd5ae41 --- dom/html/HTMLMediaElement.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp index c11e350e976f..224ff20b5a37 100644 --- a/dom/html/HTMLMediaElement.cpp +++ b/dom/html/HTMLMediaElement.cpp @@ -1164,6 +1164,10 @@ public: if (aElement->mUseUrgentStartForChannel && (cos = do_QueryInterface(channel))) { cos->AddClassFlags(nsIClassOfService::UrgentStart); + + // Reset the flag to avoid loading again without initiated by user + // interaction. + aElement->mUseUrgentStartForChannel = false; } // The listener holds a strong reference to us. This creates a @@ -1877,6 +1881,12 @@ void HTMLMediaElement::DoLoad() // view" of a gallery of videos. if (EventStateManager::IsHandlingUserInput()) { mHasUserInteraction = true; + + // Mark the channel as urgent-start when autopaly so that it will play the + // media from src after loading enough resource. + if (HasAttr(kNameSpaceID_None, nsGkAtoms::autoplay)) { + mUseUrgentStartForChannel = true; + } } SetPlayedOrSeeked(false); From eb17272b128154f96f9a20107d21f90cc2c01f1f Mon Sep 17 00:00:00 2001 From: Tom Tung Date: Fri, 5 May 2017 13:59:42 +0800 Subject: [PATCH 075/111] Bug 1348050 - Part 5: Mark channel as urgent-start for embed element. r=baku This patch is mainly for ObjectLoadingContent. Since there is no any runnable between setting src and creating channel, I check urgent-start just after creating channel. MozReview-Commit-ID: IoishRqENBM --HG-- extra : rebase_source : 25799e27c6a2eb50d5ee3aded0d66fe6bb05c52b --- dom/base/nsObjectLoadingContent.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dom/base/nsObjectLoadingContent.cpp b/dom/base/nsObjectLoadingContent.cpp index 8ba71a45ea14..0e3f1effcf8b 100644 --- a/dom/base/nsObjectLoadingContent.cpp +++ b/dom/base/nsObjectLoadingContent.cpp @@ -11,6 +11,7 @@ // Interface headers #include "imgLoader.h" +#include "nsIClassOfService.h" #include "nsIConsoleService.h" #include "nsIContent.h" #include "nsIContentInlines.h" @@ -84,6 +85,7 @@ #include "mozilla/dom/PluginCrashedEvent.h" #include "mozilla/AsyncEventDispatcher.h" #include "mozilla/EventDispatcher.h" +#include "mozilla/EventStateManager.h" #include "mozilla/EventStates.h" #include "mozilla/IntegerPrintfMacros.h" #include "mozilla/dom/HTMLObjectElementBinding.h" @@ -2548,6 +2550,11 @@ nsObjectLoadingContent::OpenChannel() if (timedChannel) { timedChannel->SetInitiatorType(thisContent->LocalName()); } + + nsCOMPtr cos(do_QueryInterface(httpChan)); + if (cos && EventStateManager::IsHandlingUserInput()) { + cos->AddClassFlags(nsIClassOfService::UrgentStart); + } } nsCOMPtr scriptChannel = do_QueryInterface(chan); From 2f54068f26002fa62a2f566ae0bee0fa6716a4d9 Mon Sep 17 00:00:00 2001 From: Tom Tung Date: Thu, 4 May 2017 16:09:17 +0800 Subject: [PATCH 076/111] Bug 1348050 - Part 6: Expand the original test to verify src attribute. r=baku,mayhemer Since there are some mechanism to prevent from loading multiplace resorce at a same time for an element, I rewrote the test to isolate each subtests and make sure they will not bother each other. MozReview-Commit-ID: 59h8rzjDxKj --HG-- extra : rebase_source : 8ab8167080a69decf2e1d3c0c74a5f96bef5ecec --- dom/base/test/test_urgent_start.html | 171 +++++++++++++++++---------- 1 file changed, 111 insertions(+), 60 deletions(-) diff --git a/dom/base/test/test_urgent_start.html b/dom/base/test/test_urgent_start.html index 90e0c4f52445..a8e789b06478 100644 --- a/dom/base/test/test_urgent_start.html +++ b/dom/base/test/test_urgent_start.html @@ -4,7 +4,7 @@ Test for fetch and xhr to guarantee we only mark channel as urgent-start when it is triggered by user input events. - For { Fetch, XHR }, do the test as following: + For { Fetch, SRC-*, XHR }, do the test as following: Step 1: Verify them not mark the channel when there is no any input event. Step 2: Verify them mark the channel there is a user input event. Step 3: Verify them not mark the channel when there is a non input event. @@ -24,6 +24,11 @@ + + + + +