From 252f655de49e8bc0101b44f2d698bb4585735b6e Mon Sep 17 00:00:00 2001 From: Gijs Kruitbosch Date: Sun, 29 Jan 2017 17:36:01 +0100 Subject: [PATCH 01/24] Bug 1334774 - re-introduce the hostname into ssl error messages, r=nhnt11 MozReview-Commit-ID: CexcCq5qo1v --HG-- extra : rebase_source : afd9fd1178c8c72d31f8e17d66caa8bcaf8f3013 --- browser/base/content/aboutNetError.xhtml | 3 +++ .../base/content/test/general/browser_aboutCertError.js | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/browser/base/content/aboutNetError.xhtml b/browser/base/content/aboutNetError.xhtml index 1df2101a5ff7..daebab3656bb 100644 --- a/browser/base/content/aboutNetError.xhtml +++ b/browser/base/content/aboutNetError.xhtml @@ -351,6 +351,9 @@ function initPageCertError() { document.body.className = "certerror"; document.title = document.getElementById("certErrorPageTitle").textContent; + for (let host of document.querySelectorAll(".hostname")) { + host.textContent = document.location.hostname; + } setupAdvancedButton(true); diff --git a/browser/base/content/test/general/browser_aboutCertError.js b/browser/base/content/test/general/browser_aboutCertError.js index 8801f16b8334..93651f55bae7 100644 --- a/browser/base/content/test/general/browser_aboutCertError.js +++ b/browser/base/content/test/general/browser_aboutCertError.js @@ -217,7 +217,7 @@ add_task(function* checkWrongSystemTimeWarning() { }); add_task(function* checkAdvancedDetails() { - info("Loading a bad cert page and verifying the advanced details section"); + info("Loading a bad cert page and verifying the main error and advanced details section"); let browser; let certErrorLoaded; yield BrowserTestUtils.openNewForegroundTab(gBrowser, () => { @@ -231,6 +231,11 @@ add_task(function* checkAdvancedDetails() { let message = yield ContentTask.spawn(browser, null, function* () { let doc = content.document; + let shortDescText = doc.getElementById("errorShortDescText"); + info("Main error text: " + shortDescText.textContent); + ok(shortDescText.textContent.includes("expired.example.com"), + "Should list hostname in error message."); + let advancedButton = doc.getElementById("advancedButton"); advancedButton.click(); let el = doc.getElementById("errorCode"); From dc5d7ffc4d1bb00183590b234ab474df1ec25c8a Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Tue, 24 Jan 2017 11:06:24 +1100 Subject: [PATCH 02/24] Bug 1333175 - Add :fullscreen pseudo-class in ua sheets into whitelist in browser_parsable_css.js. r=Gijs MozReview-Commit-ID: DmI1B4FEUgR --HG-- extra : rebase_source : e6de509ab396907005af9670695f974fcd0604d1 --- browser/base/content/test/general/browser_parsable_css.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/browser/base/content/test/general/browser_parsable_css.js b/browser/base/content/test/general/browser_parsable_css.js index 754d8e96419f..37e1baa8df17 100644 --- a/browser/base/content/test/general/browser_parsable_css.js +++ b/browser/base/content/test/general/browser_parsable_css.js @@ -48,6 +48,14 @@ let whitelist = [ isFromDevTools: false}, ]; +if (!Services.prefs.getBoolPref("full-screen-api.unprefix.enabled")) { + whitelist.push({ + sourceName: /res\/(ua|html)\.css$/i, + errorMessage: /Unknown pseudo-class .*\bfullscreen\b/i, + isFromDevTools: false + }); +} + // Platform can be "linux", "macosx" or "win". If omitted, the exception applies to all platforms. let allowedImageReferences = [ // Bug 1302691 From 9f50dbd0e4a207c83151cd444bc997a30a74fc82 Mon Sep 17 00:00:00 2001 From: Julian Descottes Date: Tue, 27 Dec 2016 17:59:58 +0100 Subject: [PATCH 03/24] Bug 1335037 - add options to toggle new frontend for console/debugger;r=jryans Add options (available in Nightly/Local builds only) to switch between the old and new frontends for console and debugger. MozReview-Commit-ID: 413xt7h9aoP --HG-- extra : rebase_source : e1dcfdce8197b55674bab5e0ba992c4cccc12198 --- devtools/client/framework/toolbox-options.js | 52 ++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/devtools/client/framework/toolbox-options.js b/devtools/client/framework/toolbox-options.js index 5eadf539e29c..82e089c67f33 100644 --- a/devtools/client/framework/toolbox-options.js +++ b/devtools/client/framework/toolbox-options.js @@ -14,6 +14,8 @@ const {gDevTools} = require("devtools/client/framework/devtools"); const {LocalizationHelper} = require("devtools/shared/l10n"); const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties"); +loader.lazyRequireGetter(this, "system", "devtools/shared/system"); + exports.OptionsPanel = OptionsPanel; function GetPref(name) { @@ -91,6 +93,7 @@ OptionsPanel.prototype = { this.setupToolsList(); this.setupToolbarButtonsList(); this.setupThemeList(); + this.setupNightlyOptions(); yield this.populatePreferences(); this.isReady = true; this.emit("ready"); @@ -302,6 +305,55 @@ OptionsPanel.prototype = { this.updateCurrentTheme(); }, + /** + * Add common preferences enabled only on Nightly. + */ + setupNightlyOptions: function () { + let isNightly = system.constants.NIGHTLY_BUILD; + if (!isNightly) { + return; + } + + // Labels for these new buttons are nightly only and mostly intended for working on + // devtools. They should not be localized. + let prefDefinitions = [{ + pref: "devtools.webconsole.new-frontend-enabled", + label: "Enable new console frontend", + id: "devtools-new-webconsole", + parentId: "webconsole-options" + }, { + pref: "devtools.debugger.new-debugger-frontend", + label: "Enable new debugger frontend", + id: "devtools-new-debugger", + parentId: "debugger-options" + }]; + + let createPreferenceOption = ({pref, label, id}) => { + let inputLabel = this.panelDoc.createElement("label"); + let checkbox = this.panelDoc.createElement("input"); + checkbox.setAttribute("type", "checkbox"); + if (GetPref(pref)) { + checkbox.setAttribute("checked", "checked"); + } + checkbox.setAttribute("id", id); + checkbox.addEventListener("change", e => { + SetPref(pref, e.target.checked); + }); + + let inputSpanLabel = this.panelDoc.createElement("span"); + inputSpanLabel.textContent = label; + inputLabel.appendChild(checkbox); + inputLabel.appendChild(inputSpanLabel); + + return inputLabel; + }; + + for (let prefDefinition of prefDefinitions) { + let parent = this.panelDoc.getElementById(prefDefinition.parentId); + parent.appendChild(createPreferenceOption(prefDefinition)); + } + }, + populatePreferences: function () { let prefCheckboxes = this.panelDoc.querySelectorAll( "input[type=checkbox][data-pref]"); From 2a5f2b5c1044655ebe0b785e96ad7e11a9d1b460 Mon Sep 17 00:00:00 2001 From: Gerald Squelart Date: Wed, 1 Feb 2017 12:18:59 +1100 Subject: [PATCH 04/24] Bug 1321051 - Override Supports(TrackInfo) in RemoteDecoderModule - r=jya With e10s enabled, RemoteDecoderModule is used as a proxy, but it was not overriding Supports(TrackInfo), meaning that some of the extra information carried in TrackInfo (e.g.: resolution) was lost when falling back to SupportsMimeType(nsACString). So further along, WMFDecoderModule was not able to reject too-high resolutions. Overriding Supports(TrackInfo) to just forward the TrackInfo data is enough to re-enable resolution checks on Windows. MozReview-Commit-ID: 3OsPmILItH7 --HG-- extra : rebase_source : 26699634f5d2af8e83e9f99e5725846f5b75681c --- dom/media/ipc/RemoteVideoDecoder.cpp | 7 +++++++ dom/media/ipc/RemoteVideoDecoder.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/dom/media/ipc/RemoteVideoDecoder.cpp b/dom/media/ipc/RemoteVideoDecoder.cpp index 0cbc5a0689eb..824ff555f0ed 100644 --- a/dom/media/ipc/RemoteVideoDecoder.cpp +++ b/dom/media/ipc/RemoteVideoDecoder.cpp @@ -152,6 +152,13 @@ RemoteDecoderModule::SupportsMimeType(const nsACString& aMimeType, return mWrapped->SupportsMimeType(aMimeType, aDiagnostics); } +bool +RemoteDecoderModule::Supports(const TrackInfo& aTrackInfo, + DecoderDoctorDiagnostics* aDiagnostics) const +{ + return mWrapped->Supports(aTrackInfo, aDiagnostics); +} + PlatformDecoderModule::ConversionRequired RemoteDecoderModule::DecoderNeedsConversion(const TrackInfo& aConfig) const { diff --git a/dom/media/ipc/RemoteVideoDecoder.h b/dom/media/ipc/RemoteVideoDecoder.h index 3c8e86bbaa91..de647b013672 100644 --- a/dom/media/ipc/RemoteVideoDecoder.h +++ b/dom/media/ipc/RemoteVideoDecoder.h @@ -67,6 +67,8 @@ public: bool SupportsMimeType(const nsACString& aMimeType, DecoderDoctorDiagnostics* aDiagnostics) const override; + bool Supports(const TrackInfo& aTrackInfo, + DecoderDoctorDiagnostics* aDiagnostics) const override; ConversionRequired DecoderNeedsConversion( const TrackInfo& aConfig) const override; From 72081ad0b677983f59774582ba9bfcbff344e5e3 Mon Sep 17 00:00:00 2001 From: Gerald Squelart Date: Wed, 1 Feb 2017 19:17:29 +1100 Subject: [PATCH 05/24] Bug 1334445 - Abort AnnexB parsing on ByteWriter failure - r=jya All writes through a ByteWriter are now checked for success. Possible failures could be in three classes: A. Attempt to write a single unreasonably-large block of data. In this case we just don't allocate more memory, so Firefox should keep functioning but simply refuse to play this media. B. Accumulation of a lot of data into a single vector. In this case we return from the function, which should immediately free the large vector, and hopefully allow Firefox to continue unscathed; but there is the possibility that other memory allocations elsewhere will fail in the meantime. C. OOM across all of Firefox, and this write is just the final drop. Like previously we will still try to return and deallocate some memory, but this may not be enough to recover. So even though this patch cannot fix all possible OOM causes, I think it is worth adding, as it is simple enough, and will help in some cases where corrupted data could sensibly be handled without making Firefox crash. MozReview-Commit-ID: JPVC9hao4Uq --HG-- extra : rebase_source : b4a8af61ec8f4129819d2e8d51a5b9adc449183c --- media/libstagefright/binding/AnnexB.cpp | 45 +++++++++++++------ .../binding/include/mp4_demuxer/ByteWriter.h | 28 ++++++------ 2 files changed, 45 insertions(+), 28 deletions(-) diff --git a/media/libstagefright/binding/AnnexB.cpp b/media/libstagefright/binding/AnnexB.cpp index 2668e7408161..20dc450bb04a 100644 --- a/media/libstagefright/binding/AnnexB.cpp +++ b/media/libstagefright/binding/AnnexB.cpp @@ -45,11 +45,15 @@ AnnexB::ConvertSampleToAnnexB(mozilla::MediaRawData* aSample, bool aAddSPS) uint32_t nalLen = reader.ReadU32(); const uint8_t* p = reader.Read(nalLen); - writer.Write(kAnnexBDelimiter, ArrayLength(kAnnexBDelimiter)); + if (!writer.Write(kAnnexBDelimiter, ArrayLength(kAnnexBDelimiter))) { + return false; + } if (!p) { break; } - writer.Write(p, nalLen); + if (!writer.Write(p, nalLen)) { + return false; + } } nsAutoPtr samplewriter(aSample->CreateWriter()); @@ -188,7 +192,7 @@ FindStartCode(ByteReader& aBr, size_t& aStartSize) return true; } -static void +static bool ParseNALUnits(ByteWriter& aBw, ByteReader& aBr) { size_t startSize; @@ -200,17 +204,22 @@ ParseNALUnits(ByteWriter& aBw, ByteReader& aBr) size_t offset = aBr.Offset(); size_t sizeNAL = offset - startOffset - startSize; aBr.Seek(startOffset); - aBw.WriteU32(sizeNAL); - aBw.Write(aBr.Read(sizeNAL), sizeNAL); + if (!aBw.WriteU32(sizeNAL) + || !aBw.Write(aBr.Read(sizeNAL), sizeNAL)) { + return false; + } aBr.Read(startSize); startOffset = offset; } } size_t sizeNAL = aBr.Remaining(); if (sizeNAL) { - aBw.WriteU32(sizeNAL); - aBw.Write(aBr.Read(sizeNAL), sizeNAL); + if (!aBw.WriteU32(sizeNAL) + || !aBw.Write(aBr.Read(sizeNAL), sizeNAL)) { + return false; + } } + return true; } bool @@ -228,7 +237,9 @@ AnnexB::ConvertSampleToAVCC(mozilla::MediaRawData* aSample) ByteWriter writer(nalu); ByteReader reader(aSample->Data(), aSample->Size()); - ParseNALUnits(writer, reader); + if (!ParseNALUnits(writer, reader)) { + return false; + } nsAutoPtr samplewriter(aSample->CreateWriter()); return samplewriter->Replace(nalu.begin(), nalu.length()); } @@ -284,12 +295,16 @@ AnnexB::ExtractExtraData(const mozilla::MediaRawData* aSample) if (nalType == 0x7) { /* SPS */ numSps++; - spsw.WriteU16(nalLen); - spsw.Write(p, nalLen); + if (!spsw.WriteU16(nalLen) + || !spsw.Write(p, nalLen)) { + return extradata.forget(); + } } else if (nalType == 0x8) { /* PPS */ numPps++; - ppsw.WriteU16(nalLen); - ppsw.Write(p, nalLen); + if (!ppsw.WriteU16(nalLen) + || !ppsw.Write(p, nalLen)) { + return extradata.forget(); + } } } @@ -399,8 +414,10 @@ AnnexB::ConvertSampleTo4BytesAVCC(mozilla::MediaRawData* aSample) if (!p) { return true; } - writer.WriteU32(nalLen); - writer.Write(p, nalLen); + if (!writer.WriteU32(nalLen) + || !writer.Write(p, nalLen)) { + return false; + } } nsAutoPtr samplewriter(aSample->CreateWriter()); return samplewriter->Replace(dest.begin(), dest.length()); diff --git a/media/libstagefright/binding/include/mp4_demuxer/ByteWriter.h b/media/libstagefright/binding/include/mp4_demuxer/ByteWriter.h index 78f6fb58ae73..48ebdd460f79 100644 --- a/media/libstagefright/binding/include/mp4_demuxer/ByteWriter.h +++ b/media/libstagefright/binding/include/mp4_demuxer/ByteWriter.h @@ -22,49 +22,49 @@ public: { } - void WriteU8(uint8_t aByte) + MOZ_MUST_USE bool WriteU8(uint8_t aByte) { - Write(&aByte, 1); + return Write(&aByte, 1); } - void WriteU16(uint16_t aShort) + MOZ_MUST_USE bool WriteU16(uint16_t aShort) { uint8_t c[2]; mozilla::BigEndian::writeUint16(&c[0], aShort); - Write(&c[0], 2); + return Write(&c[0], 2); } - void WriteU32(uint32_t aLong) + MOZ_MUST_USE bool WriteU32(uint32_t aLong) { uint8_t c[4]; mozilla::BigEndian::writeUint32(&c[0], aLong); - Write(&c[0], 4); + return Write(&c[0], 4); } - void Write32(int32_t aLong) + MOZ_MUST_USE bool Write32(int32_t aLong) { uint8_t c[4]; mozilla::BigEndian::writeInt32(&c[0], aLong); - Write(&c[0], 4); + return Write(&c[0], 4); } - void WriteU64(uint64_t aLongLong) + MOZ_MUST_USE bool WriteU64(uint64_t aLongLong) { uint8_t c[8]; mozilla::BigEndian::writeUint64(&c[0], aLongLong); - Write(&c[0], 8); + return Write(&c[0], 8); } - void Write64(int64_t aLongLong) + MOZ_MUST_USE bool Write64(int64_t aLongLong) { uint8_t c[8]; mozilla::BigEndian::writeInt64(&c[0], aLongLong); - Write(&c[0], 8); + return Write(&c[0], 8); } - void Write(const uint8_t* aSrc, size_t aCount) + MOZ_MUST_USE bool Write(const uint8_t* aSrc, size_t aCount) { - MOZ_RELEASE_ASSERT(mPtr.append(aSrc, aCount)); + return mPtr.append(aSrc, aCount); } private: From 35e6f00f369b164a0119c8d597fcec34915e9c25 Mon Sep 17 00:00:00 2001 From: Johann Hofmann Date: Tue, 31 Jan 2017 22:44:14 +0100 Subject: [PATCH 06/24] Bug 1334418 - Enable full tab focus on OSX in identityBlock_focus tests. r=Gijs MozReview-Commit-ID: 54ieeV15tDq --HG-- extra : rebase_source : c48e57c6efe285163f376f54f7b6b7591b1e72bc --- browser/base/content/test/siteIdentity/browser.ini | 1 - .../content/test/siteIdentity/browser_identityBlock_focus.js | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/browser/base/content/test/siteIdentity/browser.ini b/browser/base/content/test/siteIdentity/browser.ini index 1f4650b4dcba..8026e2c58fc2 100644 --- a/browser/base/content/test/siteIdentity/browser.ini +++ b/browser/base/content/test/siteIdentity/browser.ini @@ -3,5 +3,4 @@ support-files = head.js [browser_identityBlock_focus.js] -skip-if = os == 'mac' # Bug 1334418 (try only) support-files = ../general/permissions.html diff --git a/browser/base/content/test/siteIdentity/browser_identityBlock_focus.js b/browser/base/content/test/siteIdentity/browser_identityBlock_focus.js index e1e4e537a3bb..6728a0bc82e0 100644 --- a/browser/base/content/test/siteIdentity/browser_identityBlock_focus.js +++ b/browser/base/content/test/siteIdentity/browser_identityBlock_focus.js @@ -14,6 +14,7 @@ function synthesizeKeyAndWaitForFocus(element, keyCode, options) { // Checks that the identity block is the next element after the urlbar // to be focused if there are no active notification anchors. add_task(function* testWithoutNotifications() { + yield SpecialPowers.pushPrefEnv({"set": [["accessibility.tabfocus", 7]]}); yield BrowserTestUtils.withNewTab("https://example.com", function*() { yield synthesizeKeyAndWaitForFocus(gURLBar, "l", {accelKey: true}) is(document.activeElement, gURLBar.inputField, "urlbar should be focused"); @@ -26,7 +27,7 @@ add_task(function* testWithoutNotifications() { // Checks that when there is a notification anchor, it will receive // focus before the identity block. add_task(function* testWithoutNotifications() { - + yield SpecialPowers.pushPrefEnv({"set": [["accessibility.tabfocus", 7]]}); yield BrowserTestUtils.withNewTab(PERMISSIONS_PAGE, function*(browser) { let popupshown = BrowserTestUtils.waitForEvent(PopupNotifications.panel, "popupshown"); // Request a permission; @@ -46,6 +47,7 @@ add_task(function* testWithoutNotifications() { // Checks that with invalid pageproxystate the identity block is ignored. add_task(function* testInvalidPageProxyState() { + yield SpecialPowers.pushPrefEnv({"set": [["accessibility.tabfocus", 7]]}); yield BrowserTestUtils.withNewTab("about:blank", function*(browser) { // Loading about:blank will automatically focus the urlbar, which, however, can // race with the test code. So we only send the shortcut if the urlbar isn't focused yet. From d326016419079b71865aa5ae232ade15143a804e Mon Sep 17 00:00:00 2001 From: Andi-Bogdan Postelnicu Date: Wed, 1 Feb 2017 15:20:45 +0200 Subject: [PATCH 07/24] Bug 1335390 - prevent nul pointer dereference in parameter initialisation. r=baku MozReview-Commit-ID: H2RrwojBug --HG-- extra : rebase_source : e9bbb215095d09e7920a3063ca18b4d0114d4387 --- dom/media/MediaFormatReader.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp index 1ec8a79ae564..477477b0c770 100644 --- a/dom/media/MediaFormatReader.cpp +++ b/dom/media/MediaFormatReader.cpp @@ -791,7 +791,7 @@ MediaFormatReader::MediaFormatReader(AbstractMediaDecoder* aDecoder, Preferences::GetUint("media.audio-max-decode-error", 3)) , mVideo(this, MediaData::VIDEO_DATA, Preferences::GetUint("media.video-max-decode-error", 2)) - , mDemuxer(new DemuxerProxy(aDemuxer, aDecoder->AbstractMainThread())) + , mDemuxer(nullptr) , mDemuxerInitDone(false) , mLastReportedNumDecodedFrames(0) , mPreviousDecodedKeyframeTime_us(sNoPreviousDecodedKeyframe) @@ -804,10 +804,15 @@ MediaFormatReader::MediaFormatReader(AbstractMediaDecoder* aDecoder, MOZ_ASSERT(aDemuxer); MOZ_COUNT_CTOR(MediaFormatReader); - if (aDecoder && aDecoder->CompositorUpdatedEvent()) { - mCompositorUpdatedListener = - aDecoder->CompositorUpdatedEvent()->Connect( - mTaskQueue, this, &MediaFormatReader::NotifyCompositorUpdated); + if (aDecoder) { + mDemuxer = MakeUnique(aDemuxer, + aDecoder->AbstractMainThread()); + + if (aDecoder->CompositorUpdatedEvent()) { + mCompositorUpdatedListener = + aDecoder->CompositorUpdatedEvent()->Connect( + mTaskQueue, this, &MediaFormatReader::NotifyCompositorUpdated); + } } } From 6a9f5ff102c0f9b72dae14490608c22305a276ca Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Mon, 19 Dec 2016 12:40:02 +1100 Subject: [PATCH 08/24] Bug 1289642 - Remove prefixed PointerLock API. r=smaug MozReview-Commit-ID: BUSEojZNIgb --HG-- extra : rebase_source : bfdf71d5244d3b0877712a63cb07cf119c2e6992 --- dom/events/EventListenerManager.cpp | 21 --------------------- dom/webidl/Document.webidl | 4 ---- dom/webidl/Element.webidl | 2 -- dom/webidl/EventHandler.webidl | 4 ---- dom/webidl/MouseEvent.webidl | 5 ----- modules/libpref/init/all.js | 1 - 6 files changed, 37 deletions(-) diff --git a/dom/events/EventListenerManager.cpp b/dom/events/EventListenerManager.cpp index b03a362949f3..c52ab7a52625 100644 --- a/dom/events/EventListenerManager.cpp +++ b/dom/events/EventListenerManager.cpp @@ -120,19 +120,6 @@ IsWebkitPrefixSupportEnabled() return sIsWebkitPrefixSupportEnabled; } -static bool -IsPrefixedPointerLockEnabled() -{ - static bool sIsPrefixedPointerLockEnabled; - static bool sIsPrefCached = false; - if (!sIsPrefCached) { - sIsPrefCached = true; - Preferences::AddBoolVarCache(&sIsPrefixedPointerLockEnabled, - "pointer-lock-api.prefixed.enabled"); - } - return sIsPrefixedPointerLockEnabled; -} - EventListenerManagerBase::EventListenerManagerBase() : mNoListenerForEvent(eVoidEvent) , mMayHavePaintEventListener(false) @@ -1164,14 +1151,6 @@ EventListenerManager::GetLegacyEventMessage(EventMessage aEventMessage) const return eWebkitAnimationIteration; } } - if (IsPrefixedPointerLockEnabled()) { - if (aEventMessage == ePointerLockChange) { - return eMozPointerLockChange; - } - if (aEventMessage == ePointerLockError) { - return eMozPointerLockError; - } - } } switch (aEventMessage) { diff --git a/dom/webidl/Document.webidl b/dom/webidl/Document.webidl index 366993c72280..d8c0e31a28e6 100644 --- a/dom/webidl/Document.webidl +++ b/dom/webidl/Document.webidl @@ -254,11 +254,7 @@ partial interface Document { // https://w3c.github.io/pointerlock/#extensions-to-the-documentorshadowroot-mixin partial interface Document { readonly attribute Element? pointerLockElement; - [BinaryName="pointerLockElement", Pref="pointer-lock-api.prefixed.enabled"] - readonly attribute Element? mozPointerLockElement; void exitPointerLock(); - [BinaryName="exitPointerLock", Pref="pointer-lock-api.prefixed.enabled"] - void mozExitPointerLock(); // Event handlers attribute EventHandler onpointerlockchange; diff --git a/dom/webidl/Element.webidl b/dom/webidl/Element.webidl index 29efbdeb82f1..86d82c19537c 100644 --- a/dom/webidl/Element.webidl +++ b/dom/webidl/Element.webidl @@ -260,6 +260,4 @@ partial interface Element { partial interface Element { [UnsafeInPrerendering, NeedsCallerType] void requestPointerLock(); - [UnsafeInPrerendering, BinaryName="requestPointerLock", Pref="pointer-lock-api.prefixed.enabled", NeedsCallerType] - void mozRequestPointerLock(); }; diff --git a/dom/webidl/EventHandler.webidl b/dom/webidl/EventHandler.webidl index 24ea9126147f..83799a6be4b3 100644 --- a/dom/webidl/EventHandler.webidl +++ b/dom/webidl/EventHandler.webidl @@ -120,10 +120,6 @@ interface GlobalEventHandlers { // Document rather than here. attribute EventHandler onmozfullscreenchange; attribute EventHandler onmozfullscreenerror; - [Pref="pointer-lock-api.prefixed.enabled"] - attribute EventHandler onmozpointerlockchange; - [Pref="pointer-lock-api.prefixed.enabled"] - attribute EventHandler onmozpointerlockerror; // CSS-Animation and CSS-Transition handlers. attribute EventHandler onanimationend; diff --git a/dom/webidl/MouseEvent.webidl b/dom/webidl/MouseEvent.webidl index 3ebc46c9f98c..9492a86eb56f 100644 --- a/dom/webidl/MouseEvent.webidl +++ b/dom/webidl/MouseEvent.webidl @@ -77,11 +77,6 @@ dictionary MouseEventInit : EventModifierInit { // Mozilla extensions partial interface MouseEvent { - [BinaryName="movementX", Pref="pointer-lock-api.prefixed.enabled"] - readonly attribute long mozMovementX; - [BinaryName="movementY", Pref="pointer-lock-api.prefixed.enabled"] - readonly attribute long mozMovementY; - // Finger or touch pressure event value // ranges between 0.0 and 1.0 readonly attribute float mozPressure; diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 2c97e13b713f..e60fdcafc872 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -4818,7 +4818,6 @@ pref("full-screen-api.warning.timeout", 3000); pref("full-screen-api.warning.delay", 500); // DOM pointerlock API -pref("pointer-lock-api.prefixed.enabled", false); // time for the warning box stays on the screen before sliding out, unit: ms pref("pointer-lock-api.warning.timeout", 3000); From 72976b4efad39d6543e51d7641337b256f080621 Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Thu, 5 Jan 2017 07:31:13 +0000 Subject: [PATCH 09/24] Bug 1330545 - [eslint] Handle importScripts in workers for determining global variables. r=mossop MozReview-Commit-ID: 6NkcAcaNjur --HG-- extra : rebase_source : 2004e08b8e2e52b9ad329eb7604868ebe3bd60c6 --- .../eslint-plugin-mozilla/lib/globals.js | 53 ++++++++++++++++--- .../eslint-plugin-mozilla/lib/helpers.js | 42 ++++++++++++++- .../eslint/eslint-plugin-mozilla/package.json | 2 +- tools/lint/eslint/modules.json | 6 ++- 4 files changed, 92 insertions(+), 11 deletions(-) diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/globals.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/globals.js index 26807348644d..698ee8dbafa4 100644 --- a/tools/lint/eslint/eslint-plugin-mozilla/lib/globals.js +++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/globals.js @@ -65,15 +65,33 @@ const globalCache = new Map(); * parents parameter which is a list of the parent nodes of the current node. * Each returns an array of globals found. * - * @param {String} path + * @param {String} filePath * The absolute path of the file being parsed. */ -function GlobalsForNode(path) { - this.path = path; - this.root = helpers.getRootDir(path); +function GlobalsForNode(filePath) { + this.path = filePath; + this.dirname = path.dirname(this.path) + this.root = helpers.getRootDir(this.path); + this.isWorker = helpers.getIsWorker(this.path); } GlobalsForNode.prototype = { + Program(node) { + if (!this.isWorker) { + return []; + } + + return [ + {name: "importScripts", writable: false}, + // Only available to workers. + {name: "FileReaderSync", writable: false}, + {name: "onmessage", writable: true}, + // Only available to chrome workers, but since we don't know which is which, + // we make it available anyway. + {name: "ctypes", writable: false} + ]; + }, + BlockComment(node, parents) { let value = node.value.trim(); let match = /^import-globals-from\s+(.+)$/.exec(value); @@ -84,8 +102,7 @@ GlobalsForNode.prototype = { let filePath = match[1].trim(); if (!path.isAbsolute(filePath)) { - let dirName = path.dirname(this.path); - filePath = path.resolve(dirName, filePath); + filePath = path.resolve(this.dirname, filePath); } return module.exports.getGlobalsForFile(filePath); @@ -93,8 +110,19 @@ GlobalsForNode.prototype = { ExpressionStatement(node, parents) { let isGlobal = helpers.getIsGlobalScope(parents); - let names = helpers.convertExpressionToGlobals(node, isGlobal, this.root); - return names.map(name => { return { name, writable: true }}); + let globals = helpers.convertExpressionToGlobals(node, isGlobal, this.root); + // Map these globals now, as getGlobalsForFile is pre-mapped. + globals = globals.map(name => { return { name, writable: true }}); + + if (this.isWorker) { + let workerDetails = helpers.convertWorkerExpressionToGlobals(node, + isGlobal, this.root, this.dirname); + globals = globals.concat(workerDetails.map(name => { + return { name, writable: true }; + })); + } + + return globals; }, }; @@ -106,6 +134,12 @@ module.exports = { * * @param {String} path * The absolute path of the file to be parsed. + * @return {Array} + * An array of objects that contain details about the globals: + * - {String} name + * The name of the global. + * - {Boolean} writable + * If the global is writeable or not. */ getGlobalsForFile(path) { if (globalCache.has(path)) { @@ -179,6 +213,9 @@ module.exports = { for (let type of Object.keys(GlobalsForNode.prototype)) { parser[type] = function(node) { + if (type === "Program") { + globalScope = context.getScope(); + } let globals = handler[type](node, context.getAncestors()); helpers.addGlobals(globals, globalScope); } diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js index 258a3dc85007..1fd50ada6538 100644 --- a/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js +++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js @@ -38,6 +38,8 @@ var imports = [ /^(?:Cu|Components\.utils)\.import\(".*\/((.*?)\.jsm?)"(?:, this)?\)/, ]; +var workerImportFilenameMatch = /(.*\/)*(.*?\.jsm?)/; + module.exports = { /** * Gets the abstract syntax tree (AST) of the JavaScript source code contained @@ -168,8 +170,40 @@ module.exports = { * The root of the repository. * * @return {Array} - * An array of variable names defined. + * An array of global variable names defined. */ + convertWorkerExpressionToGlobals: function(node, isGlobal, repository, dirname) { + var getGlobalsForFile = require("./globals").getGlobalsForFile; + + if (!modules) { + modules = require(path.join(repository, "tools", "lint", "eslint", "modules.json")); + } + + let results = []; + let expr = node.expression; + + if (node.expression.type === "CallExpression" && + expr.callee && + expr.callee.type === "Identifier" && + expr.callee.name === "importScripts") { + for (var arg of expr.arguments) { + var match = arg.value.match(workerImportFilenameMatch); + if (match) { + if (!match[1]) { + let filePath = path.resolve(dirname, match[2]); + if (fs.existsSync(filePath)) { + let additionalGlobals = getGlobalsForFile(filePath); + results = results.concat(additionalGlobals); + } + } else if (match[2] in modules) { + results.push(modules[match[2]]); + } + } + } + } + return results; + }, + convertExpressionToGlobals: function(node, isGlobal, repository) { if (!modules) { modules = require(path.join(repository, "tools", "lint", "eslint", "modules.json")); @@ -460,6 +494,12 @@ module.exports = { return null; }, + getIsWorker: function(filePath) { + let filename = path.basename(this.cleanUpPath(filePath)).toLowerCase(); + + return filename.includes("worker"); + }, + /** * Gets the root directory of the repository by walking up directories until * a .eslintignore file is found. diff --git a/tools/lint/eslint/eslint-plugin-mozilla/package.json b/tools/lint/eslint/eslint-plugin-mozilla/package.json index 28075c73a3e1..92df733fab58 100644 --- a/tools/lint/eslint/eslint-plugin-mozilla/package.json +++ b/tools/lint/eslint/eslint-plugin-mozilla/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-mozilla", - "version": "0.2.16", + "version": "0.2.17", "description": "A collection of rules that help enforce JavaScript coding standard in the Mozilla project.", "keywords": [ "eslint", diff --git a/tools/lint/eslint/modules.json b/tools/lint/eslint/modules.json index 11b5324e5ce6..de8b009582c3 100644 --- a/tools/lint/eslint/modules.json +++ b/tools/lint/eslint/modules.json @@ -70,6 +70,7 @@ "EventUtils.js": ["disableNonTestMouseEvents", "sendMouseEvent", "sendChar", "sendString", "sendKey", "synthesizeMouse", "synthesizeTouch", "synthesizeMouseAtPoint", "synthesizeTouchAtPoint", "synthesizeMouseAtCenter", "synthesizeTouchAtCenter", "synthesizeWheel", "synthesizeKey", "synthesizeMouseExpectEvent", "synthesizeKeyExpectEvent", "synthesizeText", "synthesizeComposition", "synthesizeQuerySelectedText"], "Extension.jsm": ["Extension", "ExtensionData"], "ExtensionAPI.jsm": ["ExtensionAPI", "ExtensionAPIs"], + "ExtensionsUI.jsm": ["ExtensionsUI"], "extension-storage.js": ["ExtensionStorageEngine", "EncryptionRemoteTransformer", "KeyRingEncryptionRemoteTransformer"], "ExtensionXPCShellUtils.jsm": ["ExtensionTestUtils"], "fakeservices.js": ["FakeCryptoService", "FakeFilesystemService", "FakeGUIDService", "fakeSHA256HMAC"], @@ -110,6 +111,7 @@ "import_sub_module.jsm": ["SUBMODULE_IMPORTED", "test_obj"], "InlineSpellChecker.jsm": ["InlineSpellChecker", "SpellCheckHelper"], "JNI.jsm": ["JNI", "android_log"], + "JSDOMParser.js": ["JSDOMParser"], "Jsbeautify.jsm": ["jsBeautify"], "jsdebugger.jsm": ["addDebuggerToGlobal"], "json2.js": ["JSON"], @@ -149,7 +151,7 @@ "offlineAppCache.jsm": ["OfflineAppCacheHelper"], "OrientationChangeHandler.jsm": [], "os.js": ["listDirectory", "getFileForPath", "abspath", "getPlatform"], - "osfile.jsm": ["OS"], + "osfile.jsm": ["OS", "require"], "osfile_async_front.jsm": ["OS"], "osfile_native.jsm": ["read"], "osfile_shared_allthreads.jsm": ["LOG", "clone", "Config", "Constants", "Type", "HollowStructure", "OSError", "Library", "declareFFI", "declareLazy", "declareLazyFFI", "normalizeBufferArgs", "projectValue", "isArrayBuffer", "isTypedArray", "defineLazyGetter", "OS"], @@ -176,6 +178,7 @@ "PromiseWorker.jsm": ["BasePromiseWorker"], "PushCrypto.jsm": ["PushCrypto", "concatArray"], "quit.js": ["goQuitApplication"], + "Readability.js": ["Readability"], "record.js": ["WBORecord", "RecordManager", "CryptoWrapper", "CollectionKeyManager", "Collection"], "recursive_importA.jsm": ["foo", "bar"], "recursive_importB.jsm": ["baz", "qux"], @@ -187,6 +190,7 @@ "responsivedesign.jsm": ["ResponsiveUIManager"], "rest.js": ["RESTRequest", "RESTResponse", "TokenAuthenticatedRESTRequest", "SyncStorageRequest"], "rotaryengine.js": ["RotaryEngine", "RotaryRecord", "RotaryStore", "RotaryTracker"], + "require.js": ["require"], "RTCStatsReport.jsm": ["convertToRTCStatsReport"], "scratchpad-manager.jsm": ["ScratchpadManager"], "server.js": ["MarionetteServer"], From 9907b239c26e9658797edb7c5dd6bf7d43101afc Mon Sep 17 00:00:00 2001 From: Dimi Lee Date: Fri, 27 Jan 2017 18:02:36 +0800 Subject: [PATCH 10/24] Bug 1332770 - Fix the google4 provider is showing up as other in some telemetry pings. r=francois MozReview-Commit-ID: KbpYAnf6qxd --HG-- extra : rebase_source : fe524ca5afbd1b8b08b80198eeb43db5f84f677e --- .../nsUrlClassifierDBService.cpp | 9 ++++++--- .../nsUrlClassifierStreamUpdater.cpp | 20 +++++++++++-------- .../nsUrlClassifierStreamUpdater.h | 7 +++++++ .../url-classifier/nsUrlClassifierUtils.cpp | 7 +++++-- .../url-classifier/nsUrlClassifierUtils.h | 2 ++ 5 files changed, 32 insertions(+), 13 deletions(-) diff --git a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp index 346cdc42834e..182d8e749f25 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp @@ -631,8 +631,11 @@ nsUrlClassifierDBServiceWorker::FinishUpdate() mUpdateStatus : NS_ERROR_UC_UPDATE_UNKNOWN; } - Telemetry::Accumulate(Telemetry::URLCLASSIFIER_UPDATE_ERROR, provider, - NS_ERROR_GET_CODE(updateStatus)); + // Do not record telemetry for testing tables. + if (!provider.Equals(TESTING_TABLE_PROVIDER_NAME)) { + Telemetry::Accumulate(Telemetry::URLCLASSIFIER_UPDATE_ERROR, provider, + NS_ERROR_GET_CODE(updateStatus)); + } mMissCache.Clear(); @@ -989,7 +992,7 @@ nsUrlClassifierLookupCallback::LookupComplete(nsTArray* results) // has registered the table. In the second case we should not call // complete. if ((!gethashUrl.IsEmpty() || - StringBeginsWith(result.mTableName, NS_LITERAL_CSTRING("test-"))) && + StringBeginsWith(result.mTableName, NS_LITERAL_CSTRING("test"))) && mDBService->GetCompleter(result.mTableName, getter_AddRefs(completer))) { diff --git a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp index 183630f0a3d6..dfb6ac71f649 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp @@ -24,6 +24,7 @@ #include "mozilla/Telemetry.h" #include "nsContentUtils.h" #include "nsIURLFormatter.h" +#include "Classifier.h" static const char* gQuitApplicationMessage = "quit-application"; @@ -97,6 +98,7 @@ nsUrlClassifierStreamUpdater::DownloadDone() mSuccessCallback = nullptr; mUpdateErrorCallback = nullptr; mDownloadErrorCallback = nullptr; + mTelemetryProvider.Truncate(); } /////////////////////////////////////////////////////////////////////////////// @@ -283,6 +285,14 @@ nsUrlClassifierStreamUpdater::DownloadUpdates( return rv; } + nsCOMPtr urlUtil = + do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID); + + nsTArray tables; + mozilla::safebrowsing::Classifier::SplitTables(aRequestTables, tables); + urlUtil->GetTelemetryProvider(tables.SafeElementAt(0, EmptyCString()), + mTelemetryProvider); + mSuccessCallback = aSuccessCallback; mUpdateErrorCallback = aUpdateErrorCallback; mDownloadErrorCallback = aDownloadErrorCallback; @@ -635,17 +645,11 @@ nsUrlClassifierStreamUpdater::OnStartRequest(nsIRequest *request, spec.get(), this)); } - nsCOMPtr urlUtil = - do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID); - - nsCString provider; - urlUtil->GetTelemetryProvider(mStreamTable, provider); - if (NS_FAILED(status)) { // Assume we're overloading the server and trigger backoff. downloadError = true; mozilla::Telemetry::Accumulate(mozilla::Telemetry::URLCLASSIFIER_UPDATE_REMOTE_STATUS2, - provider, 15 /* unknown response code */); + mTelemetryProvider, 15 /* unknown response code */); } else { bool succeeded = false; @@ -656,7 +660,7 @@ nsUrlClassifierStreamUpdater::OnStartRequest(nsIRequest *request, rv = httpChannel->GetResponseStatus(&requestStatus); NS_ENSURE_SUCCESS(rv, rv); mozilla::Telemetry::Accumulate(mozilla::Telemetry::URLCLASSIFIER_UPDATE_REMOTE_STATUS2, - provider, HTTPStatusToBucket(requestStatus)); + mTelemetryProvider, HTTPStatusToBucket(requestStatus)); LOG(("nsUrlClassifierStreamUpdater::OnStartRequest %s (%d)", succeeded ? "succeeded" : "failed", requestStatus)); if (!succeeded) { diff --git a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.h b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.h index b24df61d2d4d..19f9006d5c18 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.h +++ b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.h @@ -73,7 +73,10 @@ private: bool mInitialized; bool mDownloadError; bool mBeganStream; + + // Note that mStreamTable is only used by v2, it is empty for v4 update. nsCString mStreamTable; + nsCOMPtr mChannel; nsCOMPtr mDBService; nsCOMPtr mTimer; @@ -98,6 +101,10 @@ private: nsCOMPtr mSuccessCallback; nsCOMPtr mUpdateErrorCallback; nsCOMPtr mDownloadErrorCallback; + + // The provider for current update request and should be only used by telemetry + // since it would show up as "other" for any other providers. + nsCString mTelemetryProvider; }; #endif // nsUrlClassifierStreamUpdater_h_ diff --git a/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp b/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp index 8ef625b31134..96aeb79c42a5 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp @@ -279,7 +279,9 @@ nsUrlClassifierUtils::GetProvider(const nsACString& aTableName, { MutexAutoLock lock(mProviderDictLock); nsCString* provider = nullptr; - if (mProviderDict.Get(aTableName, &provider)) { + if (StringBeginsWith(aTableName, NS_LITERAL_CSTRING("test"))) { + aProvider = NS_LITERAL_CSTRING(TESTING_TABLE_PROVIDER_NAME); + } else if (mProviderDict.Get(aTableName, &provider)) { aProvider = provider ? *provider : EmptyCString(); } else { aProvider = EmptyCString(); @@ -296,7 +298,8 @@ nsUrlClassifierUtils::GetTelemetryProvider(const nsACString& aTableName, // Empty provider is filtered as "other" if (!NS_LITERAL_CSTRING("mozilla").Equals(aProvider) && !NS_LITERAL_CSTRING("google").Equals(aProvider) && - !NS_LITERAL_CSTRING("google4").Equals(aProvider)) { + !NS_LITERAL_CSTRING("google4").Equals(aProvider) && + !NS_LITERAL_CSTRING(TESTING_TABLE_PROVIDER_NAME).Equals(aProvider)) { aProvider.Assign(NS_LITERAL_CSTRING("other")); } diff --git a/toolkit/components/url-classifier/nsUrlClassifierUtils.h b/toolkit/components/url-classifier/nsUrlClassifierUtils.h index cd14cf2a72a8..9100f522a2a0 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierUtils.h +++ b/toolkit/components/url-classifier/nsUrlClassifierUtils.h @@ -10,6 +10,8 @@ #include "nsClassHashtable.h" #include "nsIObserver.h" +#define TESTING_TABLE_PROVIDER_NAME "test" + class nsUrlClassifierUtils final : public nsIUrlClassifierUtils, public nsIObserver { From fdfcbce1e7c49dd3bbf55f6532241824897f60f9 Mon Sep 17 00:00:00 2001 From: Jared Wein Date: Mon, 30 Jan 2017 10:34:53 -0500 Subject: [PATCH 11/24] Bug 1335043 - Prevent the bookmark panel from closing automatically if the mouse is hovering over it. r=mak MozReview-Commit-ID: 2jor6H2cQck --HG-- extra : rebase_source : 970215308ca95d07c13179dcc5106e4e5eae14db --- browser/base/content/browser-places.js | 4 ++- .../test/general/browser_bookmark_popup.js | 30 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/browser/base/content/browser-places.js b/browser/base/content/browser-places.js index db4b982a5b2f..4fbe8b0a55f4 100644 --- a/browser/base/content/browser-places.js +++ b/browser/base/content/browser-places.js @@ -175,7 +175,9 @@ var StarUI = { } clearTimeout(this._autoCloseTimer); this._autoCloseTimer = setTimeout(() => { - this.panel.hidePopup(); + if (!this.panel.mozMatchesSelector(":hover")) { + this.panel.hidePopup(); + } }, delay); } break; diff --git a/browser/base/content/test/general/browser_bookmark_popup.js b/browser/base/content/test/general/browser_bookmark_popup.js index be7bd4a26dd6..ae9ffdd820a6 100644 --- a/browser/base/content/test/general/browser_bookmark_popup.js +++ b/browser/base/content/test/general/browser_bookmark_popup.js @@ -11,6 +11,7 @@ let bookmarkPanel = document.getElementById("editBookmarkPanel"); let bookmarkStar = document.getElementById("bookmarks-menu-button"); let bookmarkPanelTitle = document.getElementById("editBookmarkPanelTitle"); +let editBookmarkPanelRemoveButtonRect; StarUI._closePanelQuickForTesting = true; @@ -34,6 +35,9 @@ function* test_bookmarks_popup({isNewBookmark, popupShowFn, popupEditFn, yield shownPromise; is(bookmarkPanel.state, "open", "Panel should be 'open' after shownPromise is resolved"); + editBookmarkPanelRemoveButtonRect = + document.getElementById("editBookmarkPanelRemoveButton").getBoundingClientRect(); + if (popupEditFn) { yield popupEditFn(); } @@ -363,6 +367,32 @@ add_task(function* enter_on_remove_bookmark_should_remove_bookmark() { }); }); +add_task(function* mouse_hovering_panel_should_prevent_autoclose() { + if (AppConstants.platform != "win") { + // This test requires synthesizing native mouse movement which is + // best supported on Windows. + return; + } + yield test_bookmarks_popup({ + isNewBookmark: true, + *popupShowFn(browser) { + yield new Promise(resolve => { + EventUtils.synthesizeNativeMouseMove( + document.documentElement, + editBookmarkPanelRemoveButtonRect.left, + editBookmarkPanelRemoveButtonRect.top, + resolve); + }); + EventUtils.synthesizeKey("D", {accelKey: true}, window); + }, + shouldAutoClose: false, + popupHideFn() { + document.getElementById("editBookmarkPanelRemoveButton").click(); + }, + isBookmarkRemoved: true, + }); +}); + registerCleanupFunction(function() { delete StarUI._closePanelQuickForTesting; }) From 402701edb8e2a25167ecac7226ad013f1a52f28e Mon Sep 17 00:00:00 2001 From: Andrew Swan Date: Fri, 27 Jan 2017 14:10:02 -0800 Subject: [PATCH 12/24] Bug 1334354 Provide timeout for post-install notification r=florian MozReview-Commit-ID: H3qHdkvhxjg --HG-- extra : rebase_source : 4c99d51183a393b0e54655c0ad00608d5028a347 --- browser/modules/ExtensionsUI.jsm | 1 + 1 file changed, 1 insertion(+) diff --git a/browser/modules/ExtensionsUI.jsm b/browser/modules/ExtensionsUI.jsm index e2127dd2c254..a62bbea5f5c0 100644 --- a/browser/modules/ExtensionsUI.jsm +++ b/browser/modules/ExtensionsUI.jsm @@ -343,6 +343,7 @@ this.ExtensionsUI = { let options = { hideClose: true, + timeout: Date.now() + 30000, popupIconURL: addon.iconURL || DEFAULT_EXTENSION_ICON, eventCallback(topic) { if (topic == "showing") { From 22848464015de27c2fdf5e981ed64c19a3f9ebde Mon Sep 17 00:00:00 2001 From: Sebastian Kaspari Date: Tue, 31 Jan 2017 14:26:01 +0100 Subject: [PATCH 13/24] Bug 1335355 - Switchboard: Ignore empty matchers in experiments configuration. r=ahunt MozReview-Commit-ID: 10T90TjJlGY --HG-- extra : rebase_source : 42ad84c79ba87f64d237b80e88bfede91bf5b93a --- .../gecko/switchboard/SwitchBoard.java | 47 ++++++++++++++----- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/mobile/android/base/java/org/mozilla/gecko/switchboard/SwitchBoard.java b/mobile/android/base/java/org/mozilla/gecko/switchboard/SwitchBoard.java index 2e917596ccda..05446ffeafa4 100644 --- a/mobile/android/base/java/org/mozilla/gecko/switchboard/SwitchBoard.java +++ b/mobile/android/base/java/org/mozilla/gecko/switchboard/SwitchBoard.java @@ -37,6 +37,7 @@ import android.content.pm.PackageManager.NameNotFoundException; import android.os.Build; import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import android.text.TextUtils; import android.util.Log; @@ -199,16 +200,22 @@ public class SwitchBoard { return experiment; } - private static boolean isMatch(Context c, @Nullable JSONObject matchKeys) { + /** + * Return false if the match object contains any non-matching patterns. Otherwise returns true. + */ + private static boolean isMatch(Context context, @Nullable JSONObject matchKeys) { // If no match keys are specified, default to enabling the experiment. if (matchKeys == null) { return true; } if (matchKeys.has(KEY_APP_ID)) { - final String packageName = c.getPackageName(); try { - if (!packageName.matches(matchKeys.getString(KEY_APP_ID))) { + final String packageName = context.getPackageName(); + final String expectedAppIdPattern = matchKeys.getString(KEY_APP_ID); + + if (!TextUtils.isEmpty(expectedAppIdPattern) + && !packageName.matches(expectedAppIdPattern)) { return false; } } catch (JSONException e) { @@ -219,7 +226,10 @@ public class SwitchBoard { if (matchKeys.has(KEY_COUNTRY)) { try { final String country = Locale.getDefault().getISO3Country(); - if (!country.matches(matchKeys.getString(KEY_COUNTRY))) { + final String expectedCountryPattern = matchKeys.getString(KEY_COUNTRY); + + if (!TextUtils.isEmpty(expectedCountryPattern) + && !country.matches(expectedCountryPattern)) { return false; } } catch (MissingResourceException | JSONException e) { @@ -228,30 +238,40 @@ public class SwitchBoard { } if (matchKeys.has(KEY_DEVICE)) { - final String device = Build.DEVICE; try { - if (!device.matches(matchKeys.getString(KEY_DEVICE))) { + final String device = Build.DEVICE; + final String expectedDevicePattern = matchKeys.getString(KEY_DEVICE); + + if (!TextUtils.isEmpty(expectedDevicePattern) + && !device.matches(expectedDevicePattern)) { return false; } } catch (JSONException e) { Log.e(TAG, "Exception matching device", e); } - } + if (matchKeys.has(KEY_LANG)) { try { final String lang = Locale.getDefault().getISO3Language(); - if (!lang.matches(matchKeys.getString(KEY_LANG))) { + final String expectedLanguagePattern = matchKeys.getString(KEY_LANG); + + if (!TextUtils.isEmpty(expectedLanguagePattern) + && !lang.matches(expectedLanguagePattern)) { return false; } } catch (MissingResourceException | JSONException e) { Log.e(TAG, "Exception matching lang", e); } } + if (matchKeys.has(KEY_MANUFACTURER)) { - final String manufacturer = Build.MANUFACTURER; try { - if (!manufacturer.matches(matchKeys.getString(KEY_MANUFACTURER))) { + final String manufacturer = Build.MANUFACTURER; + final String expectedManufacturerPattern = matchKeys.getString(KEY_MANUFACTURER); + + if (!TextUtils.isEmpty(expectedManufacturerPattern) + && !manufacturer.matches(expectedManufacturerPattern)) { return false; } } catch (JSONException e) { @@ -261,8 +281,11 @@ public class SwitchBoard { if (matchKeys.has(KEY_VERSION)) { try { - final String version = c.getPackageManager().getPackageInfo(c.getPackageName(), 0).versionName; - if (!version.matches(matchKeys.getString(KEY_VERSION))) { + final String version = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName; + final String expectedVersionPattern = matchKeys.getString(KEY_VERSION); + + if (!TextUtils.isEmpty(expectedVersionPattern) + && !version.matches(expectedVersionPattern)) { return false; } } catch (NameNotFoundException | JSONException e) { From 2ad1ae41e9b41e507020866c283e58f557c04b9e Mon Sep 17 00:00:00 2001 From: Drew Willcoxon Date: Mon, 30 Jan 2017 11:33:07 -0800 Subject: [PATCH 14/24] Bug 1323525 - Clicking "Change Search Settings" in searchbar doesn't work. r=florian MozReview-Commit-ID: 8lBdSHGd5zk --HG-- extra : rebase_source : 1f5ef1d1a603ed4acfff3d1f1bb164da1ce1caf0 --- browser/components/search/content/search.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/components/search/content/search.xml b/browser/components/search/content/search.xml index 0059bc785e3f..8750b5bef831 100644 --- a/browser/components/search/content/search.xml +++ b/browser/components/search/content/search.xml @@ -2124,7 +2124,7 @@ Date: Wed, 1 Feb 2017 12:37:53 -0500 Subject: [PATCH 15/24] Bug 1335815 - Get the attributes from the intended parameter instead of accidentally getting it from the parent. r=dustin MozReview-Commit-ID: Iz3Da3EtYVU --HG-- extra : rebase_source : 3a4e5cb8fc91385510f195510c67e45546cd96ca --- taskcluster/taskgraph/target_tasks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/taskcluster/taskgraph/target_tasks.py b/taskcluster/taskgraph/target_tasks.py index 40401c854674..abce8ee184d4 100644 --- a/taskcluster/taskgraph/target_tasks.py +++ b/taskcluster/taskgraph/target_tasks.py @@ -68,7 +68,7 @@ def target_tasks_default(full_task_graph, parameters): """Target the tasks which have indicated they should be run on this project via the `run_on_projects` attributes.""" def filter(task): - run_on_projects = set(t.attributes.get('run_on_projects', [])) + run_on_projects = set(task.attributes.get('run_on_projects', [])) if 'all' in run_on_projects: return True project = parameters['project'] From 74f50780bae1807b0b62a16c8d2fcb6377d38010 Mon Sep 17 00:00:00 2001 From: Maja Frydrychowicz Date: Wed, 1 Feb 2017 13:30:58 -0500 Subject: [PATCH 16/24] Bug 1335240 - actions.InputState does not record correct type for key and pointer; r=ato MozReview-Commit-ID: 9RW0BretWU5 --HG-- extra : rebase_source : 22a542c35f01665cb2a4157df1fd0c6b96a6d980 --- testing/marionette/action.js | 6 +++--- testing/marionette/test_action.js | 21 +++++++++++++++++---- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/testing/marionette/action.js b/testing/marionette/action.js index bf13f2135355..6f57e71a630f 100644 --- a/testing/marionette/action.js +++ b/testing/marionette/action.js @@ -425,7 +425,7 @@ action.InputState = {}; /** * Input state associated with a keyboard-type device. */ -action.InputState.Key = class extends InputState { +action.InputState.Key = class Key extends InputState { constructor() { super(); this.pressed = new Set(); @@ -498,7 +498,7 @@ action.InputState.Key = class extends InputState { /** * Input state not associated with a specific physical device. */ -action.InputState.Null = class extends InputState { +action.InputState.Null = class Null extends InputState { constructor() { super(); this.type = "none"; @@ -513,7 +513,7 @@ action.InputState.Null = class extends InputState { * @param {boolean} primary * Whether the pointing device is primary. */ -action.InputState.Pointer = class extends InputState { +action.InputState.Pointer = class Pointer extends InputState { constructor(subtype, primary) { super(); this.pressed = new Set(); diff --git a/testing/marionette/test_action.js b/testing/marionette/test_action.js index 5407e63b5cc0..17e2ecd68a4b 100644 --- a/testing/marionette/test_action.js +++ b/testing/marionette/test_action.js @@ -15,7 +15,7 @@ action.inputStateMap = new Map(); add_test(function test_createAction() { Assert.throws(() => new action.Action(), InvalidArgumentError, "Missing Action constructor args"); - Assert.throws(() => new action.Action(1,2), InvalidArgumentError, + Assert.throws(() => new action.Action(1, 2), InvalidArgumentError, "Missing Action constructor args"); Assert.throws( () => new action.Action(1, 2, "sometype"), /Expected string/, "Non-string arguments."); @@ -157,7 +157,7 @@ add_test(function test_processPointerAction() { pointerType: "touch", primary: false, }, - } + }; let actionItems = [ { duration: 2000, @@ -364,7 +364,7 @@ add_test(function test_processPointerActionInputStateMap() { let parameters = {pointerType: "mouse", primary: false}; let a = new action.Action(id, "pointer", actionItem.type); let wrongInputState = new action.InputState.Pointer("pause", true); - action.inputStateMap.set(id, wrongInputState) + action.inputStateMap.set(id, wrongInputState); checkErrors( /to be mapped to InputState whose subtype is/, action.processPointerAction, [id, parameters, a], @@ -378,9 +378,22 @@ add_test(function test_processPointerActionInputStateMap() { run_next_test(); }); +add_test(function test_createInputState() { + for (let kind in action.InputState) { + let state = new action.InputState[kind](); + ok(state); + if (kind === "Null") { + equal(state.type, "none"); + } else { + equal(state.type, kind.toLowerCase()); + } + } + run_next_test(); +}); + add_test(function test_extractActionChainValidation() { for (let actions of [-1, "a", undefined, null]) { - let message = `actions: ${getTypeString(actions)}` + let message = `actions: ${getTypeString(actions)}`; Assert.throws(() => action.Chain.fromJson(actions), InvalidArgumentError, message); Assert.throws(() => action.Chain.fromJson(actions), From 4670c79b4ab7496e3a325fdae430fa85d3a59959 Mon Sep 17 00:00:00 2001 From: Aaron Klotz Date: Tue, 31 Jan 2017 13:43:34 -0700 Subject: [PATCH 17/24] Bug 1335527: Fix missing entries for .tlb files generated by midl in a11y code; r=mshal MozReview-Commit-ID: EjvzTvADV1a --HG-- extra : rebase_source : 79d73dc0908531c4bf8325a7b1353d39ac782044 --- accessible/interfaces/gecko/Makefile.in | 9 +++++---- accessible/interfaces/ia2/Makefile.in | 3 ++- accessible/interfaces/msaa/Makefile.in | 21 +++++++++++---------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/accessible/interfaces/gecko/Makefile.in b/accessible/interfaces/gecko/Makefile.in index 5df4eb094b1a..e9800cf5be0a 100644 --- a/accessible/interfaces/gecko/Makefile.in +++ b/accessible/interfaces/gecko/Makefile.in @@ -5,10 +5,11 @@ GARBAGE += $(MIDL_GENERATED_FILES) done_gen dlldata.c MIDL_GENERATED_FILES = \ - IGeckoCustom.h \ - IGeckoCustom_p.c \ - IGeckoCustom_i.c \ - $(NULL) + IGeckoCustom.h \ + IGeckoCustom_p.c \ + IGeckoCustom_i.c \ + IGeckoCustom.tlb \ + $(NULL) $(MIDL_GENERATED_FILES): done_gen diff --git a/accessible/interfaces/ia2/Makefile.in b/accessible/interfaces/ia2/Makefile.in index 623bc8ca51df..90db9133fe6f 100644 --- a/accessible/interfaces/ia2/Makefile.in +++ b/accessible/interfaces/ia2/Makefile.in @@ -53,10 +53,11 @@ CSRCS = \ MIDL_GENERATED_FILES = \ dlldata.c \ + $(MIDL_ENUMS:%.idl=%.h) \ $(MIDL_INTERFACES:%.idl=%_p.c) \ $(MIDL_INTERFACES:%.idl=%_i.c) \ $(MIDL_INTERFACES:%.idl=%.h) \ - $(MIDL_ENUMS:%.idl=%.h) \ + $(MIDL_LIBRARIES:%.idl=%.tlb) \ $(NULL) # We want to generate a .tlb from MIDL_LIBRARIES, but midl also generates diff --git a/accessible/interfaces/msaa/Makefile.in b/accessible/interfaces/msaa/Makefile.in index 998d67bcbac7..9f44a5bb5568 100644 --- a/accessible/interfaces/msaa/Makefile.in +++ b/accessible/interfaces/msaa/Makefile.in @@ -5,16 +5,17 @@ GARBAGE += $(MIDL_GENERATED_FILES) done_gen dlldata.c MIDL_GENERATED_FILES = \ - ISimpleDOMNode.h \ - ISimpleDOMNode_p.c \ - ISimpleDOMNode_i.c \ - ISimpleDOMDocument.h \ - ISimpleDOMDocument_p.c \ - ISimpleDOMDocument_i.c \ - ISimpleDOMText.h \ - ISimpleDOMText_p.c \ - ISimpleDOMText_i.c \ - $(NULL) + ISimpleDOMNode.h \ + ISimpleDOMNode_p.c \ + ISimpleDOMNode_i.c \ + ISimpleDOMNode.tlb \ + ISimpleDOMDocument.h \ + ISimpleDOMDocument_p.c \ + ISimpleDOMDocument_i.c \ + ISimpleDOMText.h \ + ISimpleDOMText_p.c \ + ISimpleDOMText_i.c \ + $(NULL) $(MIDL_GENERATED_FILES): done_gen From ddd74641a73d593ba6c818adb36f611b4a657831 Mon Sep 17 00:00:00 2001 From: Thom Chiovoloni Date: Wed, 11 Jan 2017 11:27:58 -0500 Subject: [PATCH 18/24] Bug 1328737 - Fix bug where sync wouldn't sync some bookmark keywords on insertion. r=kitcambridge MozReview-Commit-ID: FXW3sJ6TU46 --HG-- extra : rebase_source : 93063d3b2e6b32f9ba04b156dfa051378ef7d743 --- toolkit/components/places/PlacesSyncUtils.jsm | 48 ++++++++-- .../places/tests/unit/test_sync_utils.js | 92 +++++++++++++++++++ 2 files changed, 131 insertions(+), 9 deletions(-) diff --git a/toolkit/components/places/PlacesSyncUtils.jsm b/toolkit/components/places/PlacesSyncUtils.jsm index 11e3e28fe4fd..5bda4a8ee5b3 100644 --- a/toolkit/components/places/PlacesSyncUtils.jsm +++ b/toolkit/components/places/PlacesSyncUtils.jsm @@ -901,6 +901,43 @@ var insertSyncLivemark = Task.async(function* (insertInfo) { return insertBookmarkMetadata(livemarkItem, insertInfo); }); +// Keywords are a 1 to 1 mapping between strings and pairs of (URL, postData). +// (the postData is not synced, so we ignore it). Sync associates keywords with +// bookmarks, which is not really accurate. -- We might already have a keyword +// with that name, or we might already have another bookmark with that URL with +// a different keyword, etc. +// +// If we don't handle those cases by removing the conflicting keywords first, +// the insertion will fail, and the keywords will either be wrong, or missing. +// This function handles those cases. +var removeConflictingKeywords = Task.async(function* (bookmarkURL, newKeyword) { + let entryForURL = yield PlacesUtils.keywords.fetch({ + url: bookmarkURL + }); + if (entryForURL && entryForURL.keyword !== newKeyword) { + yield PlacesUtils.keywords.remove({ + keyword: entryForURL.keyword, + source: SOURCE_SYNC, + }); + // This will cause us to reupload this record for this sync, but without it, + // we will risk data corruption. + yield BookmarkSyncUtils.addSyncChangesForBookmarksWithURL(entryForURL.url.href); + } + if (!newKeyword) { + return; + } + let entryForNewKeyword = yield PlacesUtils.keywords.fetch({ + keyword: newKeyword + }); + if (entryForNewKeyword) { + yield PlacesUtils.keywords.remove({ + keyword: entryForNewKeyword.keyword, + source: SOURCE_SYNC, + }); + yield BookmarkSyncUtils.addSyncChangesForBookmarksWithURL(entryForNewKeyword.url.href); + } +}); + // Sets annotations, keywords, and tags on a new bookmark. Returns a Sync // bookmark object. var insertBookmarkMetadata = Task.async(function* (bookmarkItem, insertInfo) { @@ -923,6 +960,7 @@ var insertBookmarkMetadata = Task.async(function* (bookmarkItem, insertInfo) { } if (insertInfo.keyword) { + yield removeConflictingKeywords(bookmarkItem.url.href, insertInfo.keyword); yield PlacesUtils.keywords.insert({ keyword: insertInfo.keyword, url: bookmarkItem.url.href, @@ -1136,15 +1174,7 @@ var updateBookmarkMetadata = Task.async(function* (oldBookmarkItem, if (updateInfo.hasOwnProperty("keyword")) { // Unconditionally remove the old keyword. - let entry = yield PlacesUtils.keywords.fetch({ - url: oldBookmarkItem.url.href, - }); - if (entry) { - yield PlacesUtils.keywords.remove({ - keyword: entry.keyword, - source: SOURCE_SYNC, - }); - } + yield removeConflictingKeywords(oldBookmarkItem.url.href, updateInfo.keyword); if (updateInfo.keyword) { yield PlacesUtils.keywords.insert({ keyword: updateInfo.keyword, diff --git a/toolkit/components/places/tests/unit/test_sync_utils.js b/toolkit/components/places/tests/unit/test_sync_utils.js index 23b8b109c7d6..38e9bc2ac55d 100644 --- a/toolkit/components/places/tests/unit/test_sync_utils.js +++ b/toolkit/components/places/tests/unit/test_sync_utils.js @@ -619,6 +619,98 @@ add_task(function* test_update_keyword() { "Removing keyword for URL without existing keyword should succeed"); } + let item2; + do_print("Insert removes other item's keyword if they are the same"); + { + let updatedItem = yield PlacesSyncUtils.bookmarks.update({ + syncId: item.syncId, + keyword: "test", + }); + equal(updatedItem.keyword, "test", "Initial update succeeds"); + item2 = yield PlacesSyncUtils.bookmarks.insert({ + kind: "bookmark", + parentSyncId: "menu", + url: "https://mozilla.org/1", + syncId: makeGuid(), + keyword: "test", + }); + equal(item2.keyword, "test", "insert with existing should succeed"); + updatedItem = yield PlacesSyncUtils.bookmarks.fetch(item.syncId); + ok(!updatedItem.keyword, "initial item no longer has keyword"); + let entry = yield PlacesUtils.keywords.fetch({ + url: "https://mozilla.org", + }); + ok(!entry, "Direct check for original url keyword gives nothing"); + let newEntry = yield PlacesUtils.keywords.fetch("test"); + ok(newEntry, "Keyword should exist for new item"); + equal(newEntry.url.href, "https://mozilla.org/1", "Keyword should point to new url"); + } + + do_print("Insert updates other item's keyword if they are the same url"); + { + let updatedItem = yield PlacesSyncUtils.bookmarks.update({ + syncId: item.syncId, + keyword: "test2", + }); + equal(updatedItem.keyword, "test2", "Initial update succeeds"); + let newItem = yield PlacesSyncUtils.bookmarks.insert({ + kind: "bookmark", + parentSyncId: "menu", + url: "https://mozilla.org", + syncId: makeGuid(), + keyword: "test3", + }); + equal(newItem.keyword, "test3", "insert with existing should succeed"); + updatedItem = yield PlacesSyncUtils.bookmarks.fetch(item.syncId); + equal(updatedItem.keyword, "test3", "initial item has new keyword"); + } + + do_print("Update removes other item's keyword if they are the same"); + { + let updatedItem = yield PlacesSyncUtils.bookmarks.update({ + syncId: item.syncId, + keyword: "test4", + }); + equal(updatedItem.keyword, "test4", "Initial update succeeds"); + let updatedItem2 = yield PlacesSyncUtils.bookmarks.update({ + syncId: item2.syncId, + keyword: "test4", + }); + equal(updatedItem2.keyword, "test4", "New update succeeds"); + updatedItem = yield PlacesSyncUtils.bookmarks.fetch(item.syncId); + ok(!updatedItem.keyword, "initial item no longer has keyword"); + let entry = yield PlacesUtils.keywords.fetch({ + url: "https://mozilla.org", + }); + ok(!entry, "Direct check for original url keyword gives nothing"); + let newEntry = yield PlacesUtils.keywords.fetch("test4"); + ok(newEntry, "Keyword should exist for new item"); + equal(newEntry.url.href, "https://mozilla.org/1", "Keyword should point to new url"); + } + + do_print("Update url updates it's keyword if url already has keyword"); + { + let updatedItem = yield PlacesSyncUtils.bookmarks.update({ + syncId: item.syncId, + keyword: "test4", + }); + equal(updatedItem.keyword, "test4", "Initial update succeeds"); + let updatedItem2 = yield PlacesSyncUtils.bookmarks.update({ + syncId: item2.syncId, + keyword: "test5", + }); + equal(updatedItem2.keyword, "test5", "New update succeeds"); + yield PlacesSyncUtils.bookmarks.update({ + syncId: item2.syncId, + url: item.url.href, + }); + updatedItem2 = yield PlacesSyncUtils.bookmarks.fetch(item2.syncId); + equal(updatedItem2.keyword, "test4", "Item keyword has been updated"); + updatedItem = yield PlacesSyncUtils.bookmarks.fetch(item.syncId); + equal(updatedItem.keyword, "test4", "Initial item still has keyword"); + } + + yield PlacesUtils.bookmarks.eraseEverything(); yield PlacesSyncUtils.bookmarks.reset(); }); From cee103a24a05e89018b4805af9bb318b9723111b Mon Sep 17 00:00:00 2001 From: Wes Kocher Date: Wed, 1 Feb 2017 11:11:14 -0800 Subject: [PATCH 19/24] Backed out changeset 1601ad2ba1a9 (bug 1335527) for build bustage a=backout MozReview-Commit-ID: D2jnfMu2rj --- accessible/interfaces/gecko/Makefile.in | 9 ++++----- accessible/interfaces/ia2/Makefile.in | 3 +-- accessible/interfaces/msaa/Makefile.in | 21 ++++++++++----------- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/accessible/interfaces/gecko/Makefile.in b/accessible/interfaces/gecko/Makefile.in index e9800cf5be0a..5df4eb094b1a 100644 --- a/accessible/interfaces/gecko/Makefile.in +++ b/accessible/interfaces/gecko/Makefile.in @@ -5,11 +5,10 @@ GARBAGE += $(MIDL_GENERATED_FILES) done_gen dlldata.c MIDL_GENERATED_FILES = \ - IGeckoCustom.h \ - IGeckoCustom_p.c \ - IGeckoCustom_i.c \ - IGeckoCustom.tlb \ - $(NULL) + IGeckoCustom.h \ + IGeckoCustom_p.c \ + IGeckoCustom_i.c \ + $(NULL) $(MIDL_GENERATED_FILES): done_gen diff --git a/accessible/interfaces/ia2/Makefile.in b/accessible/interfaces/ia2/Makefile.in index 90db9133fe6f..623bc8ca51df 100644 --- a/accessible/interfaces/ia2/Makefile.in +++ b/accessible/interfaces/ia2/Makefile.in @@ -53,11 +53,10 @@ CSRCS = \ MIDL_GENERATED_FILES = \ dlldata.c \ - $(MIDL_ENUMS:%.idl=%.h) \ $(MIDL_INTERFACES:%.idl=%_p.c) \ $(MIDL_INTERFACES:%.idl=%_i.c) \ $(MIDL_INTERFACES:%.idl=%.h) \ - $(MIDL_LIBRARIES:%.idl=%.tlb) \ + $(MIDL_ENUMS:%.idl=%.h) \ $(NULL) # We want to generate a .tlb from MIDL_LIBRARIES, but midl also generates diff --git a/accessible/interfaces/msaa/Makefile.in b/accessible/interfaces/msaa/Makefile.in index 9f44a5bb5568..998d67bcbac7 100644 --- a/accessible/interfaces/msaa/Makefile.in +++ b/accessible/interfaces/msaa/Makefile.in @@ -5,17 +5,16 @@ GARBAGE += $(MIDL_GENERATED_FILES) done_gen dlldata.c MIDL_GENERATED_FILES = \ - ISimpleDOMNode.h \ - ISimpleDOMNode_p.c \ - ISimpleDOMNode_i.c \ - ISimpleDOMNode.tlb \ - ISimpleDOMDocument.h \ - ISimpleDOMDocument_p.c \ - ISimpleDOMDocument_i.c \ - ISimpleDOMText.h \ - ISimpleDOMText_p.c \ - ISimpleDOMText_i.c \ - $(NULL) + ISimpleDOMNode.h \ + ISimpleDOMNode_p.c \ + ISimpleDOMNode_i.c \ + ISimpleDOMDocument.h \ + ISimpleDOMDocument_p.c \ + ISimpleDOMDocument_i.c \ + ISimpleDOMText.h \ + ISimpleDOMText_p.c \ + ISimpleDOMText_i.c \ + $(NULL) $(MIDL_GENERATED_FILES): done_gen From b862b75cf0644c9653fa8b4d9484e98fa3611673 Mon Sep 17 00:00:00 2001 From: Bryce Van Dyk Date: Fri, 27 Jan 2017 11:25:37 +1300 Subject: [PATCH 20/24] Bug 1334920 - Add youtube and twitch external media tests to TC config. r=grenade Rename the base external media tests from "external-media-tests" to "external-media-tests-base", to disambiguate them from the other tests in the suite, as well as the set of all external media tests. Adjust tests that are run per platform so that all external media tests are run on linux and windows. Adjust the platform tests so that they select the external-media-tests set, rather than adding individual external media tests to each platform set. MozReview-Commit-ID: DRiQQA1BB9n --HG-- extra : rebase_source : 88b46930bc1fe09062ebcb445e75d1131a2f0116 --- taskcluster/ci/test/test-platforms.yml | 6 ++++ taskcluster/ci/test/test-sets.yml | 6 ++-- taskcluster/ci/test/tests.yml | 50 +++++++++++++++++++++++++- 3 files changed, 58 insertions(+), 4 deletions(-) diff --git a/taskcluster/ci/test/test-platforms.yml b/taskcluster/ci/test/test-platforms.yml index 29ca08de4c9e..b810dbbc0284 100644 --- a/taskcluster/ci/test/test-platforms.yml +++ b/taskcluster/ci/test/test-platforms.yml @@ -19,11 +19,13 @@ linux32/debug: build-platform: linux/debug test-sets: - linux32-tests + - external-media-tests linux32/opt: build-platform: linux/opt test-sets: - linux32-tests - linux32-opt-tests + - external-media-tests linux64/debug: build-platform: linux64/debug @@ -84,10 +86,12 @@ windows7-32-vm/debug: build-platform: win32/debug test-sets: - windows-vm-tests + - external-media-tests windows7-32-vm/opt: build-platform: win32/opt test-sets: - windows-vm-tests + - external-media-tests # win32 gpu #windows7-32/debug: @@ -104,10 +108,12 @@ windows10-64-vm/debug: build-platform: win64/debug test-sets: - windows-vm-tests + - external-media-tests windows10-64-vm/opt: build-platform: win64/opt test-sets: - windows-vm-tests + - external-media-tests # win64 gpu #windows10-64/debug: diff --git a/taskcluster/ci/test/test-sets.yml b/taskcluster/ci/test/test-sets.yml index 142e4e39bc2b..99e929156db7 100644 --- a/taskcluster/ci/test/test-sets.yml +++ b/taskcluster/ci/test/test-sets.yml @@ -44,7 +44,9 @@ web-platform-tests: - web-platform-tests-wdspec external-media-tests: - - external-media-tests + - external-media-tests-base + - external-media-tests-youtube + - external-media-tests-twitch opt-only-tests: - mochitest-valgrind @@ -88,7 +90,6 @@ jsdcov-code-coverage-tests: windows-vm-tests: - cppunit #- crashtest - - external-media-tests #- gtest #- jittest - jsreftest @@ -147,7 +148,6 @@ macosx64-tests-talos: linux32-tests: - cppunit - crashtest - - external-media-tests - firefox-ui-functional-local - firefox-ui-functional-remote - gtest diff --git a/taskcluster/ci/test/tests.yml b/taskcluster/ci/test/tests.yml index cd4fed9ff7a4..944268cc317c 100644 --- a/taskcluster/ci/test/tests.yml +++ b/taskcluster/ci/test/tests.yml @@ -89,7 +89,7 @@ crashtest: extra-options: - --reftest-suite=crashtest -external-media-tests: +external-media-tests-base: description: "External Media Test run" suite: external-media-tests treeherder-symbol: tc-VP(b-m) @@ -111,6 +111,54 @@ external-media-tests: - mediatests/taskcluster_posix_config.py - remove_executables.py +external-media-tests-twitch: + description: "External Media Test Twitch run" + suite: external-media-tests/twitch + treeherder-symbol: tc-VP(b-t) + e10s: false + tier: 2 + max-run-time: 5400 + docker-image: {"in-tree": "desktop1604-test"} + run-on-projects: + by-test-platform: + windows.*: ['mozilla-central', 'try'] + default: ['all'] + mozharness: + script: firefox_media_tests_taskcluster.py + config: + by-test-platform: + windows.*: + - mediatests/taskcluster_windows_config.py + default: + - mediatests/taskcluster_posix_config.py + - remove_executables.py + extra-options: + - "--suite=media-twitch-tests" + +external-media-tests-youtube: + description: "External Media Test Youtube run" + suite: external-media-tests/youtube + treeherder-symbol: tc-VP(b-y) + e10s: false + tier: 2 + max-run-time: 5400 + docker-image: {"in-tree": "desktop1604-test"} + run-on-projects: + by-test-platform: + windows.*: ['mozilla-central', 'try'] + default: ['all'] + mozharness: + script: firefox_media_tests_taskcluster.py + config: + by-test-platform: + windows.*: + - mediatests/taskcluster_windows_config.py + default: + - mediatests/taskcluster_posix_config.py + - remove_executables.py + extra-options: + - "--suite=media-youtube-tests" + firefox-ui-functional-local: description: "Firefox-ui-tests functional run" suite: "firefox-ui/functional local" From 8aac28322580f00d18ee784cb85094669b2fc86c Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Tue, 31 Jan 2017 12:55:32 -0600 Subject: [PATCH 21/24] Bug 1335489 - Fixes Debugger.Script lineCount getter behavior. r=luke MozReview-Commit-ID: FO0ko60XNPF --HG-- extra : rebase_source : 3fee2fbdc7701d73bbbca149e4becad3a789f62a --- js/src/jit-test/tests/debug/wasm-05.js | 4 +++ js/src/jit-test/tests/debug/wasm-09.js | 35 ++++++++++++++++++++++++++ js/src/vm/Debugger.cpp | 2 +- js/src/wasm/WasmCode.cpp | 8 +++--- 4 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 js/src/jit-test/tests/debug/wasm-09.js diff --git a/js/src/jit-test/tests/debug/wasm-05.js b/js/src/jit-test/tests/debug/wasm-05.js index d82730dfb9f0..f45aad5835c5 100644 --- a/js/src/jit-test/tests/debug/wasm-05.js +++ b/js/src/jit-test/tests/debug/wasm-05.js @@ -57,6 +57,8 @@ for (let descriptor of WebAssembly.Module.imports(module)) { var instance = new WebAssembly.Instance(module, imports); `); var wasmScript = dbg.findScripts().filter(s => s.format == 'wasm')[0]; + assertEq(wasmScript.startLine, 1); + assertEq(wasmScript.lineCount > 0, true); var lines = wasmScript.source.text.split('\n'); var offsetsFound = 0; lines.forEach(function (l, n) { @@ -102,6 +104,8 @@ function getWasmScriptAfterDebuggerAttached(wast) { var wasmScript1 = getWasmScriptAfterDebuggerAttached('(module (func (nop)))'); var wasmLines1 = wasmScript1.source.text.split('\n'); +assertEq(wasmScript1.startLine, 1); +assertEq(wasmScript1.lineCount, 0); assertEq(wasmLines1.every((l, n) => wasmScript1.getLineOffsets(n + 1).length == 0), true); // Checking that we must not resolve any location for any offset in a wasm diff --git a/js/src/jit-test/tests/debug/wasm-09.js b/js/src/jit-test/tests/debug/wasm-09.js new file mode 100644 index 000000000000..f7042571f8b6 --- /dev/null +++ b/js/src/jit-test/tests/debug/wasm-09.js @@ -0,0 +1,35 @@ +// |jit-test| test-also-wasm-baseline +// Tests debugEnabled state of wasm when allowUnobservedAsmJS == true. + +load(libdir + "asserts.js"); + +if (!wasmIsSupported()) + quit(); + +// Checking that there are no offsets are present in a wasm instance script for +// which debug mode was not enabled. +function getWasmScriptWithoutAllowUnobservedAsmJS(wast) { + var sandbox = newGlobal(''); + var dbg = new Debugger(); + dbg.allowUnobservedAsmJS = true; + dbg.addDebuggee(sandbox); + sandbox.eval(` + var wasm = wasmTextToBinary('${wast}'); + var m = new WebAssembly.Instance(new WebAssembly.Module(wasm)); + `); + // Attaching after wasm instance is created. + var wasmScript = dbg.findScripts().filter(s => s.format == 'wasm')[0]; + return wasmScript; +} + +var wasmScript1 = getWasmScriptWithoutAllowUnobservedAsmJS('(module (func (nop)))'); +var wasmLines1 = wasmScript1.source.text.split('\n'); +assertEq(wasmScript1.startLine, 1); +assertEq(wasmScript1.lineCount, 0); +assertEq(wasmLines1.every((l, n) => wasmScript1.getLineOffsets(n + 1).length == 0), true); + +// Checking that we must not resolve any location for any offset in a wasm +// instance which debug mode was not enabled. +var wasmScript2 = getWasmScriptWithoutAllowUnobservedAsmJS('(module (func (nop)))'); +for (var i = wasmTextToBinary('(module (func (nop)))').length - 1; i >= 0; i--) + assertThrowsInstanceOf(() => wasmScript2.getOffsetLocation(i), Error); diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index 63b675cb1178..dfae04d59dcc 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -5677,7 +5677,7 @@ struct DebuggerScriptGetLineCountMatcher } ReturnType match(Handle wasmInstance) { uint32_t result; - if (wasmInstance->instance().code().totalSourceLines(cx_, &result)) + if (!wasmInstance->instance().code().totalSourceLines(cx_, &result)) return false; totalLines = double(result); return true; diff --git a/js/src/wasm/WasmCode.cpp b/js/src/wasm/WasmCode.cpp index 035788304100..249e6b331caf 100644 --- a/js/src/wasm/WasmCode.cpp +++ b/js/src/wasm/WasmCode.cpp @@ -864,12 +864,14 @@ Code::getOffsetLocation(JSContext* cx, uint32_t offset, bool* found, size_t* lin bool Code::totalSourceLines(JSContext* cx, uint32_t* count) { + *count = 0; + if (!metadata_->debugEnabled) + return true; + if (!ensureSourceMap(cx)) return false; - if (!maybeSourceMap_) - *count = 0; - else + if (maybeSourceMap_) *count = maybeSourceMap_->totalLines() + experimentalWarningLinesCount; return true; } From 1abba2da721a5811a4dc1b36a8071236d7439cac Mon Sep 17 00:00:00 2001 From: Andrew Halberstadt Date: Tue, 31 Jan 2017 11:53:36 -0500 Subject: [PATCH 22/24] Bug 1334209 - Activate mozharness virtualenv in-process from one click loaner mach commands, r=jmaher Previously the run-wizard script would add a command to source the virtualenv in ~/.bashrc after mozharness finished setting things up. This is fragile, assumes people are using bash, etc. Plus it appeared to intermittently fail for some users. Instead, this activates the virtualenv directly from individual mach commands that need it. This guarantees we will always be using the virtualenv if required (and won't be using it if not). The 'activate_this.py' script is invoked the same way that we do it for in-tree mach commands: https://dxr.mozilla.org/mozilla-central/rev/9c06e744b1befb3a2e2fdac7414ce18220774a1d/python/mozbuild/mozbuild/virtualenv.py#456 MozReview-Commit-ID: CfcoiVJXQTl --HG-- extra : rebase_source : da01d1ce1bd9b41c89922e989f857c4de8c09341 --- .../reftest/mach_test_package_commands.py | 1 + taskcluster/scripts/tester/run-wizard | 7 ---- .../marionette/mach_test_package_commands.py | 1 + .../mochitest/mach_test_package_commands.py | 1 + testing/tools/mach_test_package_bootstrap.py | 32 +++++++++++++++++++ .../xpcshell/mach_test_package_commands.py | 1 + 6 files changed, 36 insertions(+), 7 deletions(-) diff --git a/layout/tools/reftest/mach_test_package_commands.py b/layout/tools/reftest/mach_test_package_commands.py index e3bf64cb86d0..72111b9cda11 100644 --- a/layout/tools/reftest/mach_test_package_commands.py +++ b/layout/tools/reftest/mach_test_package_commands.py @@ -88,5 +88,6 @@ class ReftestCommands(object): description='Run the reftest harness.', parser=setup_argument_parser) def reftest(self, **kwargs): + self.context.activate_mozharness_venv() kwargs['suite'] = 'reftest' return run_reftest(self.context, **kwargs) diff --git a/taskcluster/scripts/tester/run-wizard b/taskcluster/scripts/tester/run-wizard index 0b097b4ffae6..3eab6711c958 100755 --- a/taskcluster/scripts/tester/run-wizard +++ b/taskcluster/scripts/tester/run-wizard @@ -58,13 +58,6 @@ def setup(): os.remove(mach_dest) os.symlink(mach_src, mach_dest) - activate = os.path.join(build_dir, 'venv', 'bin', 'activate') - if os.path.isfile(activate): - # TODO Support other shells - bashrc = os.path.expanduser(os.path.join('~', '.bashrc')) - with open(bashrc, 'ab') as f: - f.write(". {}".format(activate)) - print(""" Mozharness has finished downloading the build and tests to: {} diff --git a/testing/marionette/mach_test_package_commands.py b/testing/marionette/mach_test_package_commands.py index 66d99d2a4454..35760ad93180 100644 --- a/testing/marionette/mach_test_package_commands.py +++ b/testing/marionette/mach_test_package_commands.py @@ -64,4 +64,5 @@ class MachCommands(object): 'using marionette).', parser=setup_marionette_argument_parser) def run_marionette_test(self, **kwargs): + self.context.activate_mozharness_venv() return run_marionette(self.context, **kwargs) diff --git a/testing/mochitest/mach_test_package_commands.py b/testing/mochitest/mach_test_package_commands.py index ec3404aedef3..6e5f2749ac39 100644 --- a/testing/mochitest/mach_test_package_commands.py +++ b/testing/mochitest/mach_test_package_commands.py @@ -93,4 +93,5 @@ class MochitestCommands(object): description='Run the mochitest harness.', parser=setup_argument_parser) def mochitest(self, **kwargs): + self.context.activate_mozharness_venv() return run_mochitest(self.context, **kwargs) diff --git a/testing/tools/mach_test_package_bootstrap.py b/testing/tools/mach_test_package_bootstrap.py index 2bbfea95f159..f078030323cc 100644 --- a/testing/tools/mach_test_package_bootstrap.py +++ b/testing/tools/mach_test_package_bootstrap.py @@ -76,6 +76,9 @@ CATEGORIES = { } +IS_WIN = sys.platform in ('win32', 'cygwin') + + def ancestors(path, depth=0): """Emit the parent directories of a path.""" count = 1 @@ -88,6 +91,32 @@ def ancestors(path, depth=0): count += 1 +def activate_mozharness_venv(context): + """Activate the mozharness virtualenv in-process.""" + venv = os.path.join(context.mozharness_workdir, + context.mozharness_config.get('virtualenv_path', 'venv')) + + if not os.path.isdir(venv): + print("No mozharness virtualenv detected at '{}'.".format(venv)) + return 1 + + venv_bin = os.path.join(venv, 'Scripts' if IS_WIN else 'bin') + activate_path = os.path.join(venv_bin, 'activate_this.py') + + execfile(activate_path, dict(__file__=activate_path)) + + if isinstance(os.environ['PATH'], unicode): + os.environ['PATH'] = os.environ['PATH'].encode('utf-8') + + # sys.executable is used by mochitest-media to start the websocketprocessbridge, + # for some reason it doesn't get set when calling `activate_this.py` so set it + # here instead. + binary = 'python' + if IS_WIN: + binary += '.exe' + sys.executable = os.path.join(venv_bin, binary) + + def find_firefox(context): """Try to automagically find the firefox binary.""" import mozinstall @@ -176,6 +205,9 @@ def bootstrap(test_package_root): if config: return os.path.join(config['base_work_dir'], config['work_dir']) + if key == 'activate_mozharness_venv': + return types.MethodType(activate_mozharness_venv, context) + mach = mach.main.Mach(os.getcwd()) mach.populate_context_handler = populate_context diff --git a/testing/xpcshell/mach_test_package_commands.py b/testing/xpcshell/mach_test_package_commands.py index fc7d27385937..dd4c576a10f4 100644 --- a/testing/xpcshell/mach_test_package_commands.py +++ b/testing/xpcshell/mach_test_package_commands.py @@ -61,4 +61,5 @@ class MochitestCommands(object): description='Run the xpcshell harness.', parser=parser_desktop) def xpcshell(self, **kwargs): + self.context.activate_mozharness_venv() return run_xpcshell(self.context, **kwargs) From 74a3b5d2c6367e6ca07960c99d8580d31e0c4991 Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Tue, 31 Jan 2017 13:17:03 +0000 Subject: [PATCH 23/24] Bug 1335813 - Enable eslint no-undef for toolkit, apart from components/ and content/, and fix various issues. r=jaws MozReview-Commit-ID: LpXm7TbwvDb --HG-- rename : toolkit/modules/tests/MockDocument.jsm => toolkit/modules/tests/modules/MockDocument.jsm rename : toolkit/modules/tests/PromiseTestUtils.jsm => toolkit/modules/tests/modules/PromiseTestUtils.jsm extra : rebase_source : 0013201da831f0d549aea2c9064481c1e1a3ffcc --- browser/.eslintrc.js | 3 ++- testing/mochitest/browser.eslintrc.js | 1 + testing/xpcshell/xpcshell.eslintrc.js | 1 + toolkit/.eslintrc.js | 2 +- toolkit/components/.eslintrc.js | 1 + toolkit/content/.eslintrc.js | 7 +++++++ .../test/unit/crasher_subprocess_tail.js | 2 ++ .../test/unit/test_crashreporter_appmem.js | 16 ++++++++-------- toolkit/modules/GMPInstallManager.jsm | 1 + toolkit/modules/ObjectUtils.jsm | 2 ++ toolkit/modules/Promise-backend.js | 5 +++++ toolkit/modules/ZipUtils.jsm | 4 ++-- toolkit/modules/moz.build | 4 ++-- .../tests/browser/browser_InlineSpellChecker.js | 4 +++- .../tests/browser/testremotepagemanager.html | 2 ++ toolkit/modules/tests/modules/.eslintrc.js | 7 +++++++ .../modules/tests/{ => modules}/MockDocument.jsm | 0 .../tests/{ => modules}/PromiseTestUtils.jsm | 3 +++ .../modules/tests/xpcshell/test_ObjectUtils.js | 9 +++++++++ toolkit/modules/tests/xpcshell/test_sqlite.js | 1 - toolkit/mozapps/installer/js-compare-ast.js | 3 +++ 21 files changed, 62 insertions(+), 16 deletions(-) create mode 100644 toolkit/content/.eslintrc.js create mode 100644 toolkit/modules/tests/modules/.eslintrc.js rename toolkit/modules/tests/{ => modules}/MockDocument.jsm (100%) rename toolkit/modules/tests/{ => modules}/PromiseTestUtils.jsm (99%) diff --git a/browser/.eslintrc.js b/browser/.eslintrc.js index 7bd47cc089cb..f794a69567c5 100644 --- a/browser/.eslintrc.js +++ b/browser/.eslintrc.js @@ -6,6 +6,7 @@ module.exports = { ], "rules": { - "no-shadow": "error" + "no-shadow": "error", + "no-undef": "off" } }; diff --git a/testing/mochitest/browser.eslintrc.js b/testing/mochitest/browser.eslintrc.js index a7e41e69fee9..1c3287b9f21e 100644 --- a/testing/mochitest/browser.eslintrc.js +++ b/testing/mochitest/browser.eslintrc.js @@ -38,6 +38,7 @@ module.exports = { "is": false, "isnot": false, "ok": false, + "PromiseDebugging": false, "privateNoteIntentionalCrash": false, "registerCleanupFunction": false, "requestLongerTimeout": false, diff --git a/testing/xpcshell/xpcshell.eslintrc.js b/testing/xpcshell/xpcshell.eslintrc.js index f71b6374c4c8..b10c2f6d0b07 100644 --- a/testing/xpcshell/xpcshell.eslintrc.js +++ b/testing/xpcshell/xpcshell.eslintrc.js @@ -52,6 +52,7 @@ module.exports = { "notEqual": false, "notStrictEqual": false, "ok": false, + "PromiseDebugging": false, "runningInParent": false, "run_next_test": false, "run_test": false, diff --git a/toolkit/.eslintrc.js b/toolkit/.eslintrc.js index a0e959e73945..413ff196a2c9 100644 --- a/toolkit/.eslintrc.js +++ b/toolkit/.eslintrc.js @@ -169,7 +169,7 @@ module.exports = { "no-trailing-spaces": "error", // No using undeclared variables - // "no-undef": "error", + "no-undef": "error", // Error on newline where a semicolon is needed "no-unexpected-multiline": "error", diff --git a/toolkit/components/.eslintrc.js b/toolkit/components/.eslintrc.js index a7c105aad2cf..4840bb35c2b6 100644 --- a/toolkit/components/.eslintrc.js +++ b/toolkit/components/.eslintrc.js @@ -2,5 +2,6 @@ module.exports = { "rules": { + "no-undef": "off" } }; diff --git a/toolkit/content/.eslintrc.js b/toolkit/content/.eslintrc.js new file mode 100644 index 000000000000..4840bb35c2b6 --- /dev/null +++ b/toolkit/content/.eslintrc.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = { + "rules": { + "no-undef": "off" + } +}; diff --git a/toolkit/crashreporter/test/unit/crasher_subprocess_tail.js b/toolkit/crashreporter/test/unit/crasher_subprocess_tail.js index 8b4dd2b79162..1de21ba8db5e 100644 --- a/toolkit/crashreporter/test/unit/crasher_subprocess_tail.js +++ b/toolkit/crashreporter/test/unit/crasher_subprocess_tail.js @@ -1,3 +1,5 @@ +/* import-globals-from crasher_subprocess_head.js */ + // Let the event loop process a bit before crashing. if (shouldDelay) { let shouldCrashNow = false; diff --git a/toolkit/crashreporter/test/unit/test_crashreporter_appmem.js b/toolkit/crashreporter/test/unit/test_crashreporter_appmem.js index 439d115c7bd9..b30db283a1e0 100644 --- a/toolkit/crashreporter/test/unit/test_crashreporter_appmem.js +++ b/toolkit/crashreporter/test/unit/test_crashreporter_appmem.js @@ -1,11 +1,11 @@ function run_test() { do_crash(function() { - appAddr = CrashTestUtils.saveAppMemory(); - crashReporter.registerAppMemory(appAddr, 32); - }, - function(mdump, extra) { - do_check_true(mdump.exists()); - do_check_true(mdump.fileSize > 0); - do_check_true(CrashTestUtils.dumpCheckMemory(mdump.path)); - }); + let appAddr = CrashTestUtils.saveAppMemory(); + crashReporter.registerAppMemory(appAddr, 32); + }, + function(mdump, extra) { + do_check_true(mdump.exists()); + do_check_true(mdump.fileSize > 0); + do_check_true(CrashTestUtils.dumpCheckMemory(mdump.path)); + }); } diff --git a/toolkit/modules/GMPInstallManager.jsm b/toolkit/modules/GMPInstallManager.jsm index 88c5eaa93839..3a41f33bd584 100644 --- a/toolkit/modules/GMPInstallManager.jsm +++ b/toolkit/modules/GMPInstallManager.jsm @@ -138,6 +138,7 @@ GMPInstallManager.prototype = { */ installAddon(gmpAddon) { if (this._deferred) { + let log = getScopedLogger("GMPInstallManager.installAddon"); log.error("previous error encountered"); return Promise.reject({type: "previouserrorencountered"}); } diff --git a/toolkit/modules/ObjectUtils.jsm b/toolkit/modules/ObjectUtils.jsm index 738d31a9157c..e3927c6bcc6f 100644 --- a/toolkit/modules/ObjectUtils.jsm +++ b/toolkit/modules/ObjectUtils.jsm @@ -20,6 +20,8 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm", this); XPCOMUtils.defineLazyModuleGetter(this, "Promise", "resource://gre/modules/Promise.jsm"); +var pSlice = Array.prototype.slice; + this.ObjectUtils = { /** * This tests objects & values for deep equality. diff --git a/toolkit/modules/Promise-backend.js b/toolkit/modules/Promise-backend.js index 4754f906de44..2ed31ed4221e 100644 --- a/toolkit/modules/Promise-backend.js +++ b/toolkit/modules/Promise-backend.js @@ -39,6 +39,11 @@ // that Components is not defined in worker threads, so no instance of Cu can // be obtained. +// As this can be loaded in several ways, allow require and module to be defined. +/* global module:false require:false */ +// This is allowed in workers. +/* global setImmediate:false */ + var Cu = this.require ? require("chrome").Cu : Components.utils; var Cc = this.require ? require("chrome").Cc : Components.classes; var Ci = this.require ? require("chrome").Ci : Components.interfaces; diff --git a/toolkit/modules/ZipUtils.jsm b/toolkit/modules/ZipUtils.jsm index df1746e4fb89..34f51f886ca3 100644 --- a/toolkit/modules/ZipUtils.jsm +++ b/toolkit/modules/ZipUtils.jsm @@ -57,13 +57,13 @@ function saveStreamAsync(aPath, aStream, aFile) { try { aStream.close(); } catch (e) { - logger.error("Failed to close JAR stream for " + aPath); + Cu.reportError("Failed to close JAR stream for " + aPath); } aFile.close().then(function() { deferred.reject(error); }, function(e) { - logger.error("Failed to close file for " + aPath); + Cu.reportError("Failed to close file for " + aPath); deferred.reject(error); }); } diff --git a/toolkit/modules/moz.build b/toolkit/modules/moz.build index 3b557f289ccb..f2a3c3f584f4 100644 --- a/toolkit/modules/moz.build +++ b/toolkit/modules/moz.build @@ -10,8 +10,8 @@ MOCHITEST_MANIFESTS += ['tests/mochitest/mochitest.ini'] MOCHITEST_CHROME_MANIFESTS += ['tests/chrome/chrome.ini'] TESTING_JS_MODULES += [ - 'tests/MockDocument.jsm', - 'tests/PromiseTestUtils.jsm', + 'tests/modules/MockDocument.jsm', + 'tests/modules/PromiseTestUtils.jsm', 'tests/xpcshell/TestIntegration.jsm', ] diff --git a/toolkit/modules/tests/browser/browser_InlineSpellChecker.js b/toolkit/modules/tests/browser/browser_InlineSpellChecker.js index a863db67b097..21f3efda2351 100644 --- a/toolkit/modules/tests/browser/browser_InlineSpellChecker.js +++ b/toolkit/modules/tests/browser/browser_InlineSpellChecker.js @@ -1,7 +1,9 @@ +var InlineSpellChecker; + function test() { let tempScope = {}; Components.utils.import("resource://gre/modules/InlineSpellChecker.jsm", tempScope); - let InlineSpellChecker = tempScope.InlineSpellChecker; + InlineSpellChecker = tempScope.InlineSpellChecker; ok(InlineSpellChecker, "InlineSpellChecker class exists"); for (var fname in tests) { diff --git a/toolkit/modules/tests/browser/testremotepagemanager.html b/toolkit/modules/tests/browser/testremotepagemanager.html index 4303a38f54ce..90a1f61e8aaf 100644 --- a/toolkit/modules/tests/browser/testremotepagemanager.html +++ b/toolkit/modules/tests/browser/testremotepagemanager.html @@ -3,6 +3,8 @@