From b38d859652c0abb31a5199129ed438a6b35cd5eb Mon Sep 17 00:00:00 2001 From: Kearwood Gilbert Date: Tue, 21 Mar 2017 13:21:17 -0700 Subject: [PATCH 01/63] Bug 1346926 - Make PVRManager::SetHaveEventListener async r=kanru - There appears to be no issues with simply changing SetHaveEventListener from sync to async. MozReview-Commit-ID: 3LKgDx9AZnm --HG-- extra : rebase_source : 6c706f592f71a8c967a58f6906861fcff2525ebf --- gfx/vr/ipc/PVRManager.ipdl | 2 +- ipc/ipdl/sync-messages.ini | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/gfx/vr/ipc/PVRManager.ipdl b/gfx/vr/ipc/PVRManager.ipdl index 2920a352560c..008bc6bb9eae 100644 --- a/gfx/vr/ipc/PVRManager.ipdl +++ b/gfx/vr/ipc/PVRManager.ipdl @@ -50,7 +50,7 @@ parent: async ResetSensor(uint32_t aDisplayID); sync GetSensorState(uint32_t aDisplayID) returns(VRHMDSensorState aState); - sync SetHaveEventListener(bool aHaveEventListener); + async SetHaveEventListener(bool aHaveEventListener); async ControllerListenerAdded(); async ControllerListenerRemoved(); diff --git a/ipc/ipdl/sync-messages.ini b/ipc/ipdl/sync-messages.ini index be20e076a070..33ac413cd80b 100644 --- a/ipc/ipdl/sync-messages.ini +++ b/ipc/ipdl/sync-messages.ini @@ -951,8 +951,6 @@ description = description = [PVRManager::GetSensorState] description = -[PVRManager::SetHaveEventListener] -description = [PHal::GetCurrentBatteryInformation] description = [PHal::GetCurrentNetworkInformation] From 130ff3a299d2f8a91d4d5d3f2309af2ff2d86319 Mon Sep 17 00:00:00 2001 From: Thom Chiovoloni Date: Tue, 14 Mar 2017 14:26:20 -0400 Subject: [PATCH 02/63] Bug 1345754 - Skip sync bookmark repair and validation if we have pending changes r=markh MozReview-Commit-ID: ClQRXGZGV9p --HG-- extra : rebase_source : 4ae8ead7a9121dc383fcfc5ebf757f44e46f5679 --- services/sync/modules/bookmark_validator.js | 4 ++ services/sync/modules/collection_validator.js | 9 +++++ services/sync/modules/doctor.js | 5 +++ services/sync/tests/unit/test_doctor.js | 38 +++++++++++++++++++ toolkit/components/places/PlacesSyncUtils.jsm | 18 ++++++++- 5 files changed, 72 insertions(+), 2 deletions(-) diff --git a/services/sync/modules/bookmark_validator.js b/services/sync/modules/bookmark_validator.js index 9100f6734de6..36120cad882c 100644 --- a/services/sync/modules/bookmark_validator.js +++ b/services/sync/modules/bookmark_validator.js @@ -222,6 +222,10 @@ XPCOMUtils.defineLazyGetter(this, "SYNCED_ROOTS", () => [ class BookmarkValidator { + async canValidate() { + return !await PlacesSyncUtils.bookmarks.havePendingChanges(); + } + _followQueries(recordMap) { for (let [guid, entry] of recordMap) { if (entry.type !== "query" && (!entry.bmkUri || !entry.bmkUri.startsWith(QUERY_PROTOCOL))) { diff --git a/services/sync/modules/collection_validator.js b/services/sync/modules/collection_validator.js index f9dacca5e604..425b88814c17 100644 --- a/services/sync/modules/collection_validator.js +++ b/services/sync/modules/collection_validator.js @@ -82,6 +82,15 @@ class CollectionValidator { return Promise.reject("Must implement"); } + /** + * Can we guarantee validation will fail with a reason that isn't actually a + * problem? For example, if we know there are pending changes left over from + * the last sync, this should resolve to false. By default resolves to true. + */ + async canValidate() { + return true; + } + // Turn the client item into something that can be compared with the server item, // and is also safe to mutate. normalizeClientItem(item) { diff --git a/services/sync/modules/doctor.js b/services/sync/modules/doctor.js index 0412dbfa0ac5..6254c163a19e 100644 --- a/services/sync/modules/doctor.js +++ b/services/sync/modules/doctor.js @@ -158,6 +158,11 @@ this.Doctor = { continue; } + if (!await validator.canValidate()) { + log.debug(`Skipping validation for ${engineName} because validator.canValidate() is false`); + continue; + } + // Let's do it! Services.console.logStringMessage( `Sync is about to run a consistency check of ${engine.name}. This may be slow, and ` + diff --git a/services/sync/tests/unit/test_doctor.js b/services/sync/tests/unit/test_doctor.js index 25f9e33cdd8e..dc6be571b476 100644 --- a/services/sync/tests/unit/test_doctor.js +++ b/services/sync/tests/unit/test_doctor.js @@ -65,6 +65,9 @@ add_task(async function test_repairs_start() { let validator = { validate(engine) { return problems; + }, + canValidate() { + return Promise.resolve(true); } } let engine = { @@ -139,3 +142,38 @@ add_task(async function test_repairs_advanced_daily() { // should have done another repair equal(repairCalls, 2); }); + +add_task(async function test_repairs_skip_if_cant_vaidate() { + let validator = { + canValidate() { + return Promise.resolve(false); + }, + validate() { + ok(false, "Shouldn't validate"); + } + } + let engine = { + name: "test-engine", + getValidator() { + return validator; + } + } + let requestor = { + startRepairs(validationInfo, flowID) { + assert.ok(false, "Never should start repairs"); + } + } + let doctor = mockDoctor({ + _getEnginesToValidate(recentlySyncedEngines) { + deepEqual(recentlySyncedEngines, [engine]); + return { + "test-engine": { engine, maxRecords: -1 } + }; + }, + _getRepairRequestor(engineName) { + equal(engineName, engine.name); + return requestor; + }, + }); + await doctor.consult([engine]); +}); diff --git a/toolkit/components/places/PlacesSyncUtils.jsm b/toolkit/components/places/PlacesSyncUtils.jsm index 95bf5fc509e3..4305814ee1e8 100644 --- a/toolkit/components/places/PlacesSyncUtils.jsm +++ b/toolkit/components/places/PlacesSyncUtils.jsm @@ -298,6 +298,16 @@ const BookmarkSyncUtils = PlacesSyncUtils.bookmarks = Object.freeze({ { source: SOURCE_SYNC }); }), + /** + * Resolves to true if there are known sync changes. + */ + havePendingChanges() { + // This could be optimized to use a more efficient query -- We don't need + // grab all the records if all we care about is whether or not any exist. + return PlacesUtils.withConnectionWrapper("BookmarkSyncUtils: havePendingChanges", + db => pullSyncChanges(db, true).then(changes => Object.keys(changes).length > 0)); + }, + /** * Returns a changeset containing local bookmark changes since the last sync. * Updates the sync status of all "NEW" bookmarks to "NORMAL", so that Sync @@ -1687,11 +1697,13 @@ function addRowToChangeRecords(row, changeRecords) { * * @param db * The Sqlite.jsm connection handle. + * @param preventUpdate {boolean} + * Should we skip updating the records we pull. * @return {Promise} resolved once all items have been fetched. * @resolves to an object containing records for changed bookmarks, keyed by * the sync ID. */ -var pullSyncChanges = Task.async(function* (db) { +var pullSyncChanges = Task.async(function* (db, preventUpdate = false) { let changeRecords = {}; yield db.executeCached(` @@ -1716,7 +1728,9 @@ var pullSyncChanges = Task.async(function* (db) { { deletedSyncStatus: PlacesUtils.bookmarks.SYNC_STATUS.NORMAL }, row => addRowToChangeRecords(row, changeRecords)); - yield markChangesAsSyncing(db, changeRecords); + if (!preventUpdate) { + yield markChangesAsSyncing(db, changeRecords); + } return changeRecords; }); From 2905dc199f6f13ca67b4877d7875e6193f2734eb Mon Sep 17 00:00:00 2001 From: Jared Wein Date: Tue, 21 Mar 2017 10:51:40 -0400 Subject: [PATCH 03/63] Bug 1348617 - Use the alpha channel of custom styled select backgrounds by applying the requested color on top of the system's background. r=mossop This matches parity with Google Chrome Canary Version 59.0.3046.0 (Official Build) canary (64-bit). MozReview-Commit-ID: 3rkhiFv8ezX --HG-- extra : rebase_source : 3cb05e6c1e048bab4c7573bd050ea7477fc128fb --- .../test/forms/browser_selectpopup_colors.js | 51 +++++++++++++++++-- toolkit/modules/SelectContentHelper.jsm | 4 +- toolkit/modules/SelectParentHelper.jsm | 8 +-- 3 files changed, 51 insertions(+), 12 deletions(-) diff --git a/browser/base/content/test/forms/browser_selectpopup_colors.js b/browser/base/content/test/forms/browser_selectpopup_colors.js index 6fc7d846edde..a197d4ea9f0a 100644 --- a/browser/base/content/test/forms/browser_selectpopup_colors.js +++ b/browser/base/content/test/forms/browser_selectpopup_colors.js @@ -60,6 +60,13 @@ const TRANSLUCENT_SELECT_BECOMES_OPAQUE = ' ' + ""; +const TRANSLUCENT_SELECT_APPLIES_ON_BASE_COLOR = + "" + + ""; + const DISABLED_OPTGROUP_AND_OPTIONS = "" + " based on locale. r=mossop MozReview-Commit-ID: 1QJig3ZTV7R --HG-- extra : rebase_source : f5f0f90ceb2644573ac9733f1bbab86df534e4f0 --- toolkit/content/widgets/datetimebox.xml | 33 +++++++++++++++++++------ 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/toolkit/content/widgets/datetimebox.xml b/toolkit/content/widgets/datetimebox.xml index b50147f10bd8..095755897aeb 100644 --- a/toolkit/content/widgets/datetimebox.xml +++ b/toolkit/content/widgets/datetimebox.xml @@ -486,7 +486,7 @@ this.mDayPeriodPlaceHolder = ]]>"&time.dayperiod.placeholder;" + + + + + + + this.mMaxHour) ? value % this.mMaxHour : value; + } + } else if (value > this.mMaxHour) { value = this.mMaxHour; - } else { - // Change to 12hr format if user input is greater than 12. - value = (value > this.mMaxHour) ? value % this.mMaxHour : value; } } // prepend zero From ba6513e929a1b458198eac5d96f037e4c941640d Mon Sep 17 00:00:00 2001 From: James Cheng Date: Tue, 21 Mar 2017 16:25:29 +0800 Subject: [PATCH 23/63] Bug 1349129 - Fix CID 1403176 and CID 1403178 for memory leak. r=jwwang MozReview-Commit-ID: ClAcLgztPZ4 --HG-- extra : rebase_source : 3f00022cf2ca8dfec78cc1e8cc8f48fcbb220feb --- dom/media/gtest/TestBlankVideoDataCreator.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dom/media/gtest/TestBlankVideoDataCreator.cpp b/dom/media/gtest/TestBlankVideoDataCreator.cpp index fcea02406f87..94a6213fd1d9 100644 --- a/dom/media/gtest/TestBlankVideoDataCreator.cpp +++ b/dom/media/gtest/TestBlankVideoDataCreator.cpp @@ -10,18 +10,20 @@ using namespace mozilla; TEST(BlankVideoDataCreator, ShouldNotOverflow) { + RefPtr mrd = new MediaRawData(); const uint32_t width = 1; const uint32_t height = 1; BlankVideoDataCreator creater(width, height, nullptr); - RefPtr data = creater.Create(new MediaRawData()); + RefPtr data = creater.Create(mrd); EXPECT_NE(data.get(), nullptr); } TEST(BlankVideoDataCreator, ShouldOverflow) { + RefPtr mrd = new MediaRawData(); const uint32_t width = UINT_MAX; const uint32_t height = UINT_MAX; BlankVideoDataCreator creater(width, height, nullptr); - RefPtr data = creater.Create(new MediaRawData()); + RefPtr data = creater.Create(mrd); EXPECT_EQ(data.get(), nullptr); } From 0d95383399ac4b1758c35fab629b68747e3372ab Mon Sep 17 00:00:00 2001 From: bechen Date: Tue, 21 Mar 2017 16:16:08 +0800 Subject: [PATCH 24/63] Bug 1343799 - lable runnables in texttracklist.cpp. r=jwwang MozReview-Commit-ID: 39MmwAMaDdk --HG-- extra : rebase_source : 9630f72f1e0e44df551fdab42f10c4d02f5357e6 --- dom/media/TextTrackList.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dom/media/TextTrackList.cpp b/dom/media/TextTrackList.cpp index 9d8d3de12723..0e667dd1db7a 100644 --- a/dom/media/TextTrackList.cpp +++ b/dom/media/TextTrackList.cpp @@ -7,6 +7,7 @@ #include "mozilla/dom/TextTrackListBinding.h" #include "mozilla/dom/TrackEvent.h" #include "nsThreadUtils.h" +#include "nsGlobalWindow.h" #include "mozilla/dom/TextTrackCue.h" #include "mozilla/dom/TextTrackManager.h" @@ -174,6 +175,11 @@ TextTrackList::CreateAndDispatchChangeEvent() { MOZ_ASSERT(NS_IsMainThread()); if (!mPendingTextTrackChange) { + nsPIDOMWindowInner* win = GetOwner(); + if (!win) { + return; + } + mPendingTextTrackChange = true; RefPtr event = NS_NewDOMEvent(this, nullptr, nullptr); @@ -181,7 +187,9 @@ TextTrackList::CreateAndDispatchChangeEvent() event->SetTrusted(true); nsCOMPtr eventRunner = new ChangeEventRunner(this, event); - NS_DispatchToMainThread(eventRunner); + nsGlobalWindow::Cast(win)->Dispatch( + "TextTrackList::CreateAndDispatchChangeEvent", TaskCategory::Other, + eventRunner.forget()); } } From 5d1431a1c275e7926944cd5157a5239607f8e2e0 Mon Sep 17 00:00:00 2001 From: Chris Pearce Date: Tue, 21 Mar 2017 11:35:10 +1300 Subject: [PATCH 25/63] Bug 1349008 - Include SystemGroup.h in GMPVideoEncoderParent to fix unified build bustage caused by bug 1346681. r=jwwang MozReview-Commit-ID: DncNbBYbNn8 --HG-- extra : rebase_source : f726807ecb87fd814a1933f292ab52e00ba8166f --- dom/media/gmp/GMPVideoEncoderParent.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/dom/media/gmp/GMPVideoEncoderParent.cpp b/dom/media/gmp/GMPVideoEncoderParent.cpp index f38645b88645..dae0182c6f53 100644 --- a/dom/media/gmp/GMPVideoEncoderParent.cpp +++ b/dom/media/gmp/GMPVideoEncoderParent.cpp @@ -16,6 +16,7 @@ #include "nsThreadUtils.h" #include "runnable_utils.h" #include "GMPUtils.h" +#include "mozilla/SystemGroup.h" namespace mozilla { From 2f076a0ebdd45be86ee2219befada21800a09935 Mon Sep 17 00:00:00 2001 From: maliu Date: Tue, 21 Mar 2017 13:47:23 +0800 Subject: [PATCH 26/63] Bug 1321981 - [RTL] ViewPager Support - part 1. Import thirdparty RtlViewPager, r=sebastian MozReview-Commit-ID: E3VP2SoRKTt --HG-- extra : rebase_source : 975e73220f66ff00265082f28e1de247bf0ab3e7 --- mobile/android/base/moz.build | 2 + .../rtlviewpager/PagerAdapterWrapper.java | 116 ++++++ .../booking/rtlviewpager/RtlViewPager.java | 341 ++++++++++++++++++ 3 files changed, 459 insertions(+) create mode 100644 mobile/android/thirdparty/com/booking/rtlviewpager/PagerAdapterWrapper.java create mode 100644 mobile/android/thirdparty/com/booking/rtlviewpager/RtlViewPager.java diff --git a/mobile/android/base/moz.build b/mobile/android/base/moz.build index 090c601aa040..c410dc7c634a 100644 --- a/mobile/android/base/moz.build +++ b/mobile/android/base/moz.build @@ -998,6 +998,8 @@ gbjar.javac_flags += ['-Xlint:all,-deprecation,-fallthrough', '-J-Xmx512m', '-J- # gecko-thirdparty is a good place to put small independent libraries gtjar = add_java_jar('gecko-thirdparty') gtjar.sources += [ thirdparty_source_dir + f for f in [ + 'com/booking/rtlviewpager/PagerAdapterWrapper.java', + 'com/booking/rtlviewpager/RtlViewPager.java', 'com/jakewharton/disklrucache/DiskLruCache.java', 'com/jakewharton/disklrucache/StrictLineReader.java', 'com/jakewharton/disklrucache/Util.java', diff --git a/mobile/android/thirdparty/com/booking/rtlviewpager/PagerAdapterWrapper.java b/mobile/android/thirdparty/com/booking/rtlviewpager/PagerAdapterWrapper.java new file mode 100644 index 000000000000..e8b045602e35 --- /dev/null +++ b/mobile/android/thirdparty/com/booking/rtlviewpager/PagerAdapterWrapper.java @@ -0,0 +1,116 @@ +/* + * Copyright 2015 Diego Gómez Olvera + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.booking.rtlviewpager; + +import android.database.DataSetObserver; +import android.os.Parcelable; +import android.support.annotation.NonNull; +import android.support.v4.view.PagerAdapter; +import android.view.View; +import android.view.ViewGroup; + +/** + * PagerAdapter decorator. + */ +class PagerAdapterWrapper extends PagerAdapter { + + @NonNull + private final PagerAdapter adapter; + + protected PagerAdapterWrapper(@NonNull PagerAdapter adapter) { + this.adapter = adapter; + } + + @NonNull + public PagerAdapter getInnerAdapter() { + return adapter; + } + + @Override + public int getCount() { + return adapter.getCount(); + } + + @Override + public boolean isViewFromObject(View view, Object object) { + return adapter.isViewFromObject(view, object); + } + + @Override + public CharSequence getPageTitle(int position) { + return adapter.getPageTitle(position); + } + + @Override + public float getPageWidth(int position) { + return adapter.getPageWidth(position); + } + + @Override + public int getItemPosition(Object object) { + return adapter.getItemPosition(object); + } + + @Override + public Object instantiateItem(ViewGroup container, int position) { + return adapter.instantiateItem(container, position); + } + + @Override + public void destroyItem(ViewGroup container, int position, Object object) { + adapter.destroyItem(container, position, object); + } + + @Override + public void setPrimaryItem(ViewGroup container, int position, Object object) { + adapter.setPrimaryItem(container, position, object); + } + + @Override + public void notifyDataSetChanged() { + adapter.notifyDataSetChanged(); + } + + @Override + public void registerDataSetObserver(DataSetObserver observer) { + adapter.registerDataSetObserver(observer); + } + + @Override + public void unregisterDataSetObserver(DataSetObserver observer) { + adapter.unregisterDataSetObserver(observer); + } + + @Override + public Parcelable saveState() { + return adapter.saveState(); + } + + @Override + public void restoreState(Parcelable state, ClassLoader loader) { + adapter.restoreState(state, loader); + } + + @Override + public void startUpdate(ViewGroup container) { + adapter.startUpdate(container); + } + + @Override + public void finishUpdate(ViewGroup container) { + adapter.finishUpdate(container); + } +} diff --git a/mobile/android/thirdparty/com/booking/rtlviewpager/RtlViewPager.java b/mobile/android/thirdparty/com/booking/rtlviewpager/RtlViewPager.java new file mode 100644 index 000000000000..ce5458ffaf1f --- /dev/null +++ b/mobile/android/thirdparty/com/booking/rtlviewpager/RtlViewPager.java @@ -0,0 +1,341 @@ +/* + * Copyright 2015 Diego Gómez Olvera + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.booking.rtlviewpager; + + +import android.content.Context; +import android.database.DataSetObserver; +import android.os.Parcel; +import android.os.Parcelable; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.support.v4.text.TextUtilsCompat; +import android.support.v4.util.ArrayMap; +import android.support.v4.view.PagerAdapter; +import android.support.v4.view.ViewCompat; +import android.support.v4.view.ViewPager; +import android.util.AttributeSet; +import android.view.ViewGroup; + +import java.util.Map; + +/** + * ViewPager that reverses the items order in RTL locales. + */ +public class RtlViewPager extends ViewPager { + + @NonNull + private final Map reverseOnPageChangeListeners; + + @Nullable + private DataSetObserver dataSetObserver; + + private boolean suppressOnPageChangeListeners; + + public RtlViewPager(Context context) { + super(context); + reverseOnPageChangeListeners = new ArrayMap<>(1); + } + + public RtlViewPager(Context context, AttributeSet attrs) { + super(context, attrs); + reverseOnPageChangeListeners = new ArrayMap<>(1); + } + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + registerRtlDataSetObserver(super.getAdapter()); + } + + @Override + protected void onDetachedFromWindow() { + unregisterRtlDataSetObserver(); + super.onDetachedFromWindow(); + } + + private void registerRtlDataSetObserver(PagerAdapter adapter) { + if (adapter instanceof ReverseAdapter && dataSetObserver == null) { + dataSetObserver = new RevalidateIndicesOnContentChange((ReverseAdapter) adapter); + adapter.registerDataSetObserver(dataSetObserver); + ((ReverseAdapter) adapter).revalidateIndices(); + } + } + + private void unregisterRtlDataSetObserver() { + final PagerAdapter adapter = super.getAdapter(); + + if (adapter instanceof ReverseAdapter && dataSetObserver != null) { + adapter.unregisterDataSetObserver(dataSetObserver); + dataSetObserver = null; + } + } + + @Override + public void setCurrentItem(int item, boolean smoothScroll) { + super.setCurrentItem(convert(item), smoothScroll); + } + + @Override + public void setCurrentItem(int item) { + super.setCurrentItem(convert(item)); + } + + @Override + public int getCurrentItem() { + return convert(super.getCurrentItem()); + } + + private int convert(int position) { + if (position >= 0 && isRtl()) { + return getAdapter() == null ? 0 : getAdapter().getCount() - position - 1; + } else { + return position; + } + } + + @Nullable + @Override + public PagerAdapter getAdapter() { + final PagerAdapter adapter = super.getAdapter(); + return adapter instanceof ReverseAdapter ? ((ReverseAdapter) adapter).getInnerAdapter() : adapter; + } + + @Override + public void fakeDragBy(float xOffset) { + super.fakeDragBy(isRtl() ? xOffset : -xOffset); + } + + @Override + public void setAdapter(@Nullable PagerAdapter adapter) { + unregisterRtlDataSetObserver(); + + final boolean rtlReady = adapter != null && isRtl(); + if (rtlReady) { + adapter = new ReverseAdapter(adapter); + registerRtlDataSetObserver(adapter); + } + super.setAdapter(adapter); + if (rtlReady) { + setCurrentItemWithoutNotification(0); + } + } + + private void setCurrentItemWithoutNotification(int index) { + suppressOnPageChangeListeners = true; + setCurrentItem(index, false); + suppressOnPageChangeListeners = false; + } + + protected boolean isRtl() { + return TextUtilsCompat.getLayoutDirectionFromLocale( + getContext().getResources().getConfiguration().locale) == ViewCompat.LAYOUT_DIRECTION_RTL; + } + + @Override + public void addOnPageChangeListener(@NonNull OnPageChangeListener listener) { + if (isRtl()) { + final ReverseOnPageChangeListener reverseListener = new ReverseOnPageChangeListener(listener); + reverseOnPageChangeListeners.put(listener, reverseListener); + listener = reverseListener; + } + super.addOnPageChangeListener(listener); + } + + @Override + public void removeOnPageChangeListener(@NonNull OnPageChangeListener listener) { + if (isRtl()) { + listener = reverseOnPageChangeListeners.remove(listener); + } + super.removeOnPageChangeListener(listener); + } + + @Override + public Parcelable onSaveInstanceState() { + return new SavedState(super.onSaveInstanceState(), getCurrentItem(), isRtl()); + } + + @Override + public void onRestoreInstanceState(Parcelable state) { + SavedState ss = (SavedState) state; + super.onRestoreInstanceState(ss.superState); + if (ss.isRTL != isRtl()) setCurrentItem(ss.position, false); + } + + private class ReverseAdapter extends PagerAdapterWrapper { + + private int lastCount; + + public ReverseAdapter(@NonNull PagerAdapter adapter) { + super(adapter); + lastCount = adapter.getCount(); + } + + @Override + public CharSequence getPageTitle(int position) { + return super.getPageTitle(reverse(position)); + } + + @Override + public float getPageWidth(int position) { + return super.getPageWidth(reverse(position)); + } + + @Override + public int getItemPosition(Object object) { + final int itemPosition = super.getItemPosition(object); + return itemPosition < 0 ? itemPosition : reverse(itemPosition); + } + + @Override + public Object instantiateItem(ViewGroup container, int position) { + return super.instantiateItem(container, reverse(position)); + } + + @Override + public void destroyItem(ViewGroup container, int position, Object object) { + super.destroyItem(container, reverse(position), object); + } + + @Override + public void setPrimaryItem(ViewGroup container, int position, Object object) { + super.setPrimaryItem(container, lastCount - position - 1, object); + } + + private int reverse(int position) { + return getCount() - position - 1; + } + + private void revalidateIndices() { + final int newCount = getCount(); + if (newCount != lastCount) { + setCurrentItemWithoutNotification(Math.max(0, lastCount - 1)); + lastCount = newCount; + } + } + } + + private static class RevalidateIndicesOnContentChange extends DataSetObserver { + @NonNull + private final ReverseAdapter adapter; + + private RevalidateIndicesOnContentChange(@NonNull ReverseAdapter adapter) { + this.adapter = adapter; + } + + @Override + public void onChanged() { + super.onChanged(); + adapter.revalidateIndices(); + } + } + + private class ReverseOnPageChangeListener implements OnPageChangeListener { + + @NonNull + private final OnPageChangeListener original; + + private int pagerPosition; + + private ReverseOnPageChangeListener(@NonNull OnPageChangeListener original) { + this.original = original; + pagerPosition = -1; + } + + @Override + public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { + if (!suppressOnPageChangeListeners) { + if (positionOffset == 0f && positionOffsetPixels == 0) { + pagerPosition = reverse(position); + } else { + pagerPosition = reverse(position + 1); + } + original.onPageScrolled(pagerPosition, positionOffset > 0 ? 1f - positionOffset : positionOffset, positionOffsetPixels); + } + } + + @Override + public void onPageSelected(int position) { + if (!suppressOnPageChangeListeners) { + original.onPageSelected(reverse(position)); + } + } + + @Override + public void onPageScrollStateChanged(int state) { + if (!suppressOnPageChangeListeners) { + original.onPageScrollStateChanged(state); + } + } + + private int reverse(int position) { + final PagerAdapter adapter = getAdapter(); + return adapter == null ? position : adapter.getCount() - position - 1; + } + } + + public static class SavedState implements Parcelable { + + Parcelable superState; + int position; + boolean isRTL; + + public SavedState(Parcelable superState, int position, boolean isRTL) { + super(); + this.superState = superState; + this.position = position; + this.isRTL = isRTL; + } + + SavedState(Parcel in, ClassLoader loader) { + if (loader == null) { + loader = getClass().getClassLoader(); + } + superState = in.readParcelable(loader); + position = in.readInt(); + isRTL = in.readByte() != 0; + } + + @Override + public void writeToParcel(Parcel out, int flags) { + out.writeParcelable(superState, flags); + out.writeInt(position); + out.writeByte(isRTL ? (byte) 1 : (byte) 0); + } + + @Override + public int describeContents() { + return 0; + } + + public static final ClassLoaderCreator CREATOR = new + ClassLoaderCreator() { + @Override + public SavedState createFromParcel(Parcel source, ClassLoader loader) { + return new SavedState(source, loader); + } + + @Override + public SavedState createFromParcel(Parcel source) { + return new SavedState(source, null); + } + + public SavedState[] newArray(int size) { + return new SavedState[size]; + } + }; + } +} From a699dea05745c58fadc47e18cec3044845af9219 Mon Sep 17 00:00:00 2001 From: maliu Date: Tue, 21 Mar 2017 14:49:40 +0800 Subject: [PATCH 27/63] Bug 1321981 - [RTL] ViewPager Support - part 2. Notify dataset change with calling super, r=sebastian MozReview-Commit-ID: LUvWH3Sq8IJ --HG-- extra : rebase_source : 3a9a8d657619f877f0d17e8f5870113dfd87da0e --- .../rtlviewpager/PagerAdapterWrapper.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/mobile/android/thirdparty/com/booking/rtlviewpager/PagerAdapterWrapper.java b/mobile/android/thirdparty/com/booking/rtlviewpager/PagerAdapterWrapper.java index e8b045602e35..8ef8478163a1 100644 --- a/mobile/android/thirdparty/com/booking/rtlviewpager/PagerAdapterWrapper.java +++ b/mobile/android/thirdparty/com/booking/rtlviewpager/PagerAdapterWrapper.java @@ -15,6 +15,7 @@ */ package com.booking.rtlviewpager; +import android.database.DataSetObservable; import android.database.DataSetObserver; import android.os.Parcelable; import android.support.annotation.NonNull; @@ -29,9 +30,23 @@ class PagerAdapterWrapper extends PagerAdapter { @NonNull private final PagerAdapter adapter; + private final DataSetObservable dataSetObservable = new DataSetObservable(); + protected PagerAdapterWrapper(@NonNull PagerAdapter adapter) { this.adapter = adapter; + this.adapter.registerDataSetObserver(new DataSetObserver() { + @Override + public void onChanged() { + PagerAdapterWrapper.super.notifyDataSetChanged(); + dataSetObservable.notifyChanged(); + } + + @Override + public void onInvalidated() { + dataSetObservable.notifyInvalidated(); + } + }); } @NonNull @@ -86,12 +101,12 @@ class PagerAdapterWrapper extends PagerAdapter { @Override public void registerDataSetObserver(DataSetObserver observer) { - adapter.registerDataSetObserver(observer); + dataSetObservable.registerObserver(observer); } @Override public void unregisterDataSetObserver(DataSetObserver observer) { - adapter.unregisterDataSetObserver(observer); + dataSetObservable.unregisterObserver(observer); } @Override From 3fc1180e7a5d62b442ade2318e8c5f6b00a24299 Mon Sep 17 00:00:00 2001 From: maliu Date: Tue, 21 Mar 2017 14:58:03 +0800 Subject: [PATCH 28/63] Bug 1321981 - [RTL] ViewPager Support - part 3. Skip set current item if adapter is empty, r=sebastian MozReview-Commit-ID: L82yxhdG5bd --HG-- extra : rebase_source : 71615c37c4e5b4abc67d2eb92a6e4662dc59b149 --- .../thirdparty/com/booking/rtlviewpager/RtlViewPager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/android/thirdparty/com/booking/rtlviewpager/RtlViewPager.java b/mobile/android/thirdparty/com/booking/rtlviewpager/RtlViewPager.java index ce5458ffaf1f..b0cc8bd7789e 100644 --- a/mobile/android/thirdparty/com/booking/rtlviewpager/RtlViewPager.java +++ b/mobile/android/thirdparty/com/booking/rtlviewpager/RtlViewPager.java @@ -129,7 +129,7 @@ public class RtlViewPager extends ViewPager { registerRtlDataSetObserver(adapter); } super.setAdapter(adapter); - if (rtlReady) { + if (rtlReady && adapter.getCount() > 0) { setCurrentItemWithoutNotification(0); } } From aad3222a910bd8eb6d873e86a0d74e1d5bfed5e5 Mon Sep 17 00:00:00 2001 From: maliu Date: Tue, 21 Mar 2017 14:34:08 +0800 Subject: [PATCH 29/63] Bug 1321981 - [RTL] ViewPager Support - part 4. Switch to RtlViewPager, r=sebastian MozReview-Commit-ID: 2s695og8Umo --HG-- extra : rebase_source : 783cc65585ebecc5f3a57658697f3d01985af885 --- .../org/mozilla/gecko/firstrun/FirstrunPager.java | 7 ++++--- .../base/java/org/mozilla/gecko/home/HomePager.java | 11 ++++++----- .../activitystream/topsites/CirclePageIndicator.java | 4 ++-- .../layout/activity_stream_main_toppanel.xml | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/mobile/android/base/java/org/mozilla/gecko/firstrun/FirstrunPager.java b/mobile/android/base/java/org/mozilla/gecko/firstrun/FirstrunPager.java index c2838ee3e021..3e716a7b8172 100644 --- a/mobile/android/base/java/org/mozilla/gecko/firstrun/FirstrunPager.java +++ b/mobile/android/base/java/org/mozilla/gecko/firstrun/FirstrunPager.java @@ -9,7 +9,6 @@ import android.content.Context; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; -import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; @@ -17,6 +16,8 @@ import android.animation.Animator; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; +import com.booking.rtlviewpager.RtlViewPager; + import org.mozilla.gecko.Telemetry; import org.mozilla.gecko.TelemetryContract; import org.mozilla.gecko.home.HomePager.Decor; @@ -30,7 +31,7 @@ import java.util.List; * * @see FirstrunPanel for the first run pages that are used in this pager. */ -public class FirstrunPager extends ViewPager { +public class FirstrunPager extends RtlViewPager { private Context context; protected FirstrunPanel.PagerNavigation pagerNavigation; @@ -48,7 +49,7 @@ public class FirstrunPager extends ViewPager { @Override public void addView(View child, int index, ViewGroup.LayoutParams params) { if (child instanceof Decor) { - ((ViewPager.LayoutParams) params).isDecor = true; + ((RtlViewPager.LayoutParams) params).isDecor = true; mDecor = (Decor) child; mDecor.setOnTitleClickListener(new TabMenuStrip.OnTitleClickListener() { @Override diff --git a/mobile/android/base/java/org/mozilla/gecko/home/HomePager.java b/mobile/android/base/java/org/mozilla/gecko/home/HomePager.java index cccca47b184b..1e3f3b981618 100644 --- a/mobile/android/base/java/org/mozilla/gecko/home/HomePager.java +++ b/mobile/android/base/java/org/mozilla/gecko/home/HomePager.java @@ -28,13 +28,14 @@ import android.support.v4.app.FragmentManager; import android.support.v4.app.LoaderManager; import android.support.v4.app.LoaderManager.LoaderCallbacks; import android.support.v4.content.Loader; -import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; -public class HomePager extends ViewPager implements HomeScreen { +import com.booking.rtlviewpager.RtlViewPager; + +public class HomePager extends RtlViewPager implements HomeScreen { @Override public boolean requestFocus(int direction, Rect previouslyFocusedRect) { @@ -172,7 +173,7 @@ public class HomePager extends ViewPager implements HomeScreen { setFocusableInTouchMode(true); mOriginalBackground = getBackground(); - setOnPageChangeListener(new PageChangeListener()); + addOnPageChangeListener(new PageChangeListener()); mLoadState = LoadState.UNLOADED; } @@ -180,7 +181,7 @@ public class HomePager extends ViewPager implements HomeScreen { @Override public void addView(View child, int index, ViewGroup.LayoutParams params) { if (child instanceof Decor) { - ((ViewPager.LayoutParams) params).isDecor = true; + ((RtlViewPager.LayoutParams) params).isDecor = true; mDecor = (Decor) child; mTabStrip = child; @@ -519,7 +520,7 @@ public class HomePager extends ViewPager implements HomeScreen { } } - private class PageChangeListener implements ViewPager.OnPageChangeListener { + private class PageChangeListener implements RtlViewPager.OnPageChangeListener { @Override public void onPageSelected(int position) { notifyPanelSelected(position); diff --git a/mobile/android/base/java/org/mozilla/gecko/home/activitystream/topsites/CirclePageIndicator.java b/mobile/android/base/java/org/mozilla/gecko/home/activitystream/topsites/CirclePageIndicator.java index fd7197d0bef3..5ec58d1cee00 100644 --- a/mobile/android/base/java/org/mozilla/gecko/home/activitystream/topsites/CirclePageIndicator.java +++ b/mobile/android/base/java/org/mozilla/gecko/home/activitystream/topsites/CirclePageIndicator.java @@ -386,13 +386,13 @@ public class CirclePageIndicator return; } if (mViewPager != null) { - mViewPager.setOnPageChangeListener(null); + mViewPager.removeOnPageChangeListener(this); } if (view.getAdapter() == null) { throw new IllegalStateException("ViewPager does not have adapter instance."); } mViewPager = view; - mViewPager.setOnPageChangeListener(this); + mViewPager.addOnPageChangeListener(this); invalidate(); } diff --git a/mobile/android/base/resources/layout/activity_stream_main_toppanel.xml b/mobile/android/base/resources/layout/activity_stream_main_toppanel.xml index 60c420063c49..bb2e1870a72e 100644 --- a/mobile/android/base/resources/layout/activity_stream_main_toppanel.xml +++ b/mobile/android/base/resources/layout/activity_stream_main_toppanel.xml @@ -6,7 +6,7 @@ android:layout_height="wrap_content" android:orientation="vertical"> - Date: Tue, 21 Mar 2017 14:39:48 +0800 Subject: [PATCH 30/63] Bug 1348634. P1 - add more debugging logs. r=kaku MozReview-Commit-ID: FB7XKRLNeVw --HG-- extra : rebase_source : 0cf4ae1ffacc3e774bf552f65b7ea607afc28b17 --- dom/media/test/test_load_same_resource.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dom/media/test/test_load_same_resource.html b/dom/media/test/test_load_same_resource.html index 0151cf5231e6..b20abd4d15a2 100644 --- a/dom/media/test/test_load_same_resource.html +++ b/dom/media/test/test_load_same_resource.html @@ -83,7 +83,11 @@ function initTest(test, token) { SimpleTest.waitForExplicitFinish(); SpecialPowers.pushPrefEnv( - {"set": [["logging.MediaDecoder", "Debug"]]}, + {"set": [ + ["logging.MediaDecoder", "Debug"], + ["logging.nsMediaElement", "Debug"], + ["logging.MediaCache", "Debug"], + ]}, manager.runTests.bind(manager, gCloneTests, initTest)); From 99537f75103a8d4406abcab107d53c30d2f8af93 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Tue, 21 Mar 2017 20:20:28 -0700 Subject: [PATCH 31/63] servo: Merge #16066 - stylo: Support all non-ts pseudos with an argument (from Manishearth:stylo-nonts); r=emilio r=emilio https://bugzilla.mozilla.org/show_bug.cgi?id=1341086#c34 Source-Repo: https://github.com/servo/servo Source-Revision: 82b88aad453f376a97adcca7b45d0b0ee390c817 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 70d17735c90afd1e235da4326db2da1540e5b619 --- .../style/gecko/non_ts_pseudo_class_list.rs | 5 +++++ .../components/style/gecko/selector_parser.rs | 18 ++++++++++++++---- servo/components/style/gecko/wrapper.rs | 19 ++++++++++++++++++- .../style/gecko_bindings/bindings.rs | 6 ++++++ 4 files changed, 43 insertions(+), 5 deletions(-) diff --git a/servo/components/style/gecko/non_ts_pseudo_class_list.rs b/servo/components/style/gecko/non_ts_pseudo_class_list.rs index f18bbf839748..fce2c2968290 100644 --- a/servo/components/style/gecko/non_ts_pseudo_class_list.rs +++ b/servo/components/style/gecko/non_ts_pseudo_class_list.rs @@ -67,6 +67,11 @@ macro_rules! apply_non_ts_list { ], string: [ ("-moz-system-metric", MozSystemMetric, mozSystemMetric, _, PSEUDO_CLASS_INTERNAL), + ("-moz-locale-dir", MozLocaleDir, mozLocaleDir, _, PSEUDO_CLASS_INTERNAL), + ("-moz-empty-except-children-with-localname", MozEmptyExceptChildrenWithLocalname, + mozEmptyExceptChildrenWithLocalname, _, PSEUDO_CLASS_INTERNAL), + ("dir", Dir, dir, _, _), + ("lang", Lang, lang, _, _), ] } } diff --git a/servo/components/style/gecko/selector_parser.rs b/servo/components/style/gecko/selector_parser.rs index 25785beee023..3eccac4443c6 100644 --- a/servo/components/style/gecko/selector_parser.rs +++ b/servo/components/style/gecko/selector_parser.rs @@ -151,7 +151,7 @@ macro_rules! pseudo_class_name { )* $( #[doc = $s_css] - $s_name(Box), + $s_name(Box<[u16]>), )* /// The non-standard `:-moz-any` pseudo-class. MozAny(Vec>), @@ -162,13 +162,20 @@ apply_non_ts_list!(pseudo_class_name); impl ToCss for NonTSPseudoClass { fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { + use cssparser::CssStringWriter; + use fmt::Write; macro_rules! pseudo_class_serialize { (bare: [$(($css:expr, $name:ident, $gecko_type:tt, $state:tt, $flags:tt),)*], string: [$(($s_css:expr, $s_name:ident, $s_gecko_type:tt, $s_state:tt, $s_flags:tt),)*]) => { match *self { $(NonTSPseudoClass::$name => concat!(":", $css),)* $(NonTSPseudoClass::$s_name(ref s) => { - return dest.write_str(&format!(":{}({})", $s_css, s)) + write!(dest, ":{}(", $s_css)?; + { + let mut css = CssStringWriter::new(dest); + css.write_str(&String::from_utf16(&s).unwrap())?; + } + return dest.write_str(")") }, )* NonTSPseudoClass::MozAny(ref selectors) => { dest.write_str(":-moz-any(")?; @@ -334,8 +341,11 @@ impl<'a> ::selectors::Parser for SelectorParser<'a> { string: [$(($s_css:expr, $s_name:ident, $s_gecko_type:tt, $s_state:tt, $s_flags:tt),)*]) => { match_ignore_ascii_case! { &name, $($s_css => { - let name = String::from(parser.expect_ident_or_string()?).into_boxed_str(); - NonTSPseudoClass::$s_name(name) + let name = parser.expect_ident_or_string()?; + // convert to null terminated utf16 string + // since that's what Gecko deals with + let utf16: Vec = name.encode_utf16().chain(Some(0u16)).collect(); + NonTSPseudoClass::$s_name(utf16.into_boxed_slice()) }, )* "-moz-any" => { let selectors = parser.parse_comma_separated(|input| { diff --git a/servo/components/style/gecko/wrapper.rs b/servo/components/style/gecko/wrapper.rs index b9cab601f2c4..d98546734b36 100644 --- a/servo/components/style/gecko/wrapper.rs +++ b/servo/components/style/gecko/wrapper.rs @@ -35,6 +35,7 @@ use gecko_bindings::bindings::Gecko_GetAnimationRule; use gecko_bindings::bindings::Gecko_GetHTMLPresentationAttrDeclarationBlock; use gecko_bindings::bindings::Gecko_GetStyleAttrDeclarationBlock; use gecko_bindings::bindings::Gecko_GetStyleContext; +use gecko_bindings::bindings::Gecko_MatchStringArgPseudo; use gecko_bindings::bindings::Gecko_UpdateAnimations; use gecko_bindings::structs; use gecko_bindings::structs::{RawGeckoElement, RawGeckoNode}; @@ -702,10 +703,26 @@ impl<'le> ::selectors::Element for GeckoElement<'le> { NonTSPseudoClass::MozBrowserFrame => unsafe { Gecko_MatchesElement(pseudo_class.to_gecko_pseudoclasstype().unwrap(), self.0) }, - NonTSPseudoClass::MozSystemMetric(_) => false, NonTSPseudoClass::MozAny(ref sels) => { sels.iter().any(|s| matches_complex_selector(s, self, None, relations, flags)) } + NonTSPseudoClass::MozSystemMetric(ref s) | + NonTSPseudoClass::MozLocaleDir(ref s) | + NonTSPseudoClass::MozEmptyExceptChildrenWithLocalname(ref s) | + NonTSPseudoClass::Dir(ref s) | + NonTSPseudoClass::Lang(ref s) => { + use selectors::matching::HAS_SLOW_SELECTOR; + unsafe { + let mut set_slow_selector = false; + let matches = Gecko_MatchStringArgPseudo(self.0, + pseudo_class.to_gecko_pseudoclasstype().unwrap(), + s.as_ptr(), &mut set_slow_selector); + if set_slow_selector { + *flags |= HAS_SLOW_SELECTOR; + } + matches + } + } } } diff --git a/servo/components/style/gecko_bindings/bindings.rs b/servo/components/style/gecko_bindings/bindings.rs index b28183c6ab38..7c2ccb6450c4 100644 --- a/servo/components/style/gecko_bindings/bindings.rs +++ b/servo/components/style/gecko_bindings/bindings.rs @@ -1003,6 +1003,12 @@ extern "C" { RawGeckoPresContextBorrowed) -> nscolor; } +extern "C" { + pub fn Gecko_MatchStringArgPseudo(element: RawGeckoElementBorrowed, + type_: CSSPseudoClassType, + ident: *const u16, + set_slow_selector: *mut bool) -> bool; +} extern "C" { pub fn Gecko_Construct_Default_nsStyleFont(ptr: *mut nsStyleFont, pres_context: From 49b745a0587e0dd8cbf1a08274f072f048613b2d Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Thu, 16 Mar 2017 14:10:22 -0700 Subject: [PATCH 32/63] Bug 1341086 - Part 1: stylo: Refactor out matching of string-arg pseudos so that we can call it from servo; r=emilio MozReview-Commit-ID: 23JzUq4K4pq --HG-- extra : rebase_source : 7e37914a7fe3e54a94c95c987e5aa5c16f604f42 --- layout/style/nsCSSRuleProcessor.cpp | 324 +++++++++++++++------------- layout/style/nsCSSRuleProcessor.h | 31 +++ 2 files changed, 207 insertions(+), 148 deletions(-) diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp index 969a2f717572..9f1d5a19d463 100644 --- a/layout/style/nsCSSRuleProcessor.cpp +++ b/layout/style/nsCSSRuleProcessor.cpp @@ -1637,6 +1637,168 @@ StateSelectorMatches(Element* aElement, return true; } +/* static */ bool +nsCSSRuleProcessor::StringPseudoMatches(mozilla::dom::Element* aElement, + CSSPseudoClassType aPseudo, + char16_t* aString, + nsIDocument* aDocument, + bool aForStyling, + EventStates aStateMask, + bool* const aDependence) +{ + switch (aPseudo) { + case CSSPseudoClassType::mozLocaleDir: + { + bool docIsRTL = + aDocument->GetDocumentState(). + HasState(NS_DOCUMENT_STATE_RTL_LOCALE); + + nsDependentString dirString(aString); + + if (dirString.EqualsLiteral("rtl")) { + if (!docIsRTL) { + return false; + } + } else if (dirString.EqualsLiteral("ltr")) { + if (docIsRTL) { + return false; + } + } else { + // Selectors specifying other directions never match. + return false; + } + } + break; + + case CSSPseudoClassType::mozSystemMetric: + { + nsCOMPtr metric = NS_Atomize(aString); + if (!nsCSSRuleProcessor::HasSystemMetric(metric)) { + return false; + } + } + break; + + case CSSPseudoClassType::mozEmptyExceptChildrenWithLocalname: + { + NS_ASSERTION(aString, "Must have string!"); + nsIContent *child = nullptr; + int32_t index = -1; + + if (aForStyling) { + // FIXME: This isn't sufficient to handle: + // :-moz-empty-except-children-with-localname() + E + // :-moz-empty-except-children-with-localname() ~ E + // because we don't know to restyle the grandparent of the + // inserted/removed element (as in bug 534804 for :empty). + aElement->SetFlags(NODE_HAS_SLOW_SELECTOR); + } + do { + child = aElement->GetChildAt(++index); + } while (child && + (!IsSignificantChild(child, true, false) || + (child->GetNameSpaceID() == aElement->GetNameSpaceID() && + child->NodeInfo()->NameAtom()->Equals(nsDependentString(aString))))); + if (child) { + return false; + } + } + break; + + case CSSPseudoClassType::dir: + { + if (aDependence) { + EventStates states = sPseudoClassStateDependences[ + static_cast(aPseudo)]; + if (aStateMask.HasAtLeastOneOfStates(states)) { + *aDependence = true; + return false; + } + } + + // If we only had to consider HTML, directionality would be + // exclusively LTR or RTL. + // + // However, in markup languages where there is no direction attribute + // we have to consider the possibility that neither dir(rtl) nor + // dir(ltr) matches. + EventStates state = aElement->StyleState(); + nsDependentString dirString(aString); + + if (dirString.EqualsLiteral("rtl")) { + if (!state.HasState(NS_EVENT_STATE_RTL)) { + return false; + } + } else if (dirString.EqualsLiteral("ltr")) { + if (!state.HasState(NS_EVENT_STATE_LTR)) { + return false; + } + } else { + // Selectors specifying other directions never match. + return false; + } + } + break; + + case CSSPseudoClassType::lang: + { + NS_ASSERTION(aString, "null lang parameter"); + if (!aString || !*aString) { + return false; + } + + // We have to determine the language of the current element. Since + // this is currently no property and since the language is inherited + // from the parent we have to be prepared to look at all parent + // nodes. The language itself is encoded in the LANG attribute. + nsAutoString language; + if (aElement->GetLang(language)) { + if (!nsStyleUtil::DashMatchCompare(language, + nsDependentString(aString), + nsASCIICaseInsensitiveStringComparator())) { + return false; + } + // This pseudo-class matched; move on to the next thing + break; + } + + if (aDocument) { + // Try to get the language from the HTTP header or if this + // is missing as well from the preferences. + // The content language can be a comma-separated list of + // language codes. + aDocument->GetContentLanguage(language); + + nsDependentString langString(aString); + language.StripWhitespace(); + int32_t begin = 0; + int32_t len = language.Length(); + while (begin < len) { + int32_t end = language.FindChar(char16_t(','), begin); + if (end == kNotFound) { + end = len; + } + if (nsStyleUtil::DashMatchCompare(Substring(language, begin, + end-begin), + langString, + nsASCIICaseInsensitiveStringComparator())) { + break; + } + begin = end + 1; + } + if (begin < len) { + // This pseudo-class matched + break; + } + } + } + return false; + + default: MOZ_ASSERT_UNREACHABLE("Called StringPseudoMatches() with unknown string-like pseudo"); + } + return true; +} + // |aDependence| has two functions: // * when non-null, it indicates that we're processing a negation, // which is done only when SelectorMatches calls itself recursively @@ -1776,86 +1938,6 @@ static bool SelectorMatches(Element* aElement, } break; - case CSSPseudoClassType::mozEmptyExceptChildrenWithLocalname: - { - NS_ASSERTION(pseudoClass->u.mString, "Must have string!"); - nsIContent *child = nullptr; - int32_t index = -1; - - if (aTreeMatchContext.mForStyling) - // FIXME: This isn't sufficient to handle: - // :-moz-empty-except-children-with-localname() + E - // :-moz-empty-except-children-with-localname() ~ E - // because we don't know to restyle the grandparent of the - // inserted/removed element (as in bug 534804 for :empty). - aElement->SetFlags(NODE_HAS_SLOW_SELECTOR); - do { - child = aElement->GetChildAt(++index); - } while (child && - (!IsSignificantChild(child, true, false) || - (child->GetNameSpaceID() == aElement->GetNameSpaceID() && - child->NodeInfo()->NameAtom()->Equals(nsDependentString(pseudoClass->u.mString))))); - if (child != nullptr) { - return false; - } - } - break; - - case CSSPseudoClassType::lang: - { - NS_ASSERTION(nullptr != pseudoClass->u.mString, "null lang parameter"); - if (!pseudoClass->u.mString || !*pseudoClass->u.mString) { - return false; - } - - // We have to determine the language of the current element. Since - // this is currently no property and since the language is inherited - // from the parent we have to be prepared to look at all parent - // nodes. The language itself is encoded in the LANG attribute. - nsAutoString language; - if (aElement->GetLang(language)) { - if (!nsStyleUtil::DashMatchCompare(language, - nsDependentString(pseudoClass->u.mString), - nsASCIICaseInsensitiveStringComparator())) { - return false; - } - // This pseudo-class matched; move on to the next thing - break; - } - - nsIDocument* doc = aTreeMatchContext.mDocument; - if (doc) { - // Try to get the language from the HTTP header or if this - // is missing as well from the preferences. - // The content language can be a comma-separated list of - // language codes. - doc->GetContentLanguage(language); - - nsDependentString langString(pseudoClass->u.mString); - language.StripWhitespace(); - int32_t begin = 0; - int32_t len = language.Length(); - while (begin < len) { - int32_t end = language.FindChar(char16_t(','), begin); - if (end == kNotFound) { - end = len; - } - if (nsStyleUtil::DashMatchCompare(Substring(language, begin, - end-begin), - langString, - nsASCIICaseInsensitiveStringComparator())) { - break; - } - begin = end + 1; - } - if (begin < len) { - // This pseudo-class matched - break; - } - } - } - return false; - case CSSPseudoClassType::mozBoundElement: if (aTreeMatchContext.mScopedRoot != aElement) { return false; @@ -1999,38 +2081,6 @@ static bool SelectorMatches(Element* aElement, } break; - case CSSPseudoClassType::mozSystemMetric: - { - nsCOMPtr metric = NS_Atomize(pseudoClass->u.mString); - if (!nsCSSRuleProcessor::HasSystemMetric(metric)) { - return false; - } - } - break; - - case CSSPseudoClassType::mozLocaleDir: - { - bool docIsRTL = - aTreeMatchContext.mDocument->GetDocumentState(). - HasState(NS_DOCUMENT_STATE_RTL_LOCALE); - - nsDependentString dirString(pseudoClass->u.mString); - - if (dirString.EqualsLiteral("rtl")) { - if (!docIsRTL) { - return false; - } - } else if (dirString.EqualsLiteral("ltr")) { - if (docIsRTL) { - return false; - } - } else { - // Selectors specifying other directions never match. - return false; - } - } - break; - case CSSPseudoClassType::mozLWTheme: { if (aTreeMatchContext.mDocument->GetDocumentLWTheme() <= @@ -2065,41 +2115,6 @@ static bool SelectorMatches(Element* aElement, } break; - case CSSPseudoClassType::dir: - { - if (aDependence) { - EventStates states = sPseudoClassStateDependences[ - static_cast(pseudoClass->mType)]; - if (aNodeMatchContext.mStateMask.HasAtLeastOneOfStates(states)) { - *aDependence = true; - return false; - } - } - - // If we only had to consider HTML, directionality would be - // exclusively LTR or RTL. - // - // However, in markup languages where there is no direction attribute - // we have to consider the possibility that neither dir(rtl) nor - // dir(ltr) matches. - EventStates state = aElement->StyleState(); - nsDependentString dirString(pseudoClass->u.mString); - - if (dirString.EqualsLiteral("rtl")) { - if (!state.HasState(NS_EVENT_STATE_RTL)) { - return false; - } - } else if (dirString.EqualsLiteral("ltr")) { - if (!state.HasState(NS_EVENT_STATE_LTR)) { - return false; - } - } else { - // Selectors specifying other directions never match. - return false; - } - } - break; - case CSSPseudoClassType::scope: if (aTreeMatchContext.mForScopedStyle) { if (aTreeMatchContext.mCurrentStyleScope) { @@ -2124,7 +2139,20 @@ static bool SelectorMatches(Element* aElement, break; default: - MOZ_ASSERT(false, "How did that happen?"); + { + MOZ_ASSERT(nsCSSPseudoClasses::HasStringArg(pseudoClass->mType)); + bool matched = nsCSSRuleProcessor::StringPseudoMatches(aElement, + pseudoClass->mType, + pseudoClass->u.mString, + aTreeMatchContext.mDocument, + aTreeMatchContext.mForStyling, + aNodeMatchContext.mStateMask, + aDependence); + + if (!matched) { + return false; + } + } } } diff --git a/layout/style/nsCSSRuleProcessor.h b/layout/style/nsCSSRuleProcessor.h index e31078382e65..c729c3780dba 100644 --- a/layout/style/nsCSSRuleProcessor.h +++ b/layout/style/nsCSSRuleProcessor.h @@ -39,6 +39,7 @@ class nsCSSCounterStyleRule; namespace mozilla { class CSSStyleSheet; enum class CSSPseudoElementType : uint8_t; +enum class CSSPseudoClassType : uint8_t; namespace css { class DocumentRule; } // namespace css @@ -132,6 +133,36 @@ public: static bool RestrictedSelectorMatches(mozilla::dom::Element* aElement, nsCSSSelector* aSelector, TreeMatchContext& aTreeMatchContext); + /** + * Checks if a function-like ident-containing pseudo (:pseudo(ident)) + * matches a given element. + * + * Returns true if it parses and matches, Some(false) if it + * parses but does not match. Asserts if it fails to parse; only + * call this when you're sure it's a string-like pseudo. + * + * This will assert if the document has a stale document state, + * ensure that UpdatePossiblyStaleDocumentState() has been called + * first. + * + * @param aElement The element we are trying to match + * @param aPseudo The name of the pseudoselector + * @param aString The identifier inside the pseudoselector (cannot be null) + * @param aDocument The document + * @param aForStyling Is this matching operation for the creation of a style context? + * (For setting the slow selector flag) + * @param aStateMask Mask containing states which we should exclude. + * Ignored if aDependence is null + * @param aDependence Pointer to be set to true if we ignored a state due to + * aStateMask. Can be null. + */ + static bool StringPseudoMatches(mozilla::dom::Element* aElement, + mozilla::CSSPseudoClassType aPseudo, + char16_t* aString, + nsIDocument* aDocument, + bool aForStyling, + mozilla::EventStates aStateMask, + bool* const aDependence = nullptr); // nsIStyleRuleProcessor virtual void RulesMatching(ElementRuleProcessorData* aData) override; From 681045b70e289fb43bec69ec29491f6339ab87c5 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Thu, 16 Mar 2017 14:10:22 -0700 Subject: [PATCH 33/63] Bug 1341086 - Part 2: stylo: Support all non-ts pseudos with an argument; r=emilio,heycam MozReview-Commit-ID: IHjX2Q3k8eD --HG-- extra : rebase_source : 57df0f0e54fd1aa1ce4b304238c7070ef9af6dd4 --- dom/base/nsDocument.cpp | 16 ++++++++++++++-- dom/base/nsDocument.h | 8 +++++++- dom/base/nsIDocument.h | 1 + layout/style/ServoBindings.cpp | 13 +++++++++++++ layout/style/ServoBindings.h | 5 +++++ layout/style/ServoStyleSet.cpp | 14 ++++++++++++-- layout/style/ServoStyleSet.h | 2 ++ layout/style/nsCSSRuleProcessor.cpp | 28 +++++++++++++++++++++------- layout/style/nsCSSRuleProcessor.h | 12 ++++++------ 9 files changed, 81 insertions(+), 18 deletions(-) diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index b05ad121f579..f0d7ba38a0d3 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -9631,8 +9631,8 @@ nsDocument::ForgetImagePreload(nsIURI* aURI) } } -EventStates -nsDocument::GetDocumentState() +void +nsDocument::UpdatePossiblyStaleDocumentState() { if (!mGotDocumentState.HasState(NS_DOCUMENT_STATE_RTL_LOCALE)) { if (IsDocumentRightToLeft()) { @@ -9648,9 +9648,21 @@ nsDocument::GetDocumentState() } mGotDocumentState |= NS_DOCUMENT_STATE_WINDOW_INACTIVE; } +} + +EventStates +nsDocument::ThreadSafeGetDocumentState() const +{ return mDocumentState; } +EventStates +nsDocument::GetDocumentState() +{ + UpdatePossiblyStaleDocumentState(); + return ThreadSafeGetDocumentState(); +} + namespace { /** diff --git a/dom/base/nsDocument.h b/dom/base/nsDocument.h index 2dc245147f38..9ef1d404de77 100644 --- a/dom/base/nsDocument.h +++ b/dom/base/nsDocument.h @@ -980,7 +980,12 @@ public: virtual nsISupports* GetCurrentContentSink() override; - virtual mozilla::EventStates GetDocumentState() override; + virtual mozilla::EventStates GetDocumentState() final; + // GetDocumentState() mutates the state due to lazy resolution; + // and can't be used during parallel traversal. Use this instead, + // and ensure GetDocumentState() has been called first. + // This will assert if the state is stale. + virtual mozilla::EventStates ThreadSafeGetDocumentState() const final; // Only BlockOnload should call this! void AsyncBlockOnload(); @@ -1391,6 +1396,7 @@ protected: // caches its result here. mozilla::Maybe mIsThirdParty; private: + void UpdatePossiblyStaleDocumentState(); static bool CustomElementConstructor(JSContext* aCx, unsigned aArgc, JS::Value* aVp); /** diff --git a/dom/base/nsIDocument.h b/dom/base/nsIDocument.h index 04653474a288..add31264367e 100644 --- a/dom/base/nsIDocument.h +++ b/dom/base/nsIDocument.h @@ -2381,6 +2381,7 @@ public: * nsIDocument.h. */ virtual mozilla::EventStates GetDocumentState() = 0; + virtual mozilla::EventStates ThreadSafeGetDocumentState() const = 0; virtual nsISupports* GetCurrentContentSink() = 0; diff --git a/layout/style/ServoBindings.cpp b/layout/style/ServoBindings.cpp index c000b1547922..6cf695d671cd 100644 --- a/layout/style/ServoBindings.cpp +++ b/layout/style/ServoBindings.cpp @@ -486,6 +486,19 @@ nscolor Gecko_GetLookAndFeelSystemColor(int32_t aId, return result; } +bool +Gecko_MatchStringArgPseudo(RawGeckoElementBorrowed aElement, + CSSPseudoClassType aType, + const char16_t* aIdent, + bool* aSetSlowSelectorFlag) +{ + MOZ_ASSERT(aElement->OwnerDoc() == aElement->GetComposedDoc()); + EventStates dummyMask; // mask is never read because we pass aDependence=nullptr + return nsCSSRuleProcessor::StringPseudoMatches(aElement, aType, aIdent, + aElement->OwnerDoc(), true, + dummyMask, aSetSlowSelectorFlag, nullptr); +} + template static nsIAtom* AtomAttrValue(Implementor* aElement, nsIAtom* aName) diff --git a/layout/style/ServoBindings.h b/layout/style/ServoBindings.h index 4ebbf373f41c..2ccad0cb372f 100644 --- a/layout/style/ServoBindings.h +++ b/layout/style/ServoBindings.h @@ -377,6 +377,11 @@ const nsMediaFeature* Gecko_GetMediaFeatures(); nscolor Gecko_GetLookAndFeelSystemColor(int32_t color_id, RawGeckoPresContextBorrowed pres_context); +bool Gecko_MatchStringArgPseudo(RawGeckoElementBorrowed element, + mozilla::CSSPseudoClassType type, + const char16_t* ident, + bool* set_slow_selector); + // Style-struct management. #define STYLE_STRUCT(name, checkdata_cb) \ void Gecko_Construct_Default_nsStyle##name( \ diff --git a/layout/style/ServoStyleSet.cpp b/layout/style/ServoStyleSet.cpp index fb1de404afe9..454b673b37a8 100644 --- a/layout/style/ServoStyleSet.cpp +++ b/layout/style/ServoStyleSet.cpp @@ -148,7 +148,7 @@ ServoStyleSet::GetContext(nsIContent* aContent, Element* element = aContent->AsElement(); - ResolveMappedAttrDeclarationBlocks(); + PreTraverseSync(); RefPtr computedValues; if (aMayCompute == LazyComputeBehavior::Allow) { computedValues = ResolveStyleLazily(element, nullptr); @@ -190,10 +190,20 @@ ServoStyleSet::ResolveMappedAttrDeclarationBlocks() } void -ServoStyleSet::PreTraverse() +ServoStyleSet::PreTraverseSync() { ResolveMappedAttrDeclarationBlocks(); + // This is lazily computed and pseudo matching needs to access + // it so force computation early. + mPresContext->Document()->GetDocumentState(); +} + +void +ServoStyleSet::PreTraverse() +{ + PreTraverseSync(); + // Process animation stuff that we should avoid doing during the parallel // traversal. mPresContext->EffectCompositor()->PreTraverse(); diff --git a/layout/style/ServoStyleSet.h b/layout/style/ServoStyleSet.h index ad438720b877..49481f916ab9 100644 --- a/layout/style/ServoStyleSet.h +++ b/layout/style/ServoStyleSet.h @@ -286,6 +286,8 @@ private: * Perform processes that we should do before traversing. */ void PreTraverse(); + // Subset of the pre-traverse steps that involve syncing up data + void PreTraverseSync(); already_AddRefed ResolveStyleLazily(dom::Element* aElement, nsIAtom* aPseudoTag); diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp index 9f1d5a19d463..254070a03662 100644 --- a/layout/style/nsCSSRuleProcessor.cpp +++ b/layout/style/nsCSSRuleProcessor.cpp @@ -1638,20 +1638,29 @@ StateSelectorMatches(Element* aElement, } /* static */ bool -nsCSSRuleProcessor::StringPseudoMatches(mozilla::dom::Element* aElement, +nsCSSRuleProcessor::StringPseudoMatches(const mozilla::dom::Element* aElement, CSSPseudoClassType aPseudo, - char16_t* aString, - nsIDocument* aDocument, + const char16_t* aString, + const nsIDocument* aDocument, bool aForStyling, EventStates aStateMask, + bool* aSetSlowSelectorFlag, bool* const aDependence) { + MOZ_ASSERT(aSetSlowSelectorFlag); + switch (aPseudo) { case CSSPseudoClassType::mozLocaleDir: { - bool docIsRTL = - aDocument->GetDocumentState(). - HasState(NS_DOCUMENT_STATE_RTL_LOCALE); + bool docIsRTL; + if (aIsGecko) { + auto doc = const_cast(aDocument); + docIsRTL = doc->GetDocumentState() + .HasState(NS_DOCUMENT_STATE_RTL_LOCALE); + } else { + docIsRTL = aDocument->ThreadSafeGetDocumentState() + .HasState(NS_DOCUMENT_STATE_RTL_LOCALE); + } nsDependentString dirString(aString); @@ -1691,7 +1700,7 @@ nsCSSRuleProcessor::StringPseudoMatches(mozilla::dom::Element* aElement, // :-moz-empty-except-children-with-localname() ~ E // because we don't know to restyle the grandparent of the // inserted/removed element (as in bug 534804 for :empty). - aElement->SetFlags(NODE_HAS_SLOW_SELECTOR); + *aSetSlowSelectorFlag = true; } do { child = aElement->GetChildAt(++index); @@ -2141,13 +2150,18 @@ static bool SelectorMatches(Element* aElement, default: { MOZ_ASSERT(nsCSSPseudoClasses::HasStringArg(pseudoClass->mType)); + bool setSlowSelectorFlag = false; bool matched = nsCSSRuleProcessor::StringPseudoMatches(aElement, pseudoClass->mType, pseudoClass->u.mString, aTreeMatchContext.mDocument, aTreeMatchContext.mForStyling, aNodeMatchContext.mStateMask, + &setSlowSelectorFlag, aDependence); + if (setSlowSelectorFlag) { + aElement->SetFlags(NODE_HAS_SLOW_SELECTOR); + } if (!matched) { return false; diff --git a/layout/style/nsCSSRuleProcessor.h b/layout/style/nsCSSRuleProcessor.h index c729c3780dba..452985e8d161 100644 --- a/layout/style/nsCSSRuleProcessor.h +++ b/layout/style/nsCSSRuleProcessor.h @@ -141,9 +141,8 @@ public: * parses but does not match. Asserts if it fails to parse; only * call this when you're sure it's a string-like pseudo. * - * This will assert if the document has a stale document state, - * ensure that UpdatePossiblyStaleDocumentState() has been called - * first. + * In Servo mode, please ensure that UpdatePossiblyStaleDocumentState() + * has been called first. * * @param aElement The element we are trying to match * @param aPseudo The name of the pseudoselector @@ -156,12 +155,13 @@ public: * @param aDependence Pointer to be set to true if we ignored a state due to * aStateMask. Can be null. */ - static bool StringPseudoMatches(mozilla::dom::Element* aElement, + static bool StringPseudoMatches(const mozilla::dom::Element* aElement, mozilla::CSSPseudoClassType aPseudo, - char16_t* aString, - nsIDocument* aDocument, + const char16_t* aString, + const nsIDocument* aDocument, bool aForStyling, mozilla::EventStates aStateMask, + bool* aSetSlowSelectorFlag, bool* const aDependence = nullptr); // nsIStyleRuleProcessor From 16276b38cda83b946e95c995bdb0ef50fe2cceae Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Thu, 16 Mar 2017 14:10:22 -0700 Subject: [PATCH 34/63] Bug 1341086 - Part 3: stylo: Add thread-safe version of nsStyleUtil::IsSignificantChild(); r=emilio MozReview-Commit-ID: 3l8cNwDHKFl --HG-- extra : rebase_source : af2ed1c345991c894d482193a1fb654bd6a7ba69 --- dom/base/FragmentOrElement.cpp | 6 ++++++ dom/base/FragmentOrElement.h | 1 + dom/base/nsGenericDOMDataNode.cpp | 18 +++++++++++++++--- dom/base/nsGenericDOMDataNode.h | 1 + dom/base/nsIContent.h | 5 +++++ layout/style/ServoBindings.cpp | 3 +-- layout/style/nsCSSRuleProcessor.cpp | 26 ++++++++++++++++++++++++-- layout/style/nsCSSRuleProcessor.h | 4 ++++ layout/style/nsStyleUtil.cpp | 20 ++++++++++++++++++++ layout/style/nsStyleUtil.h | 7 +++++++ 10 files changed, 84 insertions(+), 7 deletions(-) diff --git a/dom/base/FragmentOrElement.cpp b/dom/base/FragmentOrElement.cpp index da88c85d4f5a..22fdac2d121d 100644 --- a/dom/base/FragmentOrElement.cpp +++ b/dom/base/FragmentOrElement.cpp @@ -2071,6 +2071,12 @@ FragmentOrElement::TextIsOnlyWhitespace() return false; } +bool +FragmentOrElement::ThreadSafeTextIsOnlyWhitespace() const +{ + return false; +} + bool FragmentOrElement::HasTextForTranslation() { diff --git a/dom/base/FragmentOrElement.h b/dom/base/FragmentOrElement.h index fe5d8258c389..251b58298ebf 100644 --- a/dom/base/FragmentOrElement.h +++ b/dom/base/FragmentOrElement.h @@ -143,6 +143,7 @@ public: virtual nsresult AppendText(const char16_t* aBuffer, uint32_t aLength, bool aNotify) override; virtual bool TextIsOnlyWhitespace() override; + virtual bool ThreadSafeTextIsOnlyWhitespace() const override; virtual bool HasTextForTranslation() override; virtual void AppendTextTo(nsAString& aResult) override; MOZ_MUST_USE diff --git a/dom/base/nsGenericDOMDataNode.cpp b/dom/base/nsGenericDOMDataNode.cpp index ca15ae209735..84f5dc8c7f3a 100644 --- a/dom/base/nsGenericDOMDataNode.cpp +++ b/dom/base/nsGenericDOMDataNode.cpp @@ -982,6 +982,21 @@ nsGenericDOMDataNode::AppendText(const char16_t* aBuffer, bool nsGenericDOMDataNode::TextIsOnlyWhitespace() +{ + + MOZ_ASSERT(NS_IsMainThread()); + if (!ThreadSafeTextIsOnlyWhitespace()) { + UnsetFlags(NS_TEXT_IS_ONLY_WHITESPACE); + SetFlags(NS_CACHED_TEXT_IS_ONLY_WHITESPACE); + return false; + } + + SetFlags(NS_CACHED_TEXT_IS_ONLY_WHITESPACE | NS_TEXT_IS_ONLY_WHITESPACE); + return true; +} + +bool +nsGenericDOMDataNode::ThreadSafeTextIsOnlyWhitespace() const { // FIXME: should this method take content language into account? if (mText.Is2b()) { @@ -1001,15 +1016,12 @@ nsGenericDOMDataNode::TextIsOnlyWhitespace() char ch = *cp; if (!dom::IsSpaceCharacter(ch)) { - UnsetFlags(NS_TEXT_IS_ONLY_WHITESPACE); - SetFlags(NS_CACHED_TEXT_IS_ONLY_WHITESPACE); return false; } ++cp; } - SetFlags(NS_CACHED_TEXT_IS_ONLY_WHITESPACE | NS_TEXT_IS_ONLY_WHITESPACE); return true; } diff --git a/dom/base/nsGenericDOMDataNode.h b/dom/base/nsGenericDOMDataNode.h index ad3b9f93d763..43c9c33ff796 100644 --- a/dom/base/nsGenericDOMDataNode.h +++ b/dom/base/nsGenericDOMDataNode.h @@ -136,6 +136,7 @@ public: virtual nsresult AppendText(const char16_t* aBuffer, uint32_t aLength, bool aNotify) override; virtual bool TextIsOnlyWhitespace() override; + virtual bool ThreadSafeTextIsOnlyWhitespace() const final; virtual bool HasTextForTranslation() override; virtual void AppendTextTo(nsAString& aResult) override; MOZ_MUST_USE diff --git a/dom/base/nsIContent.h b/dom/base/nsIContent.h index 3f304e7c7fbb..1d42967c3dd0 100644 --- a/dom/base/nsIContent.h +++ b/dom/base/nsIContent.h @@ -558,6 +558,11 @@ public: */ virtual bool TextIsOnlyWhitespace() = 0; + /** + * Thread-safe version of TextIsOnlyWhitespace. + */ + virtual bool ThreadSafeTextIsOnlyWhitespace() const = 0; + /** * Method to see if the text node contains data that is useful * for a translation: i.e., it consists of more than just whitespace, diff --git a/layout/style/ServoBindings.cpp b/layout/style/ServoBindings.cpp index 6cf695d671cd..12ffec81f03d 100644 --- a/layout/style/ServoBindings.cpp +++ b/layout/style/ServoBindings.cpp @@ -492,11 +492,10 @@ Gecko_MatchStringArgPseudo(RawGeckoElementBorrowed aElement, const char16_t* aIdent, bool* aSetSlowSelectorFlag) { - MOZ_ASSERT(aElement->OwnerDoc() == aElement->GetComposedDoc()); EventStates dummyMask; // mask is never read because we pass aDependence=nullptr return nsCSSRuleProcessor::StringPseudoMatches(aElement, aType, aIdent, aElement->OwnerDoc(), true, - dummyMask, aSetSlowSelectorFlag, nullptr); + dummyMask, false, aSetSlowSelectorFlag, nullptr); } template diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp index 254070a03662..1c2e4351589a 100644 --- a/layout/style/nsCSSRuleProcessor.cpp +++ b/layout/style/nsCSSRuleProcessor.cpp @@ -1637,6 +1637,26 @@ StateSelectorMatches(Element* aElement, return true; } +// Chooses the thread safe version in Servo mode, and +// the non-thread safe one in Gecko mode. The non thread safe one does +// some extra caching, and is preferred when possible. +static inline bool +IsSignificantChildMaybeThreadSafe(const nsIContent* aContent, + bool aTextIsSignificant, + bool aWhitespaceIsSignificant, + bool aIsGecko) +{ + if (aIsGecko) { + auto content = const_cast(aContent); + return IsSignificantChild(content, aTextIsSignificant, aWhitespaceIsSignificant); + } else { + // See bug 1349100 for optimizing this + return nsStyleUtil::ThreadSafeIsSignificantChild(aContent, + aTextIsSignificant, + aWhitespaceIsSignificant); + } +} + /* static */ bool nsCSSRuleProcessor::StringPseudoMatches(const mozilla::dom::Element* aElement, CSSPseudoClassType aPseudo, @@ -1644,6 +1664,7 @@ nsCSSRuleProcessor::StringPseudoMatches(const mozilla::dom::Element* aElement, const nsIDocument* aDocument, bool aForStyling, EventStates aStateMask, + bool aIsGecko, bool* aSetSlowSelectorFlag, bool* const aDependence) { @@ -1691,7 +1712,7 @@ nsCSSRuleProcessor::StringPseudoMatches(const mozilla::dom::Element* aElement, case CSSPseudoClassType::mozEmptyExceptChildrenWithLocalname: { NS_ASSERTION(aString, "Must have string!"); - nsIContent *child = nullptr; + const nsIContent *child = nullptr; int32_t index = -1; if (aForStyling) { @@ -1705,7 +1726,7 @@ nsCSSRuleProcessor::StringPseudoMatches(const mozilla::dom::Element* aElement, do { child = aElement->GetChildAt(++index); } while (child && - (!IsSignificantChild(child, true, false) || + (!IsSignificantChildMaybeThreadSafe(child, true, false, aIsGecko) || (child->GetNameSpaceID() == aElement->GetNameSpaceID() && child->NodeInfo()->NameAtom()->Equals(nsDependentString(aString))))); if (child) { @@ -2157,6 +2178,7 @@ static bool SelectorMatches(Element* aElement, aTreeMatchContext.mDocument, aTreeMatchContext.mForStyling, aNodeMatchContext.mStateMask, + true, &setSlowSelectorFlag, aDependence); if (setSlowSelectorFlag) { diff --git a/layout/style/nsCSSRuleProcessor.h b/layout/style/nsCSSRuleProcessor.h index 452985e8d161..dbf31c82783e 100644 --- a/layout/style/nsCSSRuleProcessor.h +++ b/layout/style/nsCSSRuleProcessor.h @@ -152,6 +152,9 @@ public: * (For setting the slow selector flag) * @param aStateMask Mask containing states which we should exclude. * Ignored if aDependence is null + * @param aIsGecko Set if Gecko. + * @param aSetSlowSelectorFlag Outparam, set if the caller is + * supposed to set the slow selector flag. * @param aDependence Pointer to be set to true if we ignored a state due to * aStateMask. Can be null. */ @@ -161,6 +164,7 @@ public: const nsIDocument* aDocument, bool aForStyling, mozilla::EventStates aStateMask, + bool aIsGecko, bool* aSetSlowSelectorFlag, bool* const aDependence = nullptr); diff --git a/layout/style/nsStyleUtil.cpp b/layout/style/nsStyleUtil.cpp index 848c5ddb4170..fc4c9007f50e 100644 --- a/layout/style/nsStyleUtil.cpp +++ b/layout/style/nsStyleUtil.cpp @@ -741,6 +741,26 @@ nsStyleUtil::IsSignificantChild(nsIContent* aChild, bool aTextIsSignificant, !aChild->TextIsOnlyWhitespace()); } +/* static */ bool +nsStyleUtil::ThreadSafeIsSignificantChild(const nsIContent* aChild, + bool aTextIsSignificant, + bool aWhitespaceIsSignificant) +{ + NS_ASSERTION(!aWhitespaceIsSignificant || aTextIsSignificant, + "Nonsensical arguments"); + + bool isText = aChild->IsNodeOfType(nsINode::eTEXT); + + if (!isText && !aChild->IsNodeOfType(nsINode::eCOMMENT) && + !aChild->IsNodeOfType(nsINode::ePROCESSING_INSTRUCTION)) { + return true; + } + + return aTextIsSignificant && isText && aChild->TextLength() != 0 && + (aWhitespaceIsSignificant || + !aChild->ThreadSafeTextIsOnlyWhitespace()); +} + // For a replaced element whose concrete object size is no larger than the // element's content-box, this method checks whether the given // "object-position" coordinate might cause overflow in its dimension. diff --git a/layout/style/nsStyleUtil.h b/layout/style/nsStyleUtil.h index 55b7c556a011..24811f80151e 100644 --- a/layout/style/nsStyleUtil.h +++ b/layout/style/nsStyleUtil.h @@ -138,6 +138,13 @@ public: static bool IsSignificantChild(nsIContent* aChild, bool aTextIsSignificant, bool aWhitespaceIsSignificant); + + /* + * Thread-safe version of IsSignificantChild() + */ + static bool ThreadSafeIsSignificantChild(const nsIContent* aChild, + bool aTextIsSignificant, + bool aWhitespaceIsSignificant); /** * Returns true if our object-fit & object-position properties might cause * a replaced element's contents to overflow its content-box (requiring From abf960138ed2916598f8550ac52212bbc917143e Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Thu, 16 Mar 2017 14:10:22 -0700 Subject: [PATCH 35/63] Bug 1341086 - Part 4: stylo: Update test expectations; r=manishearth MozReview-Commit-ID: KXJ22Ov6Yxi --HG-- extra : rebase_source : 8970638c80fd2b2240ead389bfc24df050cfcf01 --- layout/reftests/bidi/dirAuto/reftest-stylo.list | 4 ++-- layout/reftests/bidi/reftest-stylo.list | 8 ++++---- layout/reftests/bugs/reftest-stylo.list | 2 +- layout/reftests/w3c-css/received/reftest-stylo.list | 4 ++-- .../w3c-css/submitted/selectors4/reftest-stylo.list | 8 ++++---- layout/reftests/writing-mode/reftest-stylo.list | 4 ++-- layout/style/test/stylo-failures.md | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/layout/reftests/bidi/dirAuto/reftest-stylo.list b/layout/reftests/bidi/dirAuto/reftest-stylo.list index 994952d0fc49..32ca74d515ed 100644 --- a/layout/reftests/bidi/dirAuto/reftest-stylo.list +++ b/layout/reftests/bidi/dirAuto/reftest-stylo.list @@ -1,5 +1,5 @@ # DO NOT EDIT! This is a auto-generated temporary list for Stylo testing -fails == bdi-auto-dir-default.html bdi-auto-dir-default.html +== bdi-auto-dir-default.html bdi-auto-dir-default.html fails == dir_auto-set-contained-dir-L.html dir_auto-set-contained-dir-L.html fails == dir_auto-set-contained-dir-R.html dir_auto-set-contained-dir-R.html fails == dir_auto-set-contained-invalid-dir-L.html dir_auto-set-contained-invalid-dir-L.html @@ -112,7 +112,7 @@ fails == dynamicDirAuto-DeleteText-RTL2.html dynamicDirAuto-DeleteText-RTL2.html fails == dynamicDirAuto-DeleteText-RTL3.html dynamicDirAuto-DeleteText-RTL3.html fails == 839886-1.html 839886-1.html == 859093-1.html 859093-1.html -fails == 889742-1.html 889742-1.html +== 889742-1.html 889742-1.html fails == 1103348-1.html 1103348-1.html fails == 1169267-delete-add-1a.html 1169267-delete-add-1a.html fails == 1169267-delete-add-1b.html 1169267-delete-add-1b.html diff --git a/layout/reftests/bidi/reftest-stylo.list b/layout/reftests/bidi/reftest-stylo.list index 41765a12df71..0cc9fc5eb6dc 100644 --- a/layout/reftests/bidi/reftest-stylo.list +++ b/layout/reftests/bidi/reftest-stylo.list @@ -99,13 +99,13 @@ fails == 413928-2.html 413928-2.html == 503957-1.html 503957-1.html == 525740-1.html 525740-1.html fails == 536963-1.html 536963-1.html -fails == 562169-1.html 562169-1.html +== 562169-1.html 562169-1.html fails == 562169-1a.html 562169-1a.html -fails == 562169-2.html 562169-2.html +== 562169-2.html 562169-2.html fails == 562169-2a.html 562169-2a.html == 562169-3.html 562169-3.html -== 562169-3a.html 562169-3a.html -fails == 562169-4.html 562169-4.html +fails == 562169-3a.html 562169-3a.html # bug 1338982 +== 562169-4.html 562169-4.html == 588739-1.html 588739-1.html == 588739-2.html 588739-2.html == 588739-3.html 588739-3.html diff --git a/layout/reftests/bugs/reftest-stylo.list b/layout/reftests/bugs/reftest-stylo.list index 3ba1f024e7dc..29d2152eb4f7 100644 --- a/layout/reftests/bugs/reftest-stylo.list +++ b/layout/reftests/bugs/reftest-stylo.list @@ -1652,7 +1652,7 @@ fails == 622585-1.html 622585-1.html == 625409-1.html 625409-1.html == 627393-1.html 627393-1.html fuzzy-if(skiaContent,1,500) == 630835-1.html 630835-1.html -== 631352-1.html 631352-1.html +fails == 631352-1.html 631352-1.html == 632423-1.html 632423-1.html skip-if(Android) random-if(winWidget||OSX==1010) == 632781-verybig.html 632781-verybig.html == 632781-normalsize.html 632781-normalsize.html diff --git a/layout/reftests/w3c-css/received/reftest-stylo.list b/layout/reftests/w3c-css/received/reftest-stylo.list index b39d14a6afad..36d21d6362e3 100644 --- a/layout/reftests/w3c-css/received/reftest-stylo.list +++ b/layout/reftests/w3c-css/received/reftest-stylo.list @@ -254,5 +254,5 @@ skip-if(stylo) pref(dom.webcomponents.enabled,true) needs-focus == selectors-4/f skip-if(stylo) pref(dom.webcomponents.enabled,true) needs-focus == selectors-4/focus-within-shadow-005.html selectors-4/focus-within-shadow-005.html # Bug 1292285 == selectors-4/of-type-selectors.xhtml selectors-4/of-type-selectors.xhtml fails == selectors-4/selector-required.html selectors-4/selector-required.html -fails == selectors-4/selectors-dir-selector-ltr-001.html selectors-4/selectors-dir-selector-ltr-001.html -fails == selectors-4/selectors-dir-selector-rtl-001.html selectors-4/selectors-dir-selector-rtl-001.html +== selectors-4/selectors-dir-selector-ltr-001.html selectors-4/selectors-dir-selector-ltr-001.html +== selectors-4/selectors-dir-selector-rtl-001.html selectors-4/selectors-dir-selector-rtl-001.html diff --git a/layout/reftests/w3c-css/submitted/selectors4/reftest-stylo.list b/layout/reftests/w3c-css/submitted/selectors4/reftest-stylo.list index 52d5cc5c581b..8914fa8fda40 100644 --- a/layout/reftests/w3c-css/submitted/selectors4/reftest-stylo.list +++ b/layout/reftests/w3c-css/submitted/selectors4/reftest-stylo.list @@ -2,11 +2,11 @@ fails needs-focus == focus-within-1.html focus-within-1.html needs-focus == focus-within-2.html focus-within-2.html fails needs-focus == focus-within-3.html focus-within-3.html -fails == dir-style-01a.html dir-style-01a.html +== dir-style-01a.html dir-style-01a.html fails == dir-style-01b.html dir-style-01b.html -fails == dir-style-02a.html dir-style-02a.html +== dir-style-02a.html dir-style-02a.html fails == dir-style-02b.html dir-style-02b.html -fails == dir-style-03a.html dir-style-03a.html +== dir-style-03a.html dir-style-03a.html fails == dir-style-03b.html dir-style-03b.html -fails == dir-style-04.html dir-style-04.html +== dir-style-04.html dir-style-04.html == child-index-no-parent-01.html child-index-no-parent-01.html diff --git a/layout/reftests/writing-mode/reftest-stylo.list b/layout/reftests/writing-mode/reftest-stylo.list index ef7aa907d984..19088cdb55df 100644 --- a/layout/reftests/writing-mode/reftest-stylo.list +++ b/layout/reftests/writing-mode/reftest-stylo.list @@ -48,8 +48,8 @@ fails == 1124636-2-fieldset-min-height.html 1124636-2-fieldset-min-height.html fails == ua-style-sheet-margin-6.html ua-style-sheet-margin-6.html fails == ua-style-sheet-margin-7.html ua-style-sheet-margin-7.html == ua-style-sheet-margin-8.html ua-style-sheet-margin-8.html -fails == ua-style-sheet-margin-9.html ua-style-sheet-margin-9.html -fails == ua-style-sheet-margin-10.html ua-style-sheet-margin-10.html +== ua-style-sheet-margin-9.html ua-style-sheet-margin-9.html +== ua-style-sheet-margin-10.html ua-style-sheet-margin-10.html == ua-style-sheet-margin-11.html ua-style-sheet-margin-11.html == ua-style-sheet-margin-12.html ua-style-sheet-margin-12.html == ua-style-sheet-margin-13.html ua-style-sheet-margin-13.html diff --git a/layout/style/test/stylo-failures.md b/layout/style/test/stylo-failures.md index 38f65ce361e7..e04f0f2966c5 100644 --- a/layout/style/test/stylo-failures.md +++ b/layout/style/test/stylo-failures.md @@ -490,7 +490,7 @@ to mochitest command. * test_selectors_on_anonymous_content.html: xbl and :nth-child [1] * test_variables.html `url`: url in custom property [1] * test_pseudoelement_state.html: doesn't seem to work at all, but only range-thumb fails... [4] -* test_parse_rule.html `rgb(0, 128, 0)`: color properties not getting computed [8] +* test_parse_rule.html `rgb(0, 128, 0)`: color properties not getting computed [6] ## Ignore From 9a58410ee2bd9153b709a17575bd36eeeb424078 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Tue, 21 Mar 2017 20:57:15 +0900 Subject: [PATCH 36/63] Bug 1349178 Make nsIEditor.transactionManager readonly r=m_kato There are no app which replaces transaction manager of editor. Additionally, replacing transaction manager of an editor with different editor or same editor but after initialized again due to some reasons may cause unexpected problems. Therefore, this patch makes it readonly. MozReview-Commit-ID: K7zepOjrzvC --HG-- extra : rebase_source : ee1944af57c8102628b8cffbc720d2b8e5e9088d --- editor/libeditor/EditorBase.cpp | 10 ---------- editor/nsIEditor.idl | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/editor/libeditor/EditorBase.cpp b/editor/libeditor/EditorBase.cpp index af34d781f77c..39f77a398110 100644 --- a/editor/libeditor/EditorBase.cpp +++ b/editor/libeditor/EditorBase.cpp @@ -787,16 +787,6 @@ EditorBase::GetTransactionManager(nsITransactionManager** aTxnManager) return NS_OK; } -NS_IMETHODIMP -EditorBase::SetTransactionManager(nsITransactionManager* aTxnManager) -{ - NS_ENSURE_TRUE(aTxnManager, NS_ERROR_FAILURE); - - // nsITransactionManager is builtinclass, so this is safe - mTxnMgr = static_cast(aTxnManager); - return NS_OK; -} - NS_IMETHODIMP EditorBase::Undo(uint32_t aCount) { diff --git a/editor/nsIEditor.idl b/editor/nsIEditor.idl index 0f2177d18df9..d05f4a1decf1 100644 --- a/editor/nsIEditor.idl +++ b/editor/nsIEditor.idl @@ -172,7 +172,7 @@ interface nsIEditor : nsISupports /** transactionManager Get the transaction manager the editor is using. */ - attribute nsITransactionManager transactionManager; + readonly attribute nsITransactionManager transactionManager; /** doTransaction() fires a transaction. * It is provided here so clients can create their own transactions. From 6d7fe5d8b44d3e225b4ef4cf098907c535ab600c Mon Sep 17 00:00:00 2001 From: Gregory Terzian Date: Tue, 21 Mar 2017 21:17:25 -0700 Subject: [PATCH 37/63] servo: Merge #15519 - implement structured clone callbacks - support Blob cloning (from gterzian:implement_structuredclone_callbacks); r=jdm 1. Implement stubs for structured clone callbacks. 2. Support Blob cloning. Partial implementation of https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #15021 (github issue number if applicable). - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ Source-Repo: https://github.com/servo/servo Source-Revision: 7be9f0e7c4f16c5626180c3a6b07abdecea408fe --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 44af08347e9decac9e79de75e5941627fb2cad6f --- .../script/dom/bindings/structuredclone.rs | 169 +++++++++++++++++- servo/components/script/dom/blob.rs | 5 + 2 files changed, 167 insertions(+), 7 deletions(-) diff --git a/servo/components/script/dom/bindings/structuredclone.rs b/servo/components/script/dom/bindings/structuredclone.rs index 405d245c4bb7..ed3cf6aa6e2d 100644 --- a/servo/components/script/dom/bindings/structuredclone.rs +++ b/servo/components/script/dom/bindings/structuredclone.rs @@ -5,15 +5,164 @@ //! This module implements structured cloning, as defined by [HTML] //! (https://html.spec.whatwg.org/multipage/#safe-passing-of-structured-data). +use dom::bindings::conversions::root_from_handleobject; use dom::bindings::error::{Error, Fallible}; +use dom::bindings::js::Root; +use dom::bindings::reflector::DomObject; +use dom::blob::{Blob, BlobImpl}; use dom::globalscope::GlobalScope; -use js::jsapi::{HandleValue, MutableHandleValue}; -use js::jsapi::{JSContext, JS_ReadStructuredClone, JS_STRUCTURED_CLONE_VERSION}; -use js::jsapi::{JS_ClearPendingException, JS_WriteStructuredClone}; +use js::jsapi::{Handle, HandleObject, HandleValue, MutableHandleValue, JSAutoCompartment, JSContext}; +use js::jsapi::{JSStructuredCloneCallbacks, JSStructuredCloneReader, JSStructuredCloneWriter}; +use js::jsapi::{JS_ClearPendingException, JSObject, JS_ReadStructuredClone}; +use js::jsapi::{JS_ReadBytes, JS_WriteBytes}; +use js::jsapi::{JS_ReadUint32Pair, JS_WriteUint32Pair}; +use js::jsapi::{JS_STRUCTURED_CLONE_VERSION, JS_WriteStructuredClone}; +use js::jsapi::{MutableHandleObject, TransferableOwnership}; use libc::size_t; +use std::os::raw; use std::ptr; use std::slice; +// TODO: Should we add Min and Max const to https://github.com/servo/rust-mozjs/blob/master/src/consts.rs? +// TODO: Determine for sure which value Min and Max should have. +// NOTE: Current values found at https://dxr.mozilla.org/mozilla-central/ +// rev/ff04d410e74b69acfab17ef7e73e7397602d5a68/js/public/StructuredClone.h#323 +#[repr(u32)] +enum StructuredCloneTags { + /// To support additional types, add new tags with values incremented from the last one before Max. + Min = 0xFFFF8000, + DomBlob = 0xFFFF8001, + Max = 0xFFFFFFFF, +} + +#[cfg(target_pointer_width = "64")] +unsafe fn write_length(w: *mut JSStructuredCloneWriter, + length: usize) { + let high: u32 = (length >> 32) as u32; + let low: u32 = length as u32; + assert!(JS_WriteUint32Pair(w, high, low)); +} + +#[cfg(target_pointer_width = "32")] +unsafe fn write_length(w: *mut JSStructuredCloneWriter, + length: usize) { + assert!(JS_WriteUint32Pair(w, length as u32, 0)); +} + +#[cfg(target_pointer_width = "64")] +unsafe fn read_length(r: *mut JSStructuredCloneReader) + -> usize { + let mut high: u32 = 0; + let mut low: u32 = 0; + assert!(JS_ReadUint32Pair(r, &mut high as *mut u32, &mut low as *mut u32)); + return (low << high) as usize; +} + +#[cfg(target_pointer_width = "32")] +unsafe fn read_length(r: *mut JSStructuredCloneReader) + -> usize { + let mut length: u32 = 0; + let mut zero: u32 = 0; + assert!(JS_ReadUint32Pair(r, &mut length as *mut u32, &mut zero as *mut u32)); + return length as usize; +} + +unsafe fn read_blob(cx: *mut JSContext, + r: *mut JSStructuredCloneReader) + -> *mut JSObject { + let blob_length = read_length(r); + let type_str_length = read_length(r); + let mut blob_buffer = vec![0u8; blob_length]; + assert!(JS_ReadBytes(r, blob_buffer.as_mut_ptr() as *mut raw::c_void, blob_length)); + let mut type_str_buffer = vec![0u8; type_str_length]; + assert!(JS_ReadBytes(r, type_str_buffer.as_mut_ptr() as *mut raw::c_void, type_str_length)); + let type_str = String::from_utf8_unchecked(type_str_buffer); + let target_global = GlobalScope::from_context(cx); + let blob = Blob::new(&target_global, BlobImpl::new_from_bytes(blob_buffer), type_str); + return blob.reflector().get_jsobject().get() +} + +unsafe fn write_blob(blob: Root, + w: *mut JSStructuredCloneWriter) + -> Result<(), ()> { + let blob_vec = try!(blob.get_bytes()); + let blob_length = blob_vec.len(); + let type_string_bytes = blob.get_type_string().as_bytes().to_vec(); + let type_string_length = type_string_bytes.len(); + assert!(JS_WriteUint32Pair(w, StructuredCloneTags::DomBlob as u32, 0)); + write_length(w, blob_length); + write_length(w, type_string_length); + assert!(JS_WriteBytes(w, blob_vec.as_ptr() as *const raw::c_void, blob_length)); + assert!(JS_WriteBytes(w, type_string_bytes.as_ptr() as *const raw::c_void, type_string_length)); + return Ok(()) +} + +unsafe extern "C" fn read_callback(cx: *mut JSContext, + r: *mut JSStructuredCloneReader, + tag: u32, + _data: u32, + _closure: *mut raw::c_void) + -> *mut JSObject { + assert!(tag < StructuredCloneTags::Max as u32, "tag should be lower than StructuredCloneTags::Max"); + assert!(tag > StructuredCloneTags::Min as u32, "tag should be higher than StructuredCloneTags::Min"); + if tag == StructuredCloneTags::DomBlob as u32 { + return read_blob(cx, r) + } + return ptr::null_mut() +} + +unsafe extern "C" fn write_callback(_cx: *mut JSContext, + w: *mut JSStructuredCloneWriter, + obj: HandleObject, + _closure: *mut raw::c_void) + -> bool { + if let Ok(blob) = root_from_handleobject::(obj) { + return write_blob(blob, w).is_ok() + } + return false +} + +unsafe extern "C" fn read_transfer_callback(_cx: *mut JSContext, + _r: *mut JSStructuredCloneReader, + _tag: u32, + _content: *mut raw::c_void, + _extra_data: u64, + _closure: *mut raw::c_void, + _return_object: MutableHandleObject) + -> bool { + false +} + +unsafe extern "C" fn write_transfer_callback(_cx: *mut JSContext, + _obj: Handle<*mut JSObject>, + _closure: *mut raw::c_void, + _tag: *mut u32, + _ownership: *mut TransferableOwnership, + _content: *mut *mut raw::c_void, + _extra_data: *mut u64) + -> bool { + false +} + +unsafe extern "C" fn free_transfer_callback(_tag: u32, + _ownership: TransferableOwnership, + _content: *mut raw::c_void, + _extra_data: u64, + _closure: *mut raw::c_void) { +} + +unsafe extern "C" fn report_error_callback(_cx: *mut JSContext, _errorid: u32) { +} + +static STRUCTURED_CLONE_CALLBACKS: JSStructuredCloneCallbacks = JSStructuredCloneCallbacks { + read: Some(read_callback), + write: Some(write_callback), + reportError: Some(report_error_callback), + readTransfer: Some(read_transfer_callback), + writeTransfer: Some(write_transfer_callback), + freeTransfer: Some(free_transfer_callback), +}; + /// A buffer for a structured clone. pub enum StructuredCloneData { /// A non-serializable (default) variant @@ -32,7 +181,7 @@ impl StructuredCloneData { message, &mut data, &mut nbytes, - ptr::null(), + &STRUCTURED_CLONE_CALLBACKS, ptr::null_mut(), HandleValue::undefined()) }; @@ -60,14 +209,20 @@ impl StructuredCloneData { /// Reads a structured clone. /// /// Panics if `JS_ReadStructuredClone` fails. - fn read_clone(global: &GlobalScope, data: *mut u64, nbytes: size_t, rval: MutableHandleValue) { + fn read_clone(global: &GlobalScope, + data: *mut u64, + nbytes: size_t, + rval: MutableHandleValue) { + let cx = global.get_cx(); + let globalhandle = global.reflector().get_jsobject(); + let _ac = JSAutoCompartment::new(cx, globalhandle.get()); unsafe { - assert!(JS_ReadStructuredClone(global.get_cx(), + assert!(JS_ReadStructuredClone(cx, data, nbytes, JS_STRUCTURED_CLONE_VERSION, rval, - ptr::null(), + &STRUCTURED_CLONE_CALLBACKS, ptr::null_mut())); } } diff --git a/servo/components/script/dom/blob.rs b/servo/components/script/dom/blob.rs index 036dcfab4835..d8ed5fa1b64b 100644 --- a/servo/components/script/dom/blob.rs +++ b/servo/components/script/dom/blob.rs @@ -163,6 +163,11 @@ impl Blob { } } + /// Get a copy of the type_string + pub fn get_type_string(&self) -> String { + self.type_string.clone() + } + /// Get a FileID representing the Blob content, /// used by URL.createObjectURL pub fn get_blob_url_id(&self) -> Uuid { From 16207207f136e18e1769166c77b74247da95c088 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sun, 19 Mar 2017 22:46:19 -0700 Subject: [PATCH 38/63] Bug 1348666: Don't nuke cross-compartment wrappers for ScriptSourceObjects. r=shu When destroying add-on compartments, we generally nuke all wrappers in or out of the compartment. However, when cloning a script into a compartment, we store its source object as a wrapper into the original compartment, and the JS runtime expects that wrapper to remain valid. This change simply exempts all objects of that type from nuking. MozReview-Commit-ID: L70QqkbuX3h --HG-- extra : rebase_source : 5eb751c4113b133ec8dd660cb8a9003da7e15aa1 --- js/src/proxy/CrossCompartmentWrapper.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/js/src/proxy/CrossCompartmentWrapper.cpp b/js/src/proxy/CrossCompartmentWrapper.cpp index 26c5d1a57f59..ed00594b5386 100644 --- a/js/src/proxy/CrossCompartmentWrapper.cpp +++ b/js/src/proxy/CrossCompartmentWrapper.cpp @@ -543,6 +543,12 @@ js::NukeCrossCompartmentWrappers(JSContext* cx, AutoWrapperRooter wobj(cx, WrapperValue(e)); JSObject* wrapped = UncheckedUnwrap(wobj); + // We never nuke script source objects, since only ever used internally by the JS + // engine, and are expected to remain valid throughout a scripts lifetime. + if (MOZ_UNLIKELY(wrapped->is())) { + continue; + } + // We only skip nuking window references that point to a target // compartment, not the ones that belong to it. if (nukeReferencesToWindow == DontNukeWindowReferences && From 7eea9c329581204f0c636fd4aa62a468c6f411a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Naz=C4=B1m=20Can=20Alt=C4=B1nova?= Date: Tue, 21 Mar 2017 21:56:23 -0700 Subject: [PATCH 39/63] servo: Merge #15813 - Implement parsing/serialization and glue for will-change property (from canaltinova:will-change); r=upsuper,emilio Implement parsing/serialization and glue for will-change property --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #15706 (github issue number if applicable). - [x] There are tests for these changes Source-Repo: https://github.com/servo/servo Source-Revision: cb1438e44f0550378867a308494e4f84b1e00478 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : caf2bb046a96cc073eace38d7c14a3a819d8a111 --- .../style/gecko_bindings/bindings.rs | 11 +++ servo/components/style/properties/data.py | 6 +- .../components/style/properties/gecko.mako.rs | 88 ++++++++++++++++++- .../style/properties/longhand/box.mako.rs | 73 +++++++++++++++ .../style/properties/longhand/effects.mako.rs | 4 + .../properties/longhand/position.mako.rs | 1 + .../style/properties/longhand/svg.mako.rs | 4 +- .../style/properties/properties.mako.rs | 33 +++++++ servo/tests/unit/style/parsing/box_.rs | 28 ++++++ servo/tests/unit/style/parsing/mod.rs | 1 + 10 files changed, 246 insertions(+), 3 deletions(-) create mode 100644 servo/tests/unit/style/parsing/box_.rs diff --git a/servo/components/style/gecko_bindings/bindings.rs b/servo/components/style/gecko_bindings/bindings.rs index 7c2ccb6450c4..4a4b3143f6ae 100644 --- a/servo/components/style/gecko_bindings/bindings.rs +++ b/servo/components/style/gecko_bindings/bindings.rs @@ -781,6 +781,17 @@ extern "C" { *mut ::std::os::raw::c_void, len: usize); } +extern "C" { + pub fn Gecko_ClearWillChange(display: *mut nsStyleDisplay, length: usize); +} +extern "C" { + pub fn Gecko_AppendWillChange(display: *mut nsStyleDisplay, + atom: *mut nsIAtom); +} +extern "C" { + pub fn Gecko_CopyWillChangeFrom(dest: *mut nsStyleDisplay, + src: *mut nsStyleDisplay); +} extern "C" { pub fn Gecko_AnimationAppendKeyframe(keyframes: RawGeckoKeyframeListBorrowedMut, diff --git a/servo/components/style/properties/data.py b/servo/components/style/properties/data.py index 57cf0eaee21b..f134a9765a89 100644 --- a/servo/components/style/properties/data.py +++ b/servo/components/style/properties/data.py @@ -96,7 +96,8 @@ class Longhand(object): predefined_type=None, custom_cascade=False, experimental=False, internal=False, need_clone=False, need_index=False, gecko_ffi_name=None, depend_on_viewport_size=False, allowed_in_keyframe_block=True, complex_color=False, cast_type='u8', - has_uncacheable_values=False, logical=False, alias=None, extra_prefixes=None, boxed=False): + has_uncacheable_values=False, logical=False, alias=None, extra_prefixes=None, boxed=False, + creates_stacking_context=False, fixpos_cb=False, abspos_cb=False): self.name = name if not spec: raise TypeError("Spec should be specified for %s" % name) @@ -120,6 +121,9 @@ class Longhand(object): self.alias = alias.split() if alias else [] self.extra_prefixes = extra_prefixes.split() if extra_prefixes else [] self.boxed = arg_to_bool(boxed) + self.creates_stacking_context = arg_to_bool(creates_stacking_context) + self.fixpos_cb = arg_to_bool(fixpos_cb) + self.abspos_cb = arg_to_bool(abspos_cb) # https://drafts.csswg.org/css-animations/#keyframes # > The inside of accepts any CSS property diff --git a/servo/components/style/properties/gecko.mako.rs b/servo/components/style/properties/gecko.mako.rs index 35ef4a1f0049..3c84ea6e4026 100644 --- a/servo/components/style/properties/gecko.mako.rs +++ b/servo/components/style/properties/gecko.mako.rs @@ -1423,7 +1423,7 @@ fn static_assert() { page-break-before page-break-after scroll-snap-points-x scroll-snap-points-y transform scroll-snap-type-y scroll-snap-coordinate - perspective-origin transform-origin -moz-binding""" %> + perspective-origin transform-origin -moz-binding will-change""" %> <%self:impl_trait style_struct_name="Box" skip_longhands="${skip_box_longhands}"> // We manually-implement the |display| property until we get general @@ -1918,6 +1918,92 @@ fn static_assert() { .expect("clone for Length failed"), } } + + pub fn set_will_change(&mut self, v: longhands::will_change::computed_value::T) { + use gecko_bindings::bindings::{Gecko_AppendWillChange, Gecko_ClearWillChange}; + use gecko_bindings::structs::NS_STYLE_WILL_CHANGE_OPACITY; + use gecko_bindings::structs::NS_STYLE_WILL_CHANGE_SCROLL; + use gecko_bindings::structs::NS_STYLE_WILL_CHANGE_TRANSFORM; + use properties::PropertyId; + use properties::longhands::will_change::computed_value::T; + + fn will_change_bitfield_from_prop_flags(prop: &LonghandId) -> u8 { + use properties::{ABSPOS_CB, CREATES_STACKING_CONTEXT, FIXPOS_CB}; + use gecko_bindings::structs::NS_STYLE_WILL_CHANGE_ABSPOS_CB; + use gecko_bindings::structs::NS_STYLE_WILL_CHANGE_FIXPOS_CB; + use gecko_bindings::structs::NS_STYLE_WILL_CHANGE_STACKING_CONTEXT; + let servo_flags = prop.flags(); + let mut bitfield = 0; + + if servo_flags.contains(CREATES_STACKING_CONTEXT) { + bitfield |= NS_STYLE_WILL_CHANGE_STACKING_CONTEXT; + } + if servo_flags.contains(FIXPOS_CB) { + bitfield |= NS_STYLE_WILL_CHANGE_FIXPOS_CB; + } + if servo_flags.contains(ABSPOS_CB) { + bitfield |= NS_STYLE_WILL_CHANGE_ABSPOS_CB; + } + + bitfield as u8 + } + + self.gecko.mWillChangeBitField = 0; + + match v { + T::AnimateableFeatures(features) => { + unsafe { + Gecko_ClearWillChange(&mut self.gecko, features.len()); + } + + for feature in features.iter() { + if feature == &atom!("scroll-position") { + self.gecko.mWillChangeBitField |= NS_STYLE_WILL_CHANGE_SCROLL as u8; + } else if feature == &atom!("opacity") { + self.gecko.mWillChangeBitField |= NS_STYLE_WILL_CHANGE_OPACITY as u8; + } else if feature == &atom!("transform") { + self.gecko.mWillChangeBitField |= NS_STYLE_WILL_CHANGE_TRANSFORM as u8; + } + + unsafe { + Gecko_AppendWillChange(&mut self.gecko, feature.as_ptr()); + } + + if let Ok(prop_id) = PropertyId::parse(feature.to_string().into()) { + match prop_id.as_shorthand() { + Ok(shorthand) => { + for longhand in shorthand.longhands() { + self.gecko.mWillChangeBitField |= + will_change_bitfield_from_prop_flags(longhand); + } + }, + Err(longhand_or_custom) => { + if let PropertyDeclarationId::Longhand(longhand) + = longhand_or_custom { + self.gecko.mWillChangeBitField |= + will_change_bitfield_from_prop_flags(&longhand); + } + }, + } + } + } + }, + T::Auto => { + unsafe { + Gecko_ClearWillChange(&mut self.gecko, 0); + } + }, + }; + } + + pub fn copy_will_change_from(&mut self, other: &Self) { + use gecko_bindings::bindings::Gecko_CopyWillChangeFrom; + + self.gecko.mWillChangeBitField = other.gecko.mWillChangeBitField; + unsafe { + Gecko_CopyWillChangeFrom(&mut self.gecko, &other.gecko as *const _ as *mut _); + } + } <%def name="simple_image_array_property(name, shorthand, field_name)"> diff --git a/servo/components/style/properties/longhand/box.mako.rs b/servo/components/style/properties/longhand/box.mako.rs index 26aab0498b8d..17e95115a5c5 100644 --- a/servo/components/style/properties/longhand/box.mako.rs +++ b/servo/components/style/properties/longhand/box.mako.rs @@ -108,6 +108,8 @@ ${helpers.single_keyword("-moz-top-layer", "none top", need_clone="True" extra_gecko_values="sticky" animatable="False" + creates_stacking_context="True" + abspos_cb="True" spec="https://drafts.csswg.org/css-position/#position-property"> impl SpecifiedValue { pub fn is_absolutely_positioned_style(&self) -> bool { @@ -1116,6 +1118,8 @@ ${helpers.predefined_type("scroll-snap-coordinate", <%helpers:longhand name="transform" products="gecko servo" extra_prefixes="webkit" animatable="True" + creates_stacking_context="True" + fixpos_cb="True" spec="https://drafts.csswg.org/css-transforms/#propdef-transform"> use app_units::Au; use style_traits::ToCss; @@ -1672,6 +1676,7 @@ ${helpers.single_keyword("isolation", "auto isolate", products="gecko", spec="https://drafts.fxtf.org/compositing/#isolation", + creates_stacking_context=True, animatable=False)} // TODO add support for logical values recto and verso @@ -1710,6 +1715,8 @@ ${helpers.predefined_type("perspective", spec="https://drafts.csswg.org/css-transforms/#perspective", extra_prefixes="moz webkit", boxed=True, + creates_stacking_context=True, + fixpos_cb=True, animatable=True)} // FIXME: This prop should be animatable @@ -1819,6 +1826,8 @@ ${helpers.single_keyword("transform-style", "flat preserve-3d", spec="https://drafts.csswg.org/css-transforms/#transform-style-property", extra_prefixes="moz webkit", + creates_stacking_context=True, + fixpos_cb=True, animatable=False)} <%helpers:longhand name="transform-origin" animatable="True" extra_prefixes="moz webkit" boxed="True" @@ -1973,3 +1982,67 @@ ${helpers.single_keyword("-moz-orient", gecko_enum_prefix="StyleOrient", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-orient)", animatable=False)} + +<%helpers:longhand name="will-change" products="gecko" animatable="False" + spec="https://drafts.csswg.org/css-will-change/#will-change"> + use cssparser::serialize_identifier; + use std::fmt; + use style_traits::ToCss; + use values::HasViewportPercentage; + use values::computed::ComputedValueAsSpecified; + + impl ComputedValueAsSpecified for SpecifiedValue {} + no_viewport_percentage!(SpecifiedValue); + + pub mod computed_value { + pub use super::SpecifiedValue as T; + } + + #[derive(Debug, Clone, PartialEq)] + #[cfg_attr(feature = "servo", derive(HeapSizeOf))] + pub enum SpecifiedValue { + Auto, + AnimateableFeatures(Vec), + } + + impl ToCss for SpecifiedValue { + fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { + match *self { + SpecifiedValue::Auto => dest.write_str("auto"), + SpecifiedValue::AnimateableFeatures(ref features) => { + let (first, rest) = features.split_first().unwrap(); + // handle head element + serialize_identifier(&*first.to_string(), dest)?; + // handle tail, precede each with a delimiter + for feature in rest { + dest.write_str(", ")?; + serialize_identifier(&*feature.to_string(), dest)?; + } + Ok(()) + } + } + } + } + + #[inline] + pub fn get_initial_value() -> computed_value::T { + computed_value::T::Auto + } + + /// auto | # + pub fn parse(_context: &ParserContext, input: &mut Parser) -> Result { + if input.try(|input| input.expect_ident_matching("auto")).is_ok() { + Ok(computed_value::T::Auto) + } else { + input.parse_comma_separated(|i| { + let ident = i.expect_ident()?; + match_ignore_ascii_case! { &ident, + "will-change" | "none" | "all" | "auto" | + "initial" | "inherit" | "unset" | "default" => return Err(()), + _ => {}, + } + Ok((Atom::from(ident))) + }).map(SpecifiedValue::AnimateableFeatures) + } + } + diff --git a/servo/components/style/properties/longhand/effects.mako.rs b/servo/components/style/properties/longhand/effects.mako.rs index dd147481b1d9..a25b92267a96 100644 --- a/servo/components/style/properties/longhand/effects.mako.rs +++ b/servo/components/style/properties/longhand/effects.mako.rs @@ -11,6 +11,7 @@ ${helpers.predefined_type("opacity", "Opacity", "1.0", animatable=True, + creates_stacking_context=True, spec="https://drafts.csswg.org/css-color/#opacity")} <%helpers:vector_longhand name="box-shadow" allow_empty="True" @@ -86,6 +87,8 @@ ${helpers.predefined_type("clip", // FIXME: This prop should be animatable <%helpers:longhand name="filter" animatable="False" extra_prefixes="webkit" + creates_stacking_context="True" + fixpos_cb="True" spec="https://drafts.fxtf.org/filters/#propdef-filter"> //pub use self::computed_value::T as SpecifiedValue; use cssparser; @@ -516,4 +519,5 @@ ${helpers.single_keyword("mix-blend-mode", color-burn hard-light soft-light difference exclusion hue saturation color luminosity""", gecko_constant_prefix="NS_STYLE_BLEND", animatable=False, + creates_stacking_context=True, spec="https://drafts.fxtf.org/compositing/#propdef-mix-blend-mode")} diff --git a/servo/components/style/properties/longhand/position.mako.rs b/servo/components/style/properties/longhand/position.mako.rs index 9c61a1dec903..602be097ec26 100644 --- a/servo/components/style/properties/longhand/position.mako.rs +++ b/servo/components/style/properties/longhand/position.mako.rs @@ -26,6 +26,7 @@ ${helpers.predefined_type("z-index", "IntegerOrAuto", "Either::Second(Auto)", spec="https://www.w3.org/TR/CSS2/visuren.html#z-index", + creates_stacking_context=True, animatable="True")} // CSS Flexible Box Layout Module Level 1 diff --git a/servo/components/style/properties/longhand/svg.mako.rs b/servo/components/style/properties/longhand/svg.mako.rs index fa6caff45e30..45da055559f4 100644 --- a/servo/components/style/properties/longhand/svg.mako.rs +++ b/servo/components/style/properties/longhand/svg.mako.rs @@ -59,6 +59,7 @@ ${helpers.single_keyword("mask-type", "luminance alpha", spec="https://drafts.fxtf.org/css-masking/#propdef-mask-type")} <%helpers:longhand name="clip-path" animatable="False" products="gecko" boxed="True" + creates_stacking_context="True" spec="https://drafts.fxtf.org/css-masking/#propdef-clip-path"> use std::fmt; use style_traits::ToCss; @@ -189,7 +190,8 @@ ${helpers.single_keyword("mask-composite", spec="https://drafts.fxtf.org/css-masking/#propdef-mask-composite")} <%helpers:vector_longhand name="mask-image" products="gecko" animatable="False" extra_prefixes="webkit" - has_uncacheable_values="${product == 'gecko'}", + has_uncacheable_values="${product == 'gecko'}" + creates_stacking_context="True" spec="https://drafts.fxtf.org/css-masking/#propdef-mask-image"> use std::fmt; use style_traits::ToCss; diff --git a/servo/components/style/properties/properties.mako.rs b/servo/components/style/properties/properties.mako.rs index b2a84529f1a6..8fd7dc6d4ee2 100644 --- a/servo/components/style/properties/properties.mako.rs +++ b/servo/components/style/properties/properties.mako.rs @@ -420,6 +420,20 @@ impl Parse for CSSWideKeyword { } } +bitflags! { + /// A set of flags for properties. + pub flags PropertyFlags: u8 { + /// This property requires a stacking context. + const CREATES_STACKING_CONTEXT = 0x01, + /// This property has values that can establish a containing block for + /// fixed positioned and absolutely positioned elements. + const FIXPOS_CB = 0x02, + /// This property has values that can establish a containing block for + /// absolutely positioned elements. + const ABSPOS_CB = 0x04, + } +} + /// An identifier for a given longhand property. #[derive(Clone, Copy, Eq, PartialEq, Debug)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] @@ -458,6 +472,25 @@ impl LonghandId { _ => *self } } + + /// Returns PropertyFlags for given property. + pub fn flags(&self) -> PropertyFlags { + match *self { + % for property in data.longhands: + LonghandId::${property.camel_case} => + %if property.creates_stacking_context: + CREATES_STACKING_CONTEXT | + %endif + %if property.fixpos_cb: + FIXPOS_CB | + %endif + %if property.abspos_cb: + ABSPOS_CB | + %endif + PropertyFlags::empty(), + % endfor + } + } } /// An identifier for a given shorthand property. diff --git a/servo/tests/unit/style/parsing/box_.rs b/servo/tests/unit/style/parsing/box_.rs new file mode 100644 index 000000000000..189e55d75a10 --- /dev/null +++ b/servo/tests/unit/style/parsing/box_.rs @@ -0,0 +1,28 @@ +/* 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/. */ + +use cssparser::Parser; +use media_queries::CSSErrorReporterTest; +use parsing::parse; +use style::parser::ParserContext; +use style::stylesheets::Origin; +use style_traits::ToCss; + +#[test] +fn test_will_change() { + use style::properties::longhands::will_change; + + assert_roundtrip_with_context!(will_change::parse, "auto"); + assert_roundtrip_with_context!(will_change::parse, "scroll-position"); + assert_roundtrip_with_context!(will_change::parse, "contents"); + assert_roundtrip_with_context!(will_change::parse, "transition"); + assert_roundtrip_with_context!(will_change::parse, "opacity, transform"); + + assert!(parse(will_change::parse, "will-change").is_err()); + assert!(parse(will_change::parse, "all").is_err()); + assert!(parse(will_change::parse, "none").is_err()); + assert!(parse(will_change::parse, "contents, auto").is_err()); + assert!(parse(will_change::parse, "contents, inherit, initial").is_err()); + assert!(parse(will_change::parse, "transform scroll-position").is_err()); +} diff --git a/servo/tests/unit/style/parsing/mod.rs b/servo/tests/unit/style/parsing/mod.rs index e4a9ce985a3e..cfa7582eeda3 100644 --- a/servo/tests/unit/style/parsing/mod.rs +++ b/servo/tests/unit/style/parsing/mod.rs @@ -85,6 +85,7 @@ mod animation; mod background; mod basic_shape; mod border; +mod box_; mod column; mod effects; mod font; From 43101703b6146cd21909affa3f23ea952231a1dc Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Tue, 21 Mar 2017 22:36:37 -0700 Subject: [PATCH 40/63] servo: Merge #16072 - Fix geckolib breakage caused by 1.16 (from Manishearth:macro-use); r=upsuper Source-Repo: https://github.com/servo/servo Source-Revision: f90f7d6824a65eb0b6a266f5e8281f313c1ae1c0 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 53d6fdd5e0b604dfb64cf0cc05c2fe176d005a7b --- servo/Cargo.lock | 1 - servo/ports/geckolib/Cargo.toml | 1 - servo/ports/geckolib/lib.rs | 1 - 3 files changed, 3 deletions(-) diff --git a/servo/Cargo.lock b/servo/Cargo.lock index 96ab041bec40..1ce02f4240a9 100644 --- a/servo/Cargo.lock +++ b/servo/Cargo.lock @@ -925,7 +925,6 @@ dependencies = [ "atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/servo/ports/geckolib/Cargo.toml b/servo/ports/geckolib/Cargo.toml index 40e9b7e65ad6..ea7db0051568 100644 --- a/servo/ports/geckolib/Cargo.toml +++ b/servo/ports/geckolib/Cargo.toml @@ -17,7 +17,6 @@ testing = ["style/testing"] atomic_refcell = "0.1" cssparser = "0.12" env_logger = {version = "0.4", default-features = false} # disable `regex` to reduce code size -lazy_static = "0.2" libc = "0.2" log = {version = "0.3.5", features = ["release_max_level_info"]} parking_lot = "0.3" diff --git a/servo/ports/geckolib/lib.rs b/servo/ports/geckolib/lib.rs index a7dd05612995..30b4434739ca 100644 --- a/servo/ports/geckolib/lib.rs +++ b/servo/ports/geckolib/lib.rs @@ -7,7 +7,6 @@ extern crate atomic_refcell; extern crate cssparser; extern crate env_logger; -#[macro_use] extern crate lazy_static; extern crate libc; #[macro_use] extern crate log; extern crate parking_lot; From 686ce2914122cf9c74528af4a3409f75571309e3 Mon Sep 17 00:00:00 2001 From: Servo VCS Sync Date: Wed, 22 Mar 2017 06:17:28 +0000 Subject: [PATCH 41/63] No bug - Revendor rust dependencies --- toolkit/library/gtest/rust/Cargo.lock | 1 - toolkit/library/rust/Cargo.lock | 1 - 2 files changed, 2 deletions(-) diff --git a/toolkit/library/gtest/rust/Cargo.lock b/toolkit/library/gtest/rust/Cargo.lock index d37acafe6ce4..2a3d13760d2c 100644 --- a/toolkit/library/gtest/rust/Cargo.lock +++ b/toolkit/library/gtest/rust/Cargo.lock @@ -302,7 +302,6 @@ dependencies = [ "atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.2 (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)", "parking_lot 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/toolkit/library/rust/Cargo.lock b/toolkit/library/rust/Cargo.lock index 1e5201e8f69b..d9d74a3c9d42 100644 --- a/toolkit/library/rust/Cargo.lock +++ b/toolkit/library/rust/Cargo.lock @@ -300,7 +300,6 @@ dependencies = [ "atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.2 (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)", "parking_lot 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", From cc7bc8e08db8f73ea3e9dcfcecbaed08c1b708be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Naz=C4=B1m=20Can=20Alt=C4=B1nova?= Date: Sun, 19 Mar 2017 15:36:16 +0300 Subject: [PATCH 42/63] Bug 1342139 - Implement gecko bindings for will-change r=xidorn MozReview-Commit-ID: KNhVz9vjXUl --HG-- extra : rebase_source : 20f5d2ec6c151e2d3024bcd11b5ca920158f5a93 --- layout/style/ServoBindings.cpp | 20 ++++++++++++++++++++ layout/style/ServoBindings.h | 4 ++++ 2 files changed, 24 insertions(+) diff --git a/layout/style/ServoBindings.cpp b/layout/style/ServoBindings.cpp index 12ffec81f03d..19387b521ff5 100644 --- a/layout/style/ServoBindings.cpp +++ b/layout/style/ServoBindings.cpp @@ -1120,6 +1120,26 @@ Gecko_EnsureStyleTransitionArrayLength(void* aArray, size_t aLen) } } +void +Gecko_ClearWillChange(nsStyleDisplay* aDisplay, size_t aLength) +{ + aDisplay->mWillChange.Clear(); + aDisplay->mWillChange.SetCapacity(aLength); +} + +void +Gecko_AppendWillChange(nsStyleDisplay* aDisplay, nsIAtom* aAtom) +{ + aDisplay->mWillChange.AppendElement(aAtom); +} + +void +Gecko_CopyWillChangeFrom(nsStyleDisplay* aDest, nsStyleDisplay* aSrc) +{ + aDest->mWillChange.Clear(); + aDest->mWillChange.AppendElements(aSrc->mWillChange); +} + Keyframe* Gecko_AnimationAppendKeyframe(RawGeckoKeyframeListBorrowedMut aKeyframes, float aOffset, diff --git a/layout/style/ServoBindings.h b/layout/style/ServoBindings.h index 2ccad0cb372f..3197f6d5d815 100644 --- a/layout/style/ServoBindings.h +++ b/layout/style/ServoBindings.h @@ -297,6 +297,10 @@ void Gecko_EnsureImageLayersLength(nsStyleImageLayers* layers, size_t len, void Gecko_EnsureStyleAnimationArrayLength(void* array, size_t len); void Gecko_EnsureStyleTransitionArrayLength(void* array, size_t len); +void Gecko_ClearWillChange(nsStyleDisplay* display, size_t length); +void Gecko_AppendWillChange(nsStyleDisplay* display, nsIAtom* atom); +void Gecko_CopyWillChangeFrom(nsStyleDisplay* dest, nsStyleDisplay* src); + mozilla::Keyframe* Gecko_AnimationAppendKeyframe(RawGeckoKeyframeListBorrowedMut keyframes, float offset, const nsTimingFunction* timingFunction); From b6a3722d2379aef4724861ae71985b6c8ef55054 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Naz=C4=B1m=20Can=20Alt=C4=B1nova?= Date: Tue, 21 Mar 2017 14:51:26 +0300 Subject: [PATCH 43/63] Bug 1342139 - Stylo: Update test expectations for will-change property r=xidorn MozReview-Commit-ID: 61F50w9HBql --HG-- extra : rebase_source : d95ff6489a1ae896a9e3e658c8894657207cca10 --- layout/reftests/bugs/reftest-stylo.list | 4 +-- .../submitted/will-change/reftest-stylo.list | 32 +++++++++---------- layout/style/test/stylo-failures.md | 10 +----- 3 files changed, 19 insertions(+), 27 deletions(-) diff --git a/layout/reftests/bugs/reftest-stylo.list b/layout/reftests/bugs/reftest-stylo.list index 29d2152eb4f7..fb3fe0bfb76c 100644 --- a/layout/reftests/bugs/reftest-stylo.list +++ b/layout/reftests/bugs/reftest-stylo.list @@ -1829,7 +1829,7 @@ fails == 992447.html 992447.html == 1005405-1.html 1005405-1.html fails == 1012640-1.html 1012640-1.html == 1013054-1.html 1013054-1.html -fails == 1018522-1.html 1018522-1.html +== 1018522-1.html 1018522-1.html == 1021564-1.html 1021564-1.html == 1021564-2.html 1021564-2.html == 1021564-3.html 1021564-3.html @@ -1953,7 +1953,7 @@ fails pref(layout.css.overflow-clip-box.enabled,true) == 1226278.html 1226278.ht == 1230466.html 1230466.html == 1238243-1.html 1238243-1.html == 1238243-2.html 1238243-2.html -fails == 1239564.html 1239564.html +== 1239564.html 1239564.html fails == 1242172-1.html 1242172-1.html fails == 1242172-2.html 1242172-2.html == 1242781.html 1242781.html diff --git a/layout/reftests/w3c-css/submitted/will-change/reftest-stylo.list b/layout/reftests/w3c-css/submitted/will-change/reftest-stylo.list index 7b7dd2f23e3d..3651ff0f0b0d 100644 --- a/layout/reftests/w3c-css/submitted/will-change/reftest-stylo.list +++ b/layout/reftests/w3c-css/submitted/will-change/reftest-stylo.list @@ -1,20 +1,20 @@ # DO NOT EDIT! This is a auto-generated temporary list for Stylo testing -fails == will-change-stacking-context-clip-path-1.html will-change-stacking-context-clip-path-1.html -fails == will-change-stacking-context-filter-1.html will-change-stacking-context-filter-1.html +== will-change-stacking-context-clip-path-1.html will-change-stacking-context-clip-path-1.html +== will-change-stacking-context-filter-1.html will-change-stacking-context-filter-1.html == will-change-stacking-context-height-1.html will-change-stacking-context-height-1.html -fails == will-change-stacking-context-isolation-1.html will-change-stacking-context-isolation-1.html -fails == will-change-stacking-context-mask-1.html will-change-stacking-context-mask-1.html -fails == will-change-stacking-context-mix-blend-mode-1.html will-change-stacking-context-mix-blend-mode-1.html -fails == will-change-stacking-context-opacity-1.html will-change-stacking-context-opacity-1.html -fails == will-change-stacking-context-perspective-1.html will-change-stacking-context-perspective-1.html -fails == will-change-stacking-context-position-1.html will-change-stacking-context-position-1.html -fails == will-change-stacking-context-transform-1.html will-change-stacking-context-transform-1.html -fails == will-change-stacking-context-transform-style-1.html will-change-stacking-context-transform-style-1.html -fails == will-change-stacking-context-z-index-1.html will-change-stacking-context-z-index-1.html +== will-change-stacking-context-isolation-1.html will-change-stacking-context-isolation-1.html +== will-change-stacking-context-mask-1.html will-change-stacking-context-mask-1.html +== will-change-stacking-context-mix-blend-mode-1.html will-change-stacking-context-mix-blend-mode-1.html +== will-change-stacking-context-opacity-1.html will-change-stacking-context-opacity-1.html +== will-change-stacking-context-perspective-1.html will-change-stacking-context-perspective-1.html +== will-change-stacking-context-position-1.html will-change-stacking-context-position-1.html +== will-change-stacking-context-transform-1.html will-change-stacking-context-transform-1.html +== will-change-stacking-context-transform-style-1.html will-change-stacking-context-transform-style-1.html +== will-change-stacking-context-z-index-1.html will-change-stacking-context-z-index-1.html fails pref(layout.css.contain.enabled,true) == will-change-fixpos-cb-contain-1.html will-change-fixpos-cb-contain-1.html # Bug 1342139 -fails == will-change-fixpos-cb-filter-1.html will-change-fixpos-cb-filter-1.html +== will-change-fixpos-cb-filter-1.html will-change-fixpos-cb-filter-1.html == will-change-fixpos-cb-height-1.html will-change-fixpos-cb-height-1.html -fails == will-change-fixpos-cb-perspective-1.html will-change-fixpos-cb-perspective-1.html -fails == will-change-fixpos-cb-position-1.html will-change-fixpos-cb-position-1.html -fails == will-change-fixpos-cb-transform-1.html will-change-fixpos-cb-transform-1.html -fails == will-change-fixpos-cb-transform-style-1.html will-change-fixpos-cb-transform-style-1.html +== will-change-fixpos-cb-perspective-1.html will-change-fixpos-cb-perspective-1.html +== will-change-fixpos-cb-position-1.html will-change-fixpos-cb-position-1.html +== will-change-fixpos-cb-transform-1.html will-change-fixpos-cb-transform-1.html +== will-change-fixpos-cb-transform-style-1.html will-change-fixpos-cb-transform-style-1.html diff --git a/layout/style/test/stylo-failures.md b/layout/style/test/stylo-failures.md index e04f0f2966c5..3fbf142d4dc6 100644 --- a/layout/style/test/stylo-failures.md +++ b/layout/style/test/stylo-failures.md @@ -122,7 +122,7 @@ to mochitest command. * test_value_storage.html `symbols(` [30] * ... `list-style-type` [60] * ... `'list-style'` [30] - * ... `'content`: various value as list-style-type in counter functions [15] + * ... `'content`: various value as list-style-type in counter functions [13] * test_default_computed_style.html: support of getDefaultComputedStyle [1] * @font-face support bug 1290237 * test_descriptor_storage.html [1] @@ -182,14 +182,6 @@ to mochitest command. * test_value_storage.html `-moz-transform`: need different parsing rules [284] * test_variables.html `var(--var6)`: -x-system-font [1] * Unimplemented CSS properties: - * will-change longhand property servo/servo#15706 - * test_change_hint_optimizations.html [1] - * test_compute_data_with_start_struct.html `will-change` [2] - * test_inherit_computation.html `will-change` [2] - * test_inherit_storage.html `will-change` [2] - * test_initial_computation.html `will-change` [4] - * test_initial_storage.html `will-change` [4] - * test_value_storage.html `will-change` [16] * contain longhand property servo/servo#15955 * test_contain_formatting_context.html [1] * test_compute_data_with_start_struct.html `contain` [2] From fdb09024655220bb0487e534a44b97bd3bca9b57 Mon Sep 17 00:00:00 2001 From: Iris Hsiao Date: Wed, 22 Mar 2017 14:48:44 +0800 Subject: [PATCH 44/63] Bug 1329160 - follow up fix for android-checkstyle failure. r=me commit cfdceed7ac0f3a01c0ba26e5cbad9bf00d7fc41d Author: Nevin Chen add space MozReview-Commit-ID: G12OwXykTZx --- .../org/mozilla/gecko/customtabs/GeckoCustomTabsService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/android/base/java/org/mozilla/gecko/customtabs/GeckoCustomTabsService.java b/mobile/android/base/java/org/mozilla/gecko/customtabs/GeckoCustomTabsService.java index d3506c2f7706..5742db8b6a69 100644 --- a/mobile/android/base/java/org/mozilla/gecko/customtabs/GeckoCustomTabsService.java +++ b/mobile/android/base/java/org/mozilla/gecko/customtabs/GeckoCustomTabsService.java @@ -38,7 +38,7 @@ public class GeckoCustomTabsService extends CustomTabsService { @Override protected boolean warmup(long flags) { - Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.SERVICE,"customtab-warmup"); + Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.SERVICE, "customtab-warmup"); if (DEBUG) { Log.v(LOGTAG, "warming up..."); From 9a76e90f1130a18c9461f44e327672aa0183ff1d Mon Sep 17 00:00:00 2001 From: Zibi Braniecki Date: Tue, 21 Mar 2017 16:20:07 -0700 Subject: [PATCH 45/63] Bug 1348259 - Switch nsLanguageAtomService to use OSPreferences::GetSystemLocale. r=m_kato MozReview-Commit-ID: DvKbtrpfNJe --HG-- extra : rebase_source : 7a62729ce4251c7cd046449c84f5072ed66cf7c9 --- intl/locale/nsLanguageAtomService.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/intl/locale/nsLanguageAtomService.cpp b/intl/locale/nsLanguageAtomService.cpp index f2f83e4eb2c4..95dad7106784 100644 --- a/intl/locale/nsLanguageAtomService.cpp +++ b/intl/locale/nsLanguageAtomService.cpp @@ -9,12 +9,12 @@ #include "nsIAtom.h" #include "mozilla/ArrayUtils.h" #include "mozilla/Services.h" -#include "mozilla/intl/LocaleService.h" +#include "mozilla/intl/OSPreferences.h" #include "nsServiceManagerUtils.h" #include "mozilla/dom/EncodingUtils.h" using namespace mozilla; -using mozilla::intl::LocaleService; +using mozilla::intl::OSPreferences; static constexpr nsUConvProp kLangGroups[] = { #include "langGroups.properties.h" @@ -51,7 +51,7 @@ nsLanguageAtomService::GetLocaleLanguage() do { if (!mLocaleLanguage) { nsAutoCString locale; - LocaleService::GetInstance()->GetAppLocaleAsLangTag(locale); + OSPreferences::GetInstance()->GetSystemLocale(locale); ToLowerCase(locale); // use lowercase for all language atoms mLocaleLanguage = NS_Atomize(locale); From 295d2183ba138ac052896dc6f7d24c803ceb4d75 Mon Sep 17 00:00:00 2001 From: Alastor Wu Date: Wed, 22 Mar 2017 00:04:24 +0800 Subject: [PATCH 46/63] Bug 1329122 - should unregister agent when media element becomes inactive. r=baku We should remove the media control interface immediately when the document is inacitve, even it was paused by media control before. MozReview-Commit-ID: GBDhzEFOTXE --HG-- extra : rebase_source : f357d19ceb26d307d1d68696ad875d044e14aa8b --- dom/html/HTMLMediaElement.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp index ea58c541c75f..6e43f730479e 100644 --- a/dom/html/HTMLMediaElement.cpp +++ b/dom/html/HTMLMediaElement.cpp @@ -1030,6 +1030,11 @@ private: return false; } + // We should consider any bfcached page or inactive document as non-playing. + if (!mOwner->IsActive()) { + return false; + } + // It might be resumed from remote, we should keep the audio channel agent. if (IsSuspended()) { return true; @@ -1040,11 +1045,6 @@ private: return false; } - // We should consider any bfcached page or inactive document as non-playing. - if (!mOwner->IsActive()) { - return false; - } - // A loop always is playing if (mOwner->HasAttr(kNameSpaceID_None, nsGkAtoms::loop)) { return true; From 6d303cbfe0651aeddd35e7cd5d636298b707e029 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Wed, 22 Mar 2017 18:21:25 +1100 Subject: [PATCH 47/63] Bug 1341086 followup - Update test expectations. --- layout/reftests/bugs/reftest-stylo.list | 2 +- layout/reftests/css-required/reftest-stylo.list | 2 +- layout/reftests/webkit-box/reftest-stylo.list | 4 ++-- layout/style/test/stylo-failures.md | 7 +++---- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/layout/reftests/bugs/reftest-stylo.list b/layout/reftests/bugs/reftest-stylo.list index fb3fe0bfb76c..93abbaa719ac 100644 --- a/layout/reftests/bugs/reftest-stylo.list +++ b/layout/reftests/bugs/reftest-stylo.list @@ -818,7 +818,7 @@ fails == 395107-5.html 395107-5.html fails == 395130-1.html 395130-1.html fails == 395130-2.html 395130-2.html == 395331-1.xml 395331-1.xml -fails == 395390-1.html 395390-1.html +== 395390-1.html 395390-1.html == 396286-1.html 396286-1.html fails == 397428-1.html 397428-1.html == 397844-1.xhtml 397844-1.xhtml diff --git a/layout/reftests/css-required/reftest-stylo.list b/layout/reftests/css-required/reftest-stylo.list index c2ced09dce97..d077722b1e3a 100644 --- a/layout/reftests/css-required/reftest-stylo.list +++ b/layout/reftests/css-required/reftest-stylo.list @@ -22,7 +22,7 @@ fails == css-required-dyn-6.html css-required-dyn-6.html == css-required-hidden.html css-required-hidden.html fails == css-required-button.html css-required-button.html fails == css-required-submit.html css-required-submit.html -== css-required-image.html css-required-image.html +fails == css-required-image.html css-required-image.html fails == css-required-reset.html css-required-reset.html # Following elements can be optional but can't be required diff --git a/layout/reftests/webkit-box/reftest-stylo.list b/layout/reftests/webkit-box/reftest-stylo.list index 0d9687068632..fac989ab21ca 100644 --- a/layout/reftests/webkit-box/reftest-stylo.list +++ b/layout/reftests/webkit-box/reftest-stylo.list @@ -8,8 +8,8 @@ default-preferences pref(layout.css.prefixes.webkit,true) # WebKit/Blink on them. (The reference case represents the WebKit/Blink # rendering.) We could probably make them pass by implementing some quirks, if # it turns out that the web depends on WebKit/Blink's behavior in these cases. -fails == webkit-box-anon-flex-items-1a.html webkit-box-anon-flex-items-1a.html -fails == webkit-box-anon-flex-items-1b.html webkit-box-anon-flex-items-1b.html +== webkit-box-anon-flex-items-1a.html webkit-box-anon-flex-items-1a.html +== webkit-box-anon-flex-items-1b.html webkit-box-anon-flex-items-1b.html == webkit-box-anon-flex-items-2.html webkit-box-anon-flex-items-2.html == webkit-box-anon-flex-items-3.html webkit-box-anon-flex-items-3.html diff --git a/layout/style/test/stylo-failures.md b/layout/style/test/stylo-failures.md index 3fbf142d4dc6..1d8ec4dd679a 100644 --- a/layout/style/test/stylo-failures.md +++ b/layout/style/test/stylo-failures.md @@ -265,8 +265,8 @@ to mochitest command. * test_page_parser.html [30] * test_rule_insertion.html `@page` [4] * Stylesheet cloning is somehow busted bug 1348481 - * test_selectors.html `cloned correctly` [150] - * ... `matched clone` [195] + * test_selectors.html `cloned correctly` [155] + * ... `matched clone` [198] * Unsupported prefixed values * moz-prefixed gradient functions bug 1337655 * test_value_storage.html `-moz-linear-gradient` [322] @@ -402,9 +402,8 @@ to mochitest command. * test_selectors.html `:-moz-window-inactive` [2] * :-moz-{first,last}-node * test_selectors.html `:-moz-` [6] - * ... `unexpected rule index` [5] * :dir - * test_selectors.html `:dir` [10] + * test_selectors.html `:dir` [18] * issues arround font shorthand servo/servo#15032 servo/servo#15036 * test_bug377947.html [1] * test_value_storage.html `'font'` [144] From 3dffe3080823b5c83375bbdd9d5886b107377b7d Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Tue, 21 Mar 2017 17:17:49 +0100 Subject: [PATCH 48/63] Bug 1348954 - Html5-video controls do not hide when in fullscreen. r=ralin Undo incorrect change from bug 1341029, and tell ESLint about how Utils is 'global' to some of the videocontrols.xml event listeners. MozReview-Commit-ID: 9ItMIzwYhEj --HG-- extra : rebase_source : 4ea996771c00e25e7e33063cfb56cf19c2cf059a --- toolkit/content/widgets/videocontrols.xml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/toolkit/content/widgets/videocontrols.xml b/toolkit/content/widgets/videocontrols.xml index f554ce4eac0e..cb52f00ef55f 100644 --- a/toolkit/content/widgets/videocontrols.xml +++ b/toolkit/content/widgets/videocontrols.xml @@ -1006,19 +1006,19 @@ _showControlsTimeout : 0, SHOW_CONTROLS_TIMEOUT_MS: 500, _showControlsFn() { - if (this.Utils.video.matches("video:hover")) { - this.Utils.startFadeIn(this.Utils.controlBar, false); - this.Utils._showControlsTimeout = 0; - this.Utils._controlsHiddenByTimeout = false; + if (Utils.video.matches("video:hover")) { + Utils.startFadeIn(Utils.controlBar, false); + Utils._showControlsTimeout = 0; + Utils._controlsHiddenByTimeout = false; } }, _hideControlsTimeout : 0, _hideControlsFn() { - if (!this.Utils.scrubber.isDragging) { - this.Utils.startFade(this.Utils.controlBar, false); - this.Utils._hideControlsTimeout = 0; - this.Utils._controlsHiddenByTimeout = true; + if (!Utils.scrubber.isDragging) { + Utils.startFade(Utils.controlBar, false); + Utils._hideControlsTimeout = 0; + Utils._controlsHiddenByTimeout = true; } }, HIDE_CONTROLS_TIMEOUT_MS : 2000, @@ -1103,7 +1103,7 @@ this.startFadeOut(this.controlBar, false); this.textTrackList.setAttribute("hidden", "true"); clearTimeout(this._showControlsTimeout); - this.Utils._controlsHiddenByTimeout = false; + Utils._controlsHiddenByTimeout = false; } }, @@ -1267,7 +1267,7 @@ onFullscreenChange() { if (this.isVideoInFullScreen()) { - this.Utils._hideControlsTimeout = setTimeout(this._hideControlsFn, this.HIDE_CONTROLS_TIMEOUT_MS); + Utils._hideControlsTimeout = setTimeout(this._hideControlsFn, this.HIDE_CONTROLS_TIMEOUT_MS); } this.setFullscreenButtonState(); }, @@ -1832,6 +1832,9 @@ this.controlListeners = []; // Helper function to add an event listener to the given element + // Due to this helper function, "Utils" is made available to the event + // listener functions. Hence declare it as a global for ESLint. + /* global Utils */ function addListener(elem, eventName, func) { let boundFunc = func.bind(self); self.controlListeners.push({ item: elem, event: eventName, func: boundFunc }); From 4c78d0812eff320c9f9f3ee80bc62df10526488b Mon Sep 17 00:00:00 2001 From: Wei-Cheng Pan Date: Wed, 8 Feb 2017 15:11:53 +0800 Subject: [PATCH 49/63] Bug 1341531 - Measure input event dispatching latency. (*_EVENT_RECEIVED_MS) r=smaug This patch measures the time from an input event creation, to it been dispatched to PresShell, but just before any handler been executed. MozReview-Commit-ID: 6ZYra7YYICY --HG-- extra : rebase_source : 019521545132e72113a87c06cfbe562a9915522d --- layout/base/PresShell.cpp | 23 +++++++++ toolkit/components/telemetry/Histograms.json | 54 ++++++++++++++++++++ 2 files changed, 77 insertions(+) diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index 3e96f4d6a2af..2c689af9acf7 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -8059,10 +8059,13 @@ PresShell::HandleEventInternal(WidgetEvent* aEvent, nsPresContext::InteractionType::eKeyInteraction, aEvent->mTimeStamp); } + + Telemetry::AccumulateTimeDelta(Telemetry::KEYBOARD_EVENT_RECEIVED_MS, aEvent->mTimeStamp); break; } case eMouseDown: case eMouseUp: + Telemetry::AccumulateTimeDelta(Telemetry::MOUSE_CLICK_EVENT_RECEIVED_MS, aEvent->mTimeStamp); case ePointerDown: case ePointerUp: isHandlingUserInput = true; @@ -8071,6 +8074,14 @@ PresShell::HandleEventInternal(WidgetEvent* aEvent, aEvent->mTimeStamp); break; + case eMouseMove: + if (aEvent->mFlags.mHandledByAPZ) { + Telemetry::AccumulateTimeDelta(Telemetry::APZ_HANDLED_MOUSE_MOVE_EVENT_RECEIVED_MS, aEvent->mTimeStamp); + } else { + Telemetry::AccumulateTimeDelta(Telemetry::MOUSE_MOVE_EVENT_RECEIVED_MS, aEvent->mTimeStamp); + } + break; + case eDrop: { nsCOMPtr session = nsContentUtils::GetDragSession(); if (session) { @@ -8083,6 +8094,18 @@ PresShell::HandleEventInternal(WidgetEvent* aEvent, break; } + case eWheel: + if (aEvent->mFlags.mHandledByAPZ) { + Telemetry::AccumulateTimeDelta(Telemetry::APZ_HANDLED_WHEEL_EVENT_RECEIVED_MS, aEvent->mTimeStamp); + } + break; + + case eTouchMove: + if (aEvent->mFlags.mHandledByAPZ) { + Telemetry::AccumulateTimeDelta(Telemetry::APZ_HANDLED_TOUCH_MOVE_EVENT_RECEIVED_MS, aEvent->mTimeStamp); + } + break; + default: break; } diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index d42f2f1f8de5..4554e0b7eb09 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -11052,5 +11052,59 @@ "n_buckets": 20, "keyed": true, "description": "Measures the number of milliseconds we spend waiting on the main thread for IPC messages to serialize their parameters. Note: only messages that take more than 500 microseconds are included in this probe. This probe is keyed on the IPDL message name." + }, + "MOUSE_MOVE_EVENT_RECEIVED_MS": { + "alert_emails": ["wpan@mozilla.com"], + "expires_in_version": "60", + "kind": "exponential", + "high": 50000, + "n_buckets": 100, + "bug_numbers": [1341531], + "description": "Time (ms) for the mouse move event to dispatch, but before handlers executing." + }, + "MOUSE_CLICK_EVENT_RECEIVED_MS": { + "alert_emails": ["wpan@mozilla.com"], + "expires_in_version": "60", + "kind": "exponential", + "high": 50000, + "n_buckets": 100, + "bug_numbers": [1341531], + "description": "Time (ms) for the mouse click event to dispatch, but before handlers executing." + }, + "KEYBOARD_EVENT_RECEIVED_MS": { + "alert_emails": ["wpan@mozilla.com"], + "expires_in_version": "60", + "kind": "exponential", + "high": 50000, + "n_buckets": 100, + "bug_numbers": [1341531], + "description": "Time (ms) for the keyboard event to dispatch, but before handlers executing." + }, + "APZ_HANDLED_TOUCH_MOVE_EVENT_RECEIVED_MS": { + "alert_emails": ["wpan@mozilla.com"], + "expires_in_version": "60", + "kind": "exponential", + "high": 50000, + "n_buckets": 100, + "bug_numbers": [1341531], + "description": "Time (ms) for the APZ handled touch move event to dispatch, but before handlers executing." + }, + "APZ_HANDLED_MOUSE_MOVE_EVENT_RECEIVED_MS": { + "alert_emails": ["wpan@mozilla.com"], + "expires_in_version": "60", + "kind": "exponential", + "high": 50000, + "n_buckets": 100, + "bug_numbers": [1341531], + "description": "Time (ms) for the APZ handled mouse move event to dispatch, but before handlers executing." + }, + "APZ_HANDLED_WHEEL_EVENT_RECEIVED_MS": { + "alert_emails": ["wpan@mozilla.com"], + "expires_in_version": "60", + "kind": "exponential", + "high": 50000, + "n_buckets": 100, + "bug_numbers": [1341531], + "description": "Time (ms) for the APZ handled wheel event to dispatch, but before handlers executing." } } From 25b734e8935d7da93a5c60362f1ab0cc6f121654 Mon Sep 17 00:00:00 2001 From: Iris Hsiao Date: Wed, 22 Mar 2017 15:52:39 +0800 Subject: [PATCH 50/63] Backed out changeset 140374af2570 (bug 1341531) for build bustage --- layout/base/PresShell.cpp | 23 --------- toolkit/components/telemetry/Histograms.json | 54 -------------------- 2 files changed, 77 deletions(-) diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index 2c689af9acf7..3e96f4d6a2af 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -8059,13 +8059,10 @@ PresShell::HandleEventInternal(WidgetEvent* aEvent, nsPresContext::InteractionType::eKeyInteraction, aEvent->mTimeStamp); } - - Telemetry::AccumulateTimeDelta(Telemetry::KEYBOARD_EVENT_RECEIVED_MS, aEvent->mTimeStamp); break; } case eMouseDown: case eMouseUp: - Telemetry::AccumulateTimeDelta(Telemetry::MOUSE_CLICK_EVENT_RECEIVED_MS, aEvent->mTimeStamp); case ePointerDown: case ePointerUp: isHandlingUserInput = true; @@ -8074,14 +8071,6 @@ PresShell::HandleEventInternal(WidgetEvent* aEvent, aEvent->mTimeStamp); break; - case eMouseMove: - if (aEvent->mFlags.mHandledByAPZ) { - Telemetry::AccumulateTimeDelta(Telemetry::APZ_HANDLED_MOUSE_MOVE_EVENT_RECEIVED_MS, aEvent->mTimeStamp); - } else { - Telemetry::AccumulateTimeDelta(Telemetry::MOUSE_MOVE_EVENT_RECEIVED_MS, aEvent->mTimeStamp); - } - break; - case eDrop: { nsCOMPtr session = nsContentUtils::GetDragSession(); if (session) { @@ -8094,18 +8083,6 @@ PresShell::HandleEventInternal(WidgetEvent* aEvent, break; } - case eWheel: - if (aEvent->mFlags.mHandledByAPZ) { - Telemetry::AccumulateTimeDelta(Telemetry::APZ_HANDLED_WHEEL_EVENT_RECEIVED_MS, aEvent->mTimeStamp); - } - break; - - case eTouchMove: - if (aEvent->mFlags.mHandledByAPZ) { - Telemetry::AccumulateTimeDelta(Telemetry::APZ_HANDLED_TOUCH_MOVE_EVENT_RECEIVED_MS, aEvent->mTimeStamp); - } - break; - default: break; } diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index 4554e0b7eb09..d42f2f1f8de5 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -11052,59 +11052,5 @@ "n_buckets": 20, "keyed": true, "description": "Measures the number of milliseconds we spend waiting on the main thread for IPC messages to serialize their parameters. Note: only messages that take more than 500 microseconds are included in this probe. This probe is keyed on the IPDL message name." - }, - "MOUSE_MOVE_EVENT_RECEIVED_MS": { - "alert_emails": ["wpan@mozilla.com"], - "expires_in_version": "60", - "kind": "exponential", - "high": 50000, - "n_buckets": 100, - "bug_numbers": [1341531], - "description": "Time (ms) for the mouse move event to dispatch, but before handlers executing." - }, - "MOUSE_CLICK_EVENT_RECEIVED_MS": { - "alert_emails": ["wpan@mozilla.com"], - "expires_in_version": "60", - "kind": "exponential", - "high": 50000, - "n_buckets": 100, - "bug_numbers": [1341531], - "description": "Time (ms) for the mouse click event to dispatch, but before handlers executing." - }, - "KEYBOARD_EVENT_RECEIVED_MS": { - "alert_emails": ["wpan@mozilla.com"], - "expires_in_version": "60", - "kind": "exponential", - "high": 50000, - "n_buckets": 100, - "bug_numbers": [1341531], - "description": "Time (ms) for the keyboard event to dispatch, but before handlers executing." - }, - "APZ_HANDLED_TOUCH_MOVE_EVENT_RECEIVED_MS": { - "alert_emails": ["wpan@mozilla.com"], - "expires_in_version": "60", - "kind": "exponential", - "high": 50000, - "n_buckets": 100, - "bug_numbers": [1341531], - "description": "Time (ms) for the APZ handled touch move event to dispatch, but before handlers executing." - }, - "APZ_HANDLED_MOUSE_MOVE_EVENT_RECEIVED_MS": { - "alert_emails": ["wpan@mozilla.com"], - "expires_in_version": "60", - "kind": "exponential", - "high": 50000, - "n_buckets": 100, - "bug_numbers": [1341531], - "description": "Time (ms) for the APZ handled mouse move event to dispatch, but before handlers executing." - }, - "APZ_HANDLED_WHEEL_EVENT_RECEIVED_MS": { - "alert_emails": ["wpan@mozilla.com"], - "expires_in_version": "60", - "kind": "exponential", - "high": 50000, - "n_buckets": 100, - "bug_numbers": [1341531], - "description": "Time (ms) for the APZ handled wheel event to dispatch, but before handlers executing." } } From a2b874193721513adbfc5e52727e030d48cef2c5 Mon Sep 17 00:00:00 2001 From: Kaku Kuo Date: Sat, 18 Mar 2017 22:34:01 +0800 Subject: [PATCH 51/63] Bug 1348432 - move the mMediaTracksConstructed flag back to MediaDecoder; r=jwwang This mMediaTracksConstructed flag should belong to a MediaDecoder, every time a HTMLMediaElement switches its MediaDecoder, the flag should be reset to false again. So, we move the mMediaTracksConstructed flag back to MediaDecoder, by this way, HTMLMediaElement provides only the mechanism to construct and remove media tracks, and MediaDecoder uses the flag, mMediaTracksConstructed, to provide policy. MozReview-Commit-ID: L7mMAmLjQCy --HG-- extra : rebase_source : 1625d604afb34bffe79eda06a46c9feb780a14d9 --- dom/html/HTMLMediaElement.cpp | 9 +-------- dom/html/HTMLMediaElement.h | 4 ---- dom/media/MediaDecoder.cpp | 35 +++++++++++++++++++++++++++++++---- dom/media/MediaDecoder.h | 16 ++++++++++++++++ 4 files changed, 48 insertions(+), 16 deletions(-) diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp index 6e43f730479e..8e995e0bbb03 100644 --- a/dom/html/HTMLMediaElement.cpp +++ b/dom/html/HTMLMediaElement.cpp @@ -3723,7 +3723,6 @@ HTMLMediaElement::HTMLMediaElement(already_AddRefed& aNo mDefaultPlaybackStartPosition(0.0), mIsAudioTrackAudible(false), mHasSuspendTaint(false), - mMediaTracksConstructed(false), mVisibilityState(Visibility::UNTRACKED), mErrorSink(new ErrorSink(this)), mAudioChannelWrapper(new AudioChannelAgentCallback(this, mAudioChannel)) @@ -7423,11 +7422,7 @@ HTMLMediaElement::GetDocument() const void HTMLMediaElement::ConstructMediaTracks(const MediaInfo* aInfo) { - if (mMediaTracksConstructed || !aInfo) { - return; - } - - mMediaTracksConstructed = true; + MOZ_ASSERT(aInfo); AudioTrackList* audioList = AudioTracks(); if (audioList && aInfo->HasAudio()) { @@ -7461,8 +7456,6 @@ HTMLMediaElement::RemoveMediaTracks() if (videoList) { videoList->RemoveTracks(); } - - mMediaTracksConstructed = false; } class MediaElementGMPCrashHelper : public GMPCrashHelper diff --git a/dom/html/HTMLMediaElement.h b/dom/html/HTMLMediaElement.h index 6dc38cb60152..7fc2caf28cb5 100644 --- a/dom/html/HTMLMediaElement.h +++ b/dom/html/HTMLMediaElement.h @@ -1741,10 +1741,6 @@ private: // participate in video decoder suspending. bool mHasSuspendTaint; - // True if audio tracks and video tracks are constructed and added into the - // track list, false if all tracks are removed from the track list. - bool mMediaTracksConstructed; - Visibility mVisibilityState; UniquePtr mErrorSink; diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp index c7eff0951058..c5ce8dbf45b7 100644 --- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -393,6 +393,7 @@ MediaDecoder::MediaDecoder(MediaDecoderOwner* aOwner) , mPlaybackStatistics(new MediaChannelStatistics()) , mPinnedForSeek(false) , mMinimizePreroll(false) + , mMediaTracksConstructed(false) , mFiredMetadataLoaded(false) , mIsDocumentVisible(false) , mElementVisibility(Visibility::UNTRACKED) @@ -806,7 +807,7 @@ void MediaDecoder::OnMetadataUpdate(TimedMetadata&& aMetadata) { MOZ_ASSERT(NS_IsMainThread()); - GetOwner()->RemoveMediaTracks(); + RemoveMediaTracks(); MetadataLoaded(nsAutoPtr(new MediaInfo(*aMetadata.mInfo)), Move(aMetadata.mTags), MediaDecoderEventVisibility::Observable); @@ -829,7 +830,7 @@ MediaDecoder::MetadataLoaded(nsAutoPtr aInfo, mMediaSeekable = aInfo->mMediaSeekable; mMediaSeekableOnlyInBufferedRanges = aInfo->mMediaSeekableOnlyInBufferedRanges; mInfo = aInfo.forget(); - GetOwner()->ConstructMediaTracks(mInfo); + ConstructMediaTracks(); // Make sure the element and the frame (if any) are told about // our new size. @@ -1194,9 +1195,9 @@ MediaDecoder::ChangeState(PlayState aState) mPlayState = aState; if (mPlayState == PLAY_STATE_PLAYING) { - GetOwner()->ConstructMediaTracks(mInfo); + ConstructMediaTracks(); } else if (IsEnded()) { - GetOwner()->RemoveMediaTracks(); + RemoveMediaTracks(); } } @@ -1763,6 +1764,32 @@ MediaDecoder::GetOwner() const return mOwner; } +void +MediaDecoder::ConstructMediaTracks() +{ + MOZ_ASSERT(NS_IsMainThread()); + MOZ_DIAGNOSTIC_ASSERT(!IsShutdown()); + + if (mMediaTracksConstructed || !mInfo) { + return; + } + + GetOwner()->ConstructMediaTracks(mInfo); + + mMediaTracksConstructed = true; +} + +void +MediaDecoder::RemoveMediaTracks() +{ + MOZ_ASSERT(NS_IsMainThread()); + MOZ_DIAGNOSTIC_ASSERT(!IsShutdown()); + + GetOwner()->RemoveMediaTracks(); + + mMediaTracksConstructed = false; +} + MediaDecoderOwner::NextFrameStatus MediaDecoder::NextFrameBufferedStatus() { diff --git a/dom/media/MediaDecoder.h b/dom/media/MediaDecoder.h index 4caa06301a0e..c3c9dc64e17d 100644 --- a/dom/media/MediaDecoder.h +++ b/dom/media/MediaDecoder.h @@ -400,6 +400,17 @@ private: // change. Call on the main thread only. virtual void ChangeState(PlayState aState); + // Called from MetadataLoaded(). Ask its owner to create audio/video tracks + // and adds them to its owner's audio/video track list. + // Call on the main thread only. + void ConstructMediaTracks(); + + // Ask its owner to remove all audio tracks and video tracks that are + // previously added into the track list. + // Call on the main thread only. + void RemoveMediaTracks(); + + // Called when the video has completed playing. // Call on the main thread only. void PlaybackEnded(); @@ -694,6 +705,11 @@ protected: // or play the media again. bool mMinimizePreroll; + // True if audio tracks and video tracks are constructed and added into the + // owenr's track list, false if all tracks are removed from the owner's track + // list. + bool mMediaTracksConstructed; + // True if we've already fired metadataloaded. bool mFiredMetadataLoaded; From 293e81ff199dfca41e8348d6f876fe8c7ced3982 Mon Sep 17 00:00:00 2001 From: Thomas Nguyen Date: Tue, 21 Mar 2017 16:32:16 +0800 Subject: [PATCH 52/63] Bug 1329808 - Enable V4 completions in Nightly but ignore the result r=francois MozReview-Commit-ID: 75JzdJ4ceS4 --HG-- extra : rebase_source : f0f26d2f7cd4e72745976a8536499b3a00f52893 --- modules/libpref/init/all.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 99c4d6504fda..f70c96de6c5b 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -5208,8 +5208,11 @@ pref("browser.safebrowsing.provider.google.reportMalwareMistakeURL", "https://%L pref("browser.safebrowsing.provider.google4.pver", "4"); pref("browser.safebrowsing.provider.google4.lists", "goog-badbinurl-proto,goog-downloadwhite-proto,goog-phish-proto,googpub-phish-proto,goog-malware-proto,goog-unwanted-proto"); pref("browser.safebrowsing.provider.google4.updateURL", "https://safebrowsing.googleapis.com/v4/threatListUpdates:fetch?$ct=application/x-protobuf&key=%GOOGLE_API_KEY%"); -// Leave it empty until we roll out v4 hash completion feature. See Bug 1323856. +#ifdef NIGHTLY_BUILD +pref("browser.safebrowsing.provider.google4.gethashURL", "https://safebrowsing.googleapis.com/v4/fullHashes:find?$ct=application/x-protobuf&key=%GOOGLE_API_KEY%"); +#else pref("browser.safebrowsing.provider.google4.gethashURL", ""); +#endif // NIGHTLY_BUILD pref("browser.safebrowsing.provider.google4.reportURL", "https://safebrowsing.google.com/safebrowsing/diagnostic?client=%NAME%&hl=%LOCALE%&site="); pref("browser.safebrowsing.provider.google4.reportPhishMistakeURL", "https://%LOCALE%.phish-error.mozilla.com/?hl=%LOCALE%&url="); pref("browser.safebrowsing.provider.google4.reportMalwareMistakeURL", "https://%LOCALE%.malware-error.mozilla.com/?hl=%LOCALE%&url="); From c74aecf8f020d9304277bccb854d316f95368f2d Mon Sep 17 00:00:00 2001 From: Nevin Chen Date: Wed, 22 Feb 2017 14:33:22 +0800 Subject: [PATCH 53/63] Bug 1329155 - Send telemetry when custom tab is used. r=sebastian data-r?bsmedberg MozReview-Commit-ID: 2ulEeO4DPc4 --HG-- extra : rebase_source : e55048375db95946724f9c776a10fb7bc6138946 --- .../java/org/mozilla/gecko/customtabs/CustomTabsActivity.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsActivity.java b/mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsActivity.java index 074f3c883c32..e91505ff8161 100644 --- a/mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsActivity.java +++ b/mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsActivity.java @@ -38,6 +38,8 @@ import org.mozilla.gecko.Tab; import org.mozilla.gecko.Tabs; import org.mozilla.gecko.menu.GeckoMenu; import org.mozilla.gecko.menu.GeckoMenuInflater; +import org.mozilla.gecko.Telemetry; +import org.mozilla.gecko.TelemetryContract; import org.mozilla.gecko.util.ColorUtil; import org.mozilla.gecko.widget.GeckoPopupMenu; @@ -69,6 +71,7 @@ public class CustomTabsActivity extends GeckoApp implements Tabs.OnTabsChangedLi if (savedInstanceState != null) { toolbarColor = savedInstanceState.getInt(SAVED_TOOLBAR_COLOR, DEFAULT_ACTION_BAR_COLOR); } else { + Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, TelemetryContract.Method.INTENT, "customtab"); toolbarColor = getIntent().getIntExtra(EXTRA_TOOLBAR_COLOR, DEFAULT_ACTION_BAR_COLOR); } From fddf20e52215d3883a2f1dadd6cbcfb686d55089 Mon Sep 17 00:00:00 2001 From: Kilik Kuo Date: Wed, 22 Mar 2017 14:12:41 +0800 Subject: [PATCH 54/63] Bug 1348601 - Carry IsHandlingUserInput information to media listeners in content.js. r=mrbkap HTMLMediaElement relies on user's interaction to allow playback when media.autoplay.enabled set to false. MozReview-Commit-ID: IPZdAAKlrjM --HG-- extra : rebase_source : c1654b47fc7b14b1a5b5309c38e60d246edafc54 --- browser/base/content/content.js | 67 ++++++++++++++------------- browser/base/content/nsContextMenu.js | 7 ++- 2 files changed, 41 insertions(+), 33 deletions(-) diff --git a/browser/base/content/content.js b/browser/base/content/content.js index f34d11f9a323..8f241930b50d 100644 --- a/browser/base/content/content.js +++ b/browser/base/content/content.js @@ -804,38 +804,41 @@ addMessageListener("ContextMenu:SaveVideoFrameAsImage", (message) => { }); addMessageListener("ContextMenu:MediaCommand", (message) => { - let media = message.objects.element; - - switch (message.data.command) { - case "play": - media.play(); - break; - case "pause": - media.pause(); - break; - case "loop": - media.loop = !media.loop; - break; - case "mute": - media.muted = true; - break; - case "unmute": - media.muted = false; - break; - case "playbackRate": - media.playbackRate = message.data.data; - break; - case "hidecontrols": - media.removeAttribute("controls"); - break; - case "showcontrols": - media.setAttribute("controls", "true"); - break; - case "fullscreen": - if (content.document.fullscreenEnabled) - media.requestFullscreen(); - break; - } + E10SUtils.wrapHandlingUserInput( + content, message.data.handlingUserInput, + () => { + let media = message.objects.element; + switch (message.data.command) { + case "play": + media.play(); + break; + case "pause": + media.pause(); + break; + case "loop": + media.loop = !media.loop; + break; + case "mute": + media.muted = true; + break; + case "unmute": + media.muted = false; + break; + case "playbackRate": + media.playbackRate = message.data.data; + break; + case "hidecontrols": + media.removeAttribute("controls"); + break; + case "showcontrols": + media.setAttribute("controls", "true"); + break; + case "fullscreen": + if (content.document.fullscreenEnabled) + media.requestFullscreen(); + break; + } + }); }); addMessageListener("ContextMenu:Canvas:ToBlobURL", (message) => { diff --git a/browser/base/content/nsContextMenu.js b/browser/base/content/nsContextMenu.js index a60188a25b0a..90f6904645c9 100644 --- a/browser/base/content/nsContextMenu.js +++ b/browser/base/content/nsContextMenu.js @@ -1741,8 +1741,13 @@ nsContextMenu.prototype = { mediaCommand : function CM_mediaCommand(command, data) { let mm = this.browser.messageManager; + let win = this.browser.ownerGlobal; + let windowUtils = win.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIDOMWindowUtils); mm.sendAsyncMessage("ContextMenu:MediaCommand", - {command: command, data: data}, + {command: command, + data: data, + handlingUserInput: windowUtils.isHandlingUserInput}, {element: this.target}); }, From d4822994da047954beb6744a71e1a6bcc2c8cd1b Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Tue, 21 Mar 2017 16:43:01 +0100 Subject: [PATCH 55/63] Bug 1347712 - Change the testing configurations into ESLint configurations within eslint-plugin-mozilla - structural changes. r=jaws MozReview-Commit-ID: HmNYrVyNiMr --HG-- rename : testing/mochitest/browser.eslintrc.js => tools/lint/eslint/eslint-plugin-mozilla/lib/configs/browser-test.js rename : testing/mochitest/chrome.eslintrc.js => tools/lint/eslint/eslint-plugin-mozilla/lib/configs/chrome-test.js rename : testing/mochitest/mochitest.eslintrc.js => tools/lint/eslint/eslint-plugin-mozilla/lib/configs/mochitest-test.js rename : testing/xpcshell/xpcshell.eslintrc.js => tools/lint/eslint/eslint-plugin-mozilla/lib/configs/xpcshell-test.js extra : rebase_source : 21380c13600e54e5fe86ef2d85518272b8a75de6 --- .../lib/configs/browser-test.js | 8 ++-- .../lib/configs/chrome-test.js | 8 ++-- .../lib/configs/mochitest-test.js | 8 ++-- .../lib/configs/xpcshell-test.js | 7 +++- .../eslint/eslint-plugin-mozilla/lib/index.js | 40 +++++++++++-------- 5 files changed, 43 insertions(+), 28 deletions(-) rename testing/mochitest/browser.eslintrc.js => tools/lint/eslint/eslint-plugin-mozilla/lib/configs/browser-test.js (92%) rename testing/mochitest/chrome.eslintrc.js => tools/lint/eslint/eslint-plugin-mozilla/lib/configs/chrome-test.js (90%) rename testing/mochitest/mochitest.eslintrc.js => tools/lint/eslint/eslint-plugin-mozilla/lib/configs/mochitest-test.js (91%) rename testing/xpcshell/xpcshell.eslintrc.js => tools/lint/eslint/eslint-plugin-mozilla/lib/configs/xpcshell-test.js (95%) diff --git a/testing/mochitest/browser.eslintrc.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/browser-test.js similarity index 92% rename from testing/mochitest/browser.eslintrc.js rename to tools/lint/eslint/eslint-plugin-mozilla/lib/configs/browser-test.js index cbbdb272c112..3dd208efd7d9 100644 --- a/testing/mochitest/browser.eslintrc.js +++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/browser-test.js @@ -1,14 +1,16 @@ // Parent config file for all browser-chrome files. +"use strict"; + module.exports = { "rules": { "mozilla/import-headjs-globals": "warn", - "mozilla/mark-test-function-used": "warn", + "mozilla/mark-test-function-used": "warn" }, "env": { "browser": true, "mozilla/browser-window": true, - "mozilla/simpletest": true, + "mozilla/simpletest": true //"node": true }, @@ -54,6 +56,6 @@ module.exports = { "todo_isnot": false, "waitForClipboard": false, "waitForExplicitFinish": false, - "waitForFocus": false, + "waitForFocus": false } }; diff --git a/testing/mochitest/chrome.eslintrc.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/chrome-test.js similarity index 90% rename from testing/mochitest/chrome.eslintrc.js rename to tools/lint/eslint/eslint-plugin-mozilla/lib/configs/chrome-test.js index 736c2ee32230..c3a8bd07a226 100644 --- a/testing/mochitest/chrome.eslintrc.js +++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/chrome-test.js @@ -1,14 +1,16 @@ // Parent config file for all mochitest files. +"use strict"; + module.exports = { rules: { "mozilla/import-headjs-globals": "warn", - "mozilla/mark-test-function-used": "warn", + "mozilla/mark-test-function-used": "warn" }, "env": { "browser": true, "mozilla/browser-window": true, - "mozilla/simpletest": true, + "mozilla/simpletest": true }, "plugins": [ @@ -47,6 +49,6 @@ module.exports = { "todo_isnot": false, "waitForClipboard": false, "waitForExplicitFinish": false, - "waitForFocus": false, + "waitForFocus": false } }; diff --git a/testing/mochitest/mochitest.eslintrc.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/mochitest-test.js similarity index 91% rename from testing/mochitest/mochitest.eslintrc.js rename to tools/lint/eslint/eslint-plugin-mozilla/lib/configs/mochitest-test.js index d5fa6f3d741f..836b0b7a3989 100644 --- a/testing/mochitest/mochitest.eslintrc.js +++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/mochitest-test.js @@ -1,14 +1,16 @@ // Parent config file for all mochitest files. +"use strict"; + module.exports = { "rules": { "mozilla/import-headjs-globals": "warn", "mozilla/mark-test-function-used": "warn", - "no-shadow": "error", + "no-shadow": "error" }, "env": { "browser": true, - "mozilla/simpletest": true, + "mozilla/simpletest": true }, "plugins": [ @@ -44,6 +46,6 @@ module.exports = { "todo_isnot": false, "waitForClipboard": false, "waitForExplicitFinish": false, - "waitForFocus": false, + "waitForFocus": false } }; diff --git a/testing/xpcshell/xpcshell.eslintrc.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/xpcshell-test.js similarity index 95% rename from testing/xpcshell/xpcshell.eslintrc.js rename to tools/lint/eslint/eslint-plugin-mozilla/lib/configs/xpcshell-test.js index b10c2f6d0b07..e98ab193cfb9 100644 --- a/testing/xpcshell/xpcshell.eslintrc.js +++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/xpcshell-test.js @@ -1,9 +1,11 @@ // Parent config file for all xpcshell files. +"use strict"; + module.exports = { rules: { "mozilla/import-headjs-globals": "warn", "mozilla/mark-test-function-used": "warn", - "no-shadow": "error", + "no-shadow": "error" }, // All globals made available in the test environment. @@ -65,7 +67,8 @@ module.exports = { "todo_check_false": false, "todo_check_true": false, // Firefox specific function. + // eslint-disable-next-line max-len // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/uneval - "uneval": false, + "uneval": false } }; diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/index.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/index.js index 99c88a02fbb7..ea2b84eebcad 100644 --- a/tools/lint/eslint/eslint-plugin-mozilla/lib/index.js +++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/index.js @@ -12,6 +12,12 @@ // Plugin Definition //------------------------------------------------------------------------------ module.exports = { + configs: { + "browser-test": require("../lib/configs/browser-test"), + "chrome-test": require("../lib/configs/chrome-test"), + "mochitest-test": require("../lib/configs/mochitest-test"), + "xpcshell-test": require("../lib/configs/xpcshell-test") + }, environments: { "browser-window": require("../lib/environments/browser-window.js"), "chrome-worker": require("../lib/environments/chrome-worker.js"), @@ -47,22 +53,22 @@ module.exports = { "var-only-at-top-level": require("../lib/rules/var-only-at-top-level") }, rulesConfig: { - "avoid-removeChild": 0, - "avoid-nsISupportsString-preferences": 0, - "balanced-listeners": 0, - "import-globals": 0, - "import-headjs-globals": 0, - "mark-test-function-used": 0, - "no-aArgs": 0, - "no-cpows-in-tests": 0, - "no-single-arg-cu-import": 0, - "no-import-into-var-and-global": 0, - "no-useless-parameters": 0, - "no-useless-removeEventListener": 0, - "reject-importGlobalProperties": 0, - "reject-some-requires": 0, - "use-default-preference-values": 0, - "use-ownerGlobal": 0, - "var-only-at-top-level": 0 + "avoid-removeChild": "off", + "avoid-nsISupportsString-preferences": "off", + "balanced-listeners": "off", + "import-globals": "off", + "import-headjs-globals": "off", + "mark-test-function-used": "off", + "no-aArgs": "off", + "no-cpows-in-tests": "off", + "no-single-arg-cu-import": "off", + "no-import-into-var-and-global": "off", + "no-useless-parameters": "off", + "no-useless-removeEventListener": "off", + "reject-importGlobalProperties": "off", + "reject-some-requires": "off", + "use-default-preference-values": "off", + "use-ownerGlobal": "off", + "var-only-at-top-level": "off" } }; From bd625e4e9f47c7f1b4ada21b11a519b3ebb5d1b0 Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Mon, 20 Mar 2017 12:36:37 +0100 Subject: [PATCH 56/63] Bug 1347712 - Change the testing configurations into ESLint configurations within eslint-plugin-mozilla - automatically update .eslintrc.js test config files for new config locations. r=jaws MozReview-Commit-ID: LH0CQOPfoe6 --HG-- extra : rebase_source : 83eaf40c5cbb5e25cfb3f3b5afadf4fbf0422c92 --- accessible/tests/browser/.eslintrc.js | 2 +- browser/base/content/test/alerts/.eslintrc.js | 2 +- .../content/test/captivePortal/.eslintrc.js | 2 +- browser/base/content/test/chrome/.eslintrc.js | 2 +- .../base/content/test/general/.eslintrc.js | 4 ++-- browser/base/content/test/newtab/.eslintrc.js | 2 +- .../base/content/test/pageinfo/.eslintrc.js | 2 +- .../base/content/test/plugins/.eslintrc.js | 2 +- .../test/popupNotifications/.eslintrc.js | 2 +- .../base/content/test/referrer/.eslintrc.js | 2 +- .../content/test/siteIdentity/.eslintrc.js | 2 +- browser/base/content/test/social/.eslintrc.js | 2 +- .../base/content/test/tabPrompts/.eslintrc.js | 2 +- .../base/content/test/tabcrashed/.eslintrc.js | 2 +- browser/base/content/test/tabs/.eslintrc.js | 2 +- browser/base/content/test/urlbar/.eslintrc.js | 2 +- browser/base/content/test/webrtc/.eslintrc.js | 2 +- .../test/browser/.eslintrc.js | 2 +- .../customizableui/test/.eslintrc.js | 2 +- .../dirprovider/tests/unit/.eslintrc.js | 2 +- .../downloads/test/browser/.eslintrc.js | 2 +- .../downloads/test/unit/.eslintrc.js | 2 +- .../extensions/test/browser/.eslintrc.js | 4 ++-- .../extensions/test/xpcshell/.eslintrc.js | 4 ++-- browser/components/feeds/test/.eslintrc.js | 2 +- .../components/feeds/test/chrome/.eslintrc.js | 2 +- .../components/feeds/test/unit/.eslintrc.js | 2 +- .../migration/tests/browser/.eslintrc.js | 4 ++-- .../migration/tests/unit/.eslintrc.js | 4 ++-- .../newtab/tests/browser/.eslintrc.js | 2 +- .../newtab/tests/xpcshell/.eslintrc.js | 2 +- .../test/browser/.eslintrc.js | 2 +- .../places/tests/browser/.eslintrc.js | 2 +- .../places/tests/chrome/.eslintrc.js | 2 +- .../components/places/tests/unit/.eslintrc.js | 2 +- .../preferences/in-content/tests/.eslintrc.js | 2 +- .../privatebrowsing/test/browser/.eslintrc.js | 2 +- .../safebrowsing/content/test/.eslintrc.js | 2 +- browser/components/search/test/.eslintrc.js | 2 +- .../components/selfsupport/test/.eslintrc.js | 2 +- .../components/sessionstore/test/.eslintrc.js | 2 +- .../sessionstore/test/unit/.eslintrc.js | 2 +- browser/components/shell/test/.eslintrc.js | 2 +- .../components/shell/test/unit/.eslintrc.js | 2 +- .../syncedtabs/test/browser/.eslintrc.js | 2 +- .../syncedtabs/test/xpcshell/.eslintrc.js | 2 +- browser/components/tests/browser/.eslintrc.js | 2 +- browser/components/tests/unit/.eslintrc.js | 2 +- .../components/translation/test/.eslintrc.js | 2 +- .../translation/test/unit/.eslintrc.js | 2 +- browser/components/uitour/test/.eslintrc.js | 2 +- .../experiments/test/xpcshell/.eslintrc.js | 2 +- .../formautofill/test/browser/.eslintrc.js | 4 ++-- .../formautofill/test/unit/.eslintrc.js | 4 ++-- browser/extensions/pdfjs/test/.eslintrc.js | 2 +- browser/extensions/pocket/test/.eslintrc.js | 2 +- .../test/browser/.eslintrc.js | 2 +- .../extensions/webcompat/test/.eslintrc.js | 2 +- browser/modules/test/browser/.eslintrc.js | 2 +- browser/modules/test/unit/.eslintrc.js | 2 +- browser/tools/mozscreenshots/.eslintrc.js | 4 ++-- devtools/.eslintrc.mochitests.js | 2 +- devtools/.eslintrc.xpcshell.js | 10 ++++----- devtools/client/memory/.eslintrc.js | 22 +++++++++---------- .../shared/security/tests/chrome/.eslintrc.js | 2 +- devtools/shared/webconsole/test/.eslintrc.js | 2 +- .../ssl/tests/mochitest/browser/.eslintrc.js | 2 +- .../tests/mochitest/mixedcontent/.eslintrc.js | 2 +- .../stricttransportsecurity/.eslintrc.js | 2 +- security/manager/ssl/tests/unit/.eslintrc.js | 2 +- .../cloudsync/tests/mochitest/.eslintrc.js | 2 +- .../cloudsync/tests/xpcshell/.eslintrc.js | 2 +- services/common/tests/unit/.eslintrc.js | 2 +- .../crypto/component/tests/unit/.eslintrc.js | 2 +- services/crypto/tests/unit/.eslintrc.js | 2 +- .../fxaccounts/tests/browser/.eslintrc.js | 2 +- .../fxaccounts/tests/mochitest/.eslintrc.js | 2 +- .../fxaccounts/tests/xpcshell/.eslintrc.js | 2 +- services/sync/tests/tps/.eslintrc.js | 2 +- services/sync/tests/unit/.eslintrc.js | 2 +- storage/test/unit/.eslintrc.js | 2 +- .../components/aboutmemory/tests/.eslintrc.js | 2 +- .../aboutmemory/tests/xpcshell/.eslintrc.js | 2 +- .../tests/browser/.eslintrc.js | 2 +- .../addoncompat/tests/browser/.eslintrc.js | 2 +- toolkit/components/alerts/test/.eslintrc.js | 2 +- .../asyncshutdown/tests/xpcshell/.eslintrc.js | 2 +- .../autocomplete/tests/unit/.eslintrc.js | 2 +- .../captivedetect/test/unit/.eslintrc.js | 2 +- .../commandlines/test/unit/.eslintrc.js | 2 +- .../commandlines/test/unit_unix/.eslintrc.js | 2 +- .../commandlines/test/unit_win/.eslintrc.js | 2 +- .../contentprefs/tests/mochitest/.eslintrc.js | 2 +- .../contentprefs/tests/unit/.eslintrc.js | 2 +- .../contentprefs/tests/unit_cps2/.eslintrc.js | 2 +- .../tests/unit/.eslintrc.js | 2 +- .../crashes/tests/xpcshell/.eslintrc.js | 2 +- .../crashmonitor/test/unit/.eslintrc.js | 2 +- .../ctypes/tests/chrome/.eslintrc.js | 2 +- .../components/ctypes/tests/unit/.eslintrc.js | 2 +- .../downloads/test/unit/.eslintrc.js | 2 +- .../extensions/test/browser/.eslintrc.js | 6 ++--- .../extensions/test/mochitest/.eslintrc.js | 2 +- .../extensions/test/xpcshell/.eslintrc.js | 4 ++-- toolkit/components/feeds/test/.eslintrc.js | 4 ++-- .../filepicker/test/unit/.eslintrc.js | 2 +- .../filewatcher/tests/xpcshell/.eslintrc.js | 2 +- .../components/formautofill/test/.eslintrc.js | 2 +- .../formautofill/test/browser/.eslintrc.js | 2 +- .../formautofill/test/chrome/.eslintrc.js | 2 +- .../formautofill/test/xpcshell/.eslintrc.js | 2 +- .../jsdownloads/test/browser/.eslintrc.js | 2 +- .../jsdownloads/test/data/.eslintrc.js | 2 +- .../jsdownloads/test/unit/.eslintrc.js | 2 +- .../lz4/tests/xpcshell/.eslintrc.js | 2 +- .../mediasniffer/test/unit/.eslintrc.js | 2 +- toolkit/components/mozintl/test/.eslintrc.js | 2 +- .../components/mozprotocol/tests/.eslintrc.js | 2 +- .../osfile/tests/mochi/.eslintrc.js | 2 +- .../osfile/tests/xpcshell/.eslintrc.js | 2 +- .../components/passwordmgr/test/.eslintrc.js | 4 ++-- .../passwordmgr/test/browser/.eslintrc.js | 2 +- .../passwordmgr/test/unit/.eslintrc.js | 2 +- toolkit/components/perf/.eslintrc.js | 2 +- .../perfmonitoring/tests/browser/.eslintrc.js | 2 +- toolkit/components/places/tests/.eslintrc.js | 6 ++--- .../places/tests/bookmarks/.eslintrc.js | 2 +- .../places/tests/browser/.eslintrc.js | 4 ++-- .../places/tests/chrome/.eslintrc.js | 4 ++-- .../places/tests/expiration/.eslintrc.js | 2 +- .../places/tests/favicons/.eslintrc.js | 2 +- .../places/tests/history/.eslintrc.js | 2 +- .../places/tests/migration/.eslintrc.js | 2 +- .../places/tests/queries/.eslintrc.js | 2 +- .../places/tests/unifiedcomplete/.eslintrc.js | 2 +- .../components/places/tests/unit/.eslintrc.js | 2 +- .../components/printing/tests/.eslintrc.js | 2 +- .../promiseworker/tests/xpcshell/.eslintrc.js | 2 +- toolkit/components/prompts/test/.eslintrc.js | 2 +- toolkit/components/reader/test/.eslintrc.js | 2 +- .../tests/browser/.eslintrc.js | 2 +- toolkit/components/satchel/test/.eslintrc.js | 2 +- .../satchel/test/browser/.eslintrc.js | 2 +- .../components/satchel/test/unit/.eslintrc.js | 2 +- .../search/tests/xpcshell/.eslintrc.js | 2 +- .../social/test/xpcshell/.eslintrc.js | 2 +- .../startup/tests/browser/.eslintrc.js | 2 +- .../startup/tests/unit/.eslintrc.js | 2 +- .../telemetry/tests/browser/.eslintrc.js | 2 +- .../telemetry/tests/unit/.eslintrc.js | 2 +- .../terminator/tests/xpcshell/.eslintrc.js | 2 +- .../components/thumbnails/test/.eslintrc.js | 4 ++-- .../timermanager/tests/unit/.eslintrc.js | 2 +- .../components/tooltiptext/tests/.eslintrc.js | 2 +- .../tests/mochitest/.eslintrc.js | 4 ++-- .../url-classifier/tests/unit/.eslintrc.js | 2 +- .../urlformatter/tests/unit/.eslintrc.js | 2 +- .../components/viewsource/test/.eslintrc.js | 2 +- .../viewsource/test/browser/.eslintrc.js | 2 +- .../windowcreator/test/.eslintrc.js | 6 ++--- .../windowcreator/tests/unit/.eslintrc.js | 2 +- .../windowwatcher/test/.eslintrc.js | 6 ++--- .../workerloader/tests/.eslintrc.js | 2 +- .../xulstore/tests/chrome/.eslintrc.js | 2 +- .../xulstore/tests/xpcshell/.eslintrc.js | 2 +- toolkit/content/tests/browser/.eslintrc.js | 2 +- toolkit/content/tests/chrome/.eslintrc.js | 2 +- toolkit/content/tests/mochitest/.eslintrc.js | 2 +- toolkit/content/tests/unit/.eslintrc.js | 2 +- toolkit/content/tests/widgets/.eslintrc.js | 4 ++-- .../crashreporter/test/browser/.eslintrc.js | 2 +- toolkit/crashreporter/test/unit/.eslintrc.js | 2 +- .../crashreporter/test/unit_ipc/.eslintrc.js | 2 +- .../forgetaboutsite/test/browser/.eslintrc.js | 2 +- .../forgetaboutsite/test/unit/.eslintrc.js | 2 +- .../subprocess/test/xpcshell/.eslintrc.js | 4 ++-- toolkit/modules/tests/browser/.eslintrc.js | 2 +- toolkit/modules/tests/chrome/.eslintrc.js | 2 +- toolkit/modules/tests/modules/.eslintrc.js | 2 +- toolkit/modules/tests/xpcshell/.eslintrc.js | 2 +- .../downloads/tests/chrome/.eslintrc.js | 2 +- .../mozapps/downloads/tests/unit/.eslintrc.js | 2 +- .../extensions/test/browser/.eslintrc.js | 2 +- .../extensions/test/mochitest/.eslintrc.js | 2 +- .../extensions/test/xpcshell/.eslintrc.js | 2 +- .../extensions/test/xpinstall/.eslintrc.js | 4 ++-- .../mozapps/update/tests/chrome/.eslintrc.js | 2 +- .../update/tests/unit_aus_update/.eslintrc.js | 2 +- .../tests/unit_base_updater/.eslintrc.js | 2 +- .../tests/unit_service_updater/.eslintrc.js | 2 +- toolkit/profile/test/.eslintrc.js | 2 +- toolkit/themes/osx/mochitests/.eslintrc.js | 2 +- toolkit/xre/test/.eslintrc.js | 4 ++-- 193 files changed, 234 insertions(+), 234 deletions(-) diff --git a/accessible/tests/browser/.eslintrc.js b/accessible/tests/browser/.eslintrc.js index 53425abc4d5b..4c909e4ab391 100644 --- a/accessible/tests/browser/.eslintrc.js +++ b/accessible/tests/browser/.eslintrc.js @@ -2,7 +2,7 @@ module.exports = { // eslint-disable-line no-undef "extends": [ - "../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ], // All globals made available in the test environment. "globals": { diff --git a/browser/base/content/test/alerts/.eslintrc.js b/browser/base/content/test/alerts/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/browser/base/content/test/alerts/.eslintrc.js +++ b/browser/base/content/test/alerts/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/base/content/test/captivePortal/.eslintrc.js b/browser/base/content/test/captivePortal/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/browser/base/content/test/captivePortal/.eslintrc.js +++ b/browser/base/content/test/captivePortal/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/base/content/test/chrome/.eslintrc.js b/browser/base/content/test/chrome/.eslintrc.js index 8c0f4f574c28..a3b8c411daf9 100644 --- a/browser/base/content/test/chrome/.eslintrc.js +++ b/browser/base/content/test/chrome/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/chrome.eslintrc.js" + "plugin:mozilla/chrome-test" ] }; diff --git a/browser/base/content/test/general/.eslintrc.js b/browser/base/content/test/general/.eslintrc.js index 11abd6140ecf..6746617eebd0 100644 --- a/browser/base/content/test/general/.eslintrc.js +++ b/browser/base/content/test/general/.eslintrc.js @@ -2,7 +2,7 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js", - "../../../../../testing/mochitest/mochitest.eslintrc.js", + "plugin:mozilla/browser-test", + "plugin:mozilla/mochitest-test", ] }; diff --git a/browser/base/content/test/newtab/.eslintrc.js b/browser/base/content/test/newtab/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/browser/base/content/test/newtab/.eslintrc.js +++ b/browser/base/content/test/newtab/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/base/content/test/pageinfo/.eslintrc.js b/browser/base/content/test/pageinfo/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/browser/base/content/test/pageinfo/.eslintrc.js +++ b/browser/base/content/test/pageinfo/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/base/content/test/plugins/.eslintrc.js b/browser/base/content/test/plugins/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/browser/base/content/test/plugins/.eslintrc.js +++ b/browser/base/content/test/plugins/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/base/content/test/popupNotifications/.eslintrc.js b/browser/base/content/test/popupNotifications/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/browser/base/content/test/popupNotifications/.eslintrc.js +++ b/browser/base/content/test/popupNotifications/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/base/content/test/referrer/.eslintrc.js b/browser/base/content/test/referrer/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/browser/base/content/test/referrer/.eslintrc.js +++ b/browser/base/content/test/referrer/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/base/content/test/siteIdentity/.eslintrc.js b/browser/base/content/test/siteIdentity/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/browser/base/content/test/siteIdentity/.eslintrc.js +++ b/browser/base/content/test/siteIdentity/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/base/content/test/social/.eslintrc.js b/browser/base/content/test/social/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/browser/base/content/test/social/.eslintrc.js +++ b/browser/base/content/test/social/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/base/content/test/tabPrompts/.eslintrc.js b/browser/base/content/test/tabPrompts/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/browser/base/content/test/tabPrompts/.eslintrc.js +++ b/browser/base/content/test/tabPrompts/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/base/content/test/tabcrashed/.eslintrc.js b/browser/base/content/test/tabcrashed/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/browser/base/content/test/tabcrashed/.eslintrc.js +++ b/browser/base/content/test/tabcrashed/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/base/content/test/tabs/.eslintrc.js b/browser/base/content/test/tabs/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/browser/base/content/test/tabs/.eslintrc.js +++ b/browser/base/content/test/tabs/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/base/content/test/urlbar/.eslintrc.js b/browser/base/content/test/urlbar/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/browser/base/content/test/urlbar/.eslintrc.js +++ b/browser/base/content/test/urlbar/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/base/content/test/webrtc/.eslintrc.js b/browser/base/content/test/webrtc/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/browser/base/content/test/webrtc/.eslintrc.js +++ b/browser/base/content/test/webrtc/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/components/contextualidentity/test/browser/.eslintrc.js b/browser/components/contextualidentity/test/browser/.eslintrc.js index e25a6863ed67..2feee27762d8 100644 --- a/browser/components/contextualidentity/test/browser/.eslintrc.js +++ b/browser/components/contextualidentity/test/browser/.eslintrc.js @@ -2,7 +2,7 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ], "rules": { diff --git a/browser/components/customizableui/test/.eslintrc.js b/browser/components/customizableui/test/.eslintrc.js index c764b133dc9c..b1c842d8a6db 100644 --- a/browser/components/customizableui/test/.eslintrc.js +++ b/browser/components/customizableui/test/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/components/dirprovider/tests/unit/.eslintrc.js b/browser/components/dirprovider/tests/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/browser/components/dirprovider/tests/unit/.eslintrc.js +++ b/browser/components/dirprovider/tests/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/browser/components/downloads/test/browser/.eslintrc.js b/browser/components/downloads/test/browser/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/browser/components/downloads/test/browser/.eslintrc.js +++ b/browser/components/downloads/test/browser/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/components/downloads/test/unit/.eslintrc.js b/browser/components/downloads/test/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/browser/components/downloads/test/unit/.eslintrc.js +++ b/browser/components/downloads/test/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/browser/components/extensions/test/browser/.eslintrc.js b/browser/components/extensions/test/browser/.eslintrc.js index 0e673ecb9fb5..c2c4cdf37f71 100644 --- a/browser/components/extensions/test/browser/.eslintrc.js +++ b/browser/components/extensions/test/browser/.eslintrc.js @@ -1,7 +1,7 @@ "use strict"; -module.exports = { // eslint-disable-line no-undef - "extends": "../../../../../testing/mochitest/browser.eslintrc.js", +module.exports = { + "extends": "plugin:mozilla/browser-test", "env": { "webextensions": true, diff --git a/browser/components/extensions/test/xpcshell/.eslintrc.js b/browser/components/extensions/test/xpcshell/.eslintrc.js index 2bfe540ea589..e0af9eaf2ae9 100644 --- a/browser/components/extensions/test/xpcshell/.eslintrc.js +++ b/browser/components/extensions/test/xpcshell/.eslintrc.js @@ -1,7 +1,7 @@ "use strict"; -module.exports = { // eslint-disable-line no-undef - "extends": "../../../../../testing/xpcshell/xpcshell.eslintrc.js", +module.exports = { + "extends": "plugin:mozilla/xpcshell-test", "globals": { "browser": false, diff --git a/browser/components/feeds/test/.eslintrc.js b/browser/components/feeds/test/.eslintrc.js index 3c788d6d681c..8c8be53cd53d 100644 --- a/browser/components/feeds/test/.eslintrc.js +++ b/browser/components/feeds/test/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/mochitest.eslintrc.js" + "plugin:mozilla/mochitest-test" ] }; diff --git a/browser/components/feeds/test/chrome/.eslintrc.js b/browser/components/feeds/test/chrome/.eslintrc.js index 8c0f4f574c28..a3b8c411daf9 100644 --- a/browser/components/feeds/test/chrome/.eslintrc.js +++ b/browser/components/feeds/test/chrome/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/chrome.eslintrc.js" + "plugin:mozilla/chrome-test" ] }; diff --git a/browser/components/feeds/test/unit/.eslintrc.js b/browser/components/feeds/test/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/browser/components/feeds/test/unit/.eslintrc.js +++ b/browser/components/feeds/test/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/browser/components/migration/tests/browser/.eslintrc.js b/browser/components/migration/tests/browser/.eslintrc.js index 3ea6eeb8cefa..458793bd837d 100644 --- a/browser/components/migration/tests/browser/.eslintrc.js +++ b/browser/components/migration/tests/browser/.eslintrc.js @@ -2,8 +2,8 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js", - "../../../../../testing/mochitest/mochitest.eslintrc.js", + "plugin:mozilla/browser-test", + "plugin:mozilla/mochitest-test", ] }; diff --git a/browser/components/migration/tests/unit/.eslintrc.js b/browser/components/migration/tests/unit/.eslintrc.js index ba65517f95f2..70fe35407782 100644 --- a/browser/components/migration/tests/unit/.eslintrc.js +++ b/browser/components/migration/tests/unit/.eslintrc.js @@ -1,7 +1,7 @@ "use strict"; -module.exports = { // eslint-disable-line no-undef +module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/browser/components/newtab/tests/browser/.eslintrc.js b/browser/components/newtab/tests/browser/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/browser/components/newtab/tests/browser/.eslintrc.js +++ b/browser/components/newtab/tests/browser/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/components/newtab/tests/xpcshell/.eslintrc.js b/browser/components/newtab/tests/xpcshell/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/browser/components/newtab/tests/xpcshell/.eslintrc.js +++ b/browser/components/newtab/tests/xpcshell/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/browser/components/originattributes/test/browser/.eslintrc.js b/browser/components/originattributes/test/browser/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/browser/components/originattributes/test/browser/.eslintrc.js +++ b/browser/components/originattributes/test/browser/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/components/places/tests/browser/.eslintrc.js b/browser/components/places/tests/browser/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/browser/components/places/tests/browser/.eslintrc.js +++ b/browser/components/places/tests/browser/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/components/places/tests/chrome/.eslintrc.js b/browser/components/places/tests/chrome/.eslintrc.js index 8c0f4f574c28..a3b8c411daf9 100644 --- a/browser/components/places/tests/chrome/.eslintrc.js +++ b/browser/components/places/tests/chrome/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/chrome.eslintrc.js" + "plugin:mozilla/chrome-test" ] }; diff --git a/browser/components/places/tests/unit/.eslintrc.js b/browser/components/places/tests/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/browser/components/places/tests/unit/.eslintrc.js +++ b/browser/components/places/tests/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/browser/components/preferences/in-content/tests/.eslintrc.js b/browser/components/preferences/in-content/tests/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/browser/components/preferences/in-content/tests/.eslintrc.js +++ b/browser/components/preferences/in-content/tests/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/components/privatebrowsing/test/browser/.eslintrc.js b/browser/components/privatebrowsing/test/browser/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/browser/components/privatebrowsing/test/browser/.eslintrc.js +++ b/browser/components/privatebrowsing/test/browser/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/components/safebrowsing/content/test/.eslintrc.js b/browser/components/safebrowsing/content/test/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/browser/components/safebrowsing/content/test/.eslintrc.js +++ b/browser/components/safebrowsing/content/test/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/components/search/test/.eslintrc.js b/browser/components/search/test/.eslintrc.js index c764b133dc9c..b1c842d8a6db 100644 --- a/browser/components/search/test/.eslintrc.js +++ b/browser/components/search/test/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/components/selfsupport/test/.eslintrc.js b/browser/components/selfsupport/test/.eslintrc.js index c764b133dc9c..b1c842d8a6db 100644 --- a/browser/components/selfsupport/test/.eslintrc.js +++ b/browser/components/selfsupport/test/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/components/sessionstore/test/.eslintrc.js b/browser/components/sessionstore/test/.eslintrc.js index c764b133dc9c..b1c842d8a6db 100644 --- a/browser/components/sessionstore/test/.eslintrc.js +++ b/browser/components/sessionstore/test/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/components/sessionstore/test/unit/.eslintrc.js b/browser/components/sessionstore/test/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/browser/components/sessionstore/test/unit/.eslintrc.js +++ b/browser/components/sessionstore/test/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/browser/components/shell/test/.eslintrc.js b/browser/components/shell/test/.eslintrc.js index c764b133dc9c..b1c842d8a6db 100644 --- a/browser/components/shell/test/.eslintrc.js +++ b/browser/components/shell/test/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/components/shell/test/unit/.eslintrc.js b/browser/components/shell/test/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/browser/components/shell/test/unit/.eslintrc.js +++ b/browser/components/shell/test/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/browser/components/syncedtabs/test/browser/.eslintrc.js b/browser/components/syncedtabs/test/browser/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/browser/components/syncedtabs/test/browser/.eslintrc.js +++ b/browser/components/syncedtabs/test/browser/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/components/syncedtabs/test/xpcshell/.eslintrc.js b/browser/components/syncedtabs/test/xpcshell/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/browser/components/syncedtabs/test/xpcshell/.eslintrc.js +++ b/browser/components/syncedtabs/test/xpcshell/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/browser/components/tests/browser/.eslintrc.js b/browser/components/tests/browser/.eslintrc.js index c764b133dc9c..b1c842d8a6db 100644 --- a/browser/components/tests/browser/.eslintrc.js +++ b/browser/components/tests/browser/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/components/tests/unit/.eslintrc.js b/browser/components/tests/unit/.eslintrc.js index fee088c17903..70fe35407782 100644 --- a/browser/components/tests/unit/.eslintrc.js +++ b/browser/components/tests/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/browser/components/translation/test/.eslintrc.js b/browser/components/translation/test/.eslintrc.js index c764b133dc9c..b1c842d8a6db 100644 --- a/browser/components/translation/test/.eslintrc.js +++ b/browser/components/translation/test/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/components/translation/test/unit/.eslintrc.js b/browser/components/translation/test/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/browser/components/translation/test/unit/.eslintrc.js +++ b/browser/components/translation/test/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/browser/components/uitour/test/.eslintrc.js b/browser/components/uitour/test/.eslintrc.js index c764b133dc9c..b1c842d8a6db 100644 --- a/browser/components/uitour/test/.eslintrc.js +++ b/browser/components/uitour/test/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/experiments/test/xpcshell/.eslintrc.js b/browser/experiments/test/xpcshell/.eslintrc.js index 1f540a05bd6b..cfcbb13d7a0d 100644 --- a/browser/experiments/test/xpcshell/.eslintrc.js +++ b/browser/experiments/test/xpcshell/.eslintrc.js @@ -2,7 +2,7 @@ module.exports = { "extends": [ - "../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ], "rules": { diff --git a/browser/extensions/formautofill/test/browser/.eslintrc.js b/browser/extensions/formautofill/test/browser/.eslintrc.js index 52a2004c9d7b..71818fe6506a 100644 --- a/browser/extensions/formautofill/test/browser/.eslintrc.js +++ b/browser/extensions/formautofill/test/browser/.eslintrc.js @@ -1,7 +1,7 @@ "use strict"; -module.exports = { // eslint-disable-line no-undef +module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js", + "plugin:mozilla/browser-test", ], }; diff --git a/browser/extensions/formautofill/test/unit/.eslintrc.js b/browser/extensions/formautofill/test/unit/.eslintrc.js index 00b917082c57..58f8bd73ee48 100644 --- a/browser/extensions/formautofill/test/unit/.eslintrc.js +++ b/browser/extensions/formautofill/test/unit/.eslintrc.js @@ -1,7 +1,7 @@ "use strict"; -module.exports = { // eslint-disable-line no-undef +module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js", + "plugin:mozilla/xpcshell-test", ], }; diff --git a/browser/extensions/pdfjs/test/.eslintrc.js b/browser/extensions/pdfjs/test/.eslintrc.js index c764b133dc9c..b1c842d8a6db 100644 --- a/browser/extensions/pdfjs/test/.eslintrc.js +++ b/browser/extensions/pdfjs/test/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/extensions/pocket/test/.eslintrc.js b/browser/extensions/pocket/test/.eslintrc.js index c764b133dc9c..b1c842d8a6db 100644 --- a/browser/extensions/pocket/test/.eslintrc.js +++ b/browser/extensions/pocket/test/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/extensions/webcompat-reporter/test/browser/.eslintrc.js b/browser/extensions/webcompat-reporter/test/browser/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/browser/extensions/webcompat-reporter/test/browser/.eslintrc.js +++ b/browser/extensions/webcompat-reporter/test/browser/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/extensions/webcompat/test/.eslintrc.js b/browser/extensions/webcompat/test/.eslintrc.js index c764b133dc9c..b1c842d8a6db 100644 --- a/browser/extensions/webcompat/test/.eslintrc.js +++ b/browser/extensions/webcompat/test/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/modules/test/browser/.eslintrc.js b/browser/modules/test/browser/.eslintrc.js index c764b133dc9c..b1c842d8a6db 100644 --- a/browser/modules/test/browser/.eslintrc.js +++ b/browser/modules/test/browser/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/browser/modules/test/unit/.eslintrc.js b/browser/modules/test/unit/.eslintrc.js index fee088c17903..70fe35407782 100644 --- a/browser/modules/test/unit/.eslintrc.js +++ b/browser/modules/test/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/browser/tools/mozscreenshots/.eslintrc.js b/browser/tools/mozscreenshots/.eslintrc.js index 55b05398ea50..d88624afeedf 100644 --- a/browser/tools/mozscreenshots/.eslintrc.js +++ b/browser/tools/mozscreenshots/.eslintrc.js @@ -1,8 +1,8 @@ "use strict"; -module.exports = { // eslint-disable-line no-undef +module.exports = { "extends": [ - "../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ], "rules": { diff --git a/devtools/.eslintrc.mochitests.js b/devtools/.eslintrc.mochitests.js index e371b2779835..06e7ec2bac46 100644 --- a/devtools/.eslintrc.mochitests.js +++ b/devtools/.eslintrc.mochitests.js @@ -1,7 +1,7 @@ // Parent config file for all devtools browser mochitest files. module.exports = { "extends": [ - "../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ], // All globals made available in the test environment. "globals": { diff --git a/devtools/.eslintrc.xpcshell.js b/devtools/.eslintrc.xpcshell.js index a9c8faf8243b..a294a290cba9 100644 --- a/devtools/.eslintrc.xpcshell.js +++ b/devtools/.eslintrc.xpcshell.js @@ -1,19 +1,19 @@ // Parent config file for all devtools xpcshell files. module.exports = { "extends": [ - "../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ], "rules": { // Allow non-camelcase so that run_test doesn't produce a warning. - "camelcase": 0, + "camelcase": "off", // Allow using undefined variables so that tests can refer to functions // and variables defined in head.js files, without having to maintain a // list of globals in each .eslintrc file. // Note that bug 1168340 will eventually help auto-registering globals // from head.js files. - "no-undef": 0, - "block-scoped-var": 0, + "no-undef": "off", + "block-scoped-var": "off", // Tests can always import anything. - "mozilla/reject-some-requires": 0, + "mozilla/reject-some-requires": "off", } }; diff --git a/devtools/client/memory/.eslintrc.js b/devtools/client/memory/.eslintrc.js index ac42ec2ff1c9..b4ac91d5b822 100644 --- a/devtools/client/memory/.eslintrc.js +++ b/devtools/client/memory/.eslintrc.js @@ -1,11 +1,11 @@ -"use strict"; - -module.exports = { - "env": { - "browser": true, - }, - "globals": { - "d3": true, - "dagreD3": true, - } -}; +"use strict"; + +module.exports = { + "env": { + "browser": true, + }, + "globals": { + "d3": true, + "dagreD3": true, + } +}; diff --git a/devtools/shared/security/tests/chrome/.eslintrc.js b/devtools/shared/security/tests/chrome/.eslintrc.js index 6dc0ab32b6e9..406c6a9a3e8f 100644 --- a/devtools/shared/security/tests/chrome/.eslintrc.js +++ b/devtools/shared/security/tests/chrome/.eslintrc.js @@ -2,5 +2,5 @@ module.exports = { // Extend from the shared list of defined globals for mochitests. - "extends": "../../../../../testing/mochitest/chrome.eslintrc.js" + "extends": "plugin:mozilla/chrome-test" }; diff --git a/devtools/shared/webconsole/test/.eslintrc.js b/devtools/shared/webconsole/test/.eslintrc.js index 4dfbaf9a5161..406c6a9a3e8f 100644 --- a/devtools/shared/webconsole/test/.eslintrc.js +++ b/devtools/shared/webconsole/test/.eslintrc.js @@ -2,5 +2,5 @@ module.exports = { // Extend from the shared list of defined globals for mochitests. - "extends": "../../../../testing/mochitest/chrome.eslintrc.js" + "extends": "plugin:mozilla/chrome-test" }; diff --git a/security/manager/ssl/tests/mochitest/browser/.eslintrc.js b/security/manager/ssl/tests/mochitest/browser/.eslintrc.js index c15988365efc..e9603182ee9c 100644 --- a/security/manager/ssl/tests/mochitest/browser/.eslintrc.js +++ b/security/manager/ssl/tests/mochitest/browser/.eslintrc.js @@ -1,5 +1,5 @@ "use strict"; module.exports = { // eslint-disable-line no-undef - "extends": "../../../../../../testing/mochitest/browser.eslintrc.js" + "extends": "plugin:mozilla/browser-test" }; diff --git a/security/manager/ssl/tests/mochitest/mixedcontent/.eslintrc.js b/security/manager/ssl/tests/mochitest/mixedcontent/.eslintrc.js index 6b0e167e9373..7b5c81f1a191 100644 --- a/security/manager/ssl/tests/mochitest/mixedcontent/.eslintrc.js +++ b/security/manager/ssl/tests/mochitest/mixedcontent/.eslintrc.js @@ -1,7 +1,7 @@ "use strict"; module.exports = { // eslint-disable-line no-undef - "extends": "../../../../../../testing/mochitest/mochitest.eslintrc.js", + "extends": "plugin:mozilla/mochitest-test", "rules": { // Boilerplate runTest and afterNavigationtest calls use opening braces on newline. "brace-style": "off" diff --git a/security/manager/ssl/tests/mochitest/stricttransportsecurity/.eslintrc.js b/security/manager/ssl/tests/mochitest/stricttransportsecurity/.eslintrc.js index 74b7a1a07105..13258b931a6c 100644 --- a/security/manager/ssl/tests/mochitest/stricttransportsecurity/.eslintrc.js +++ b/security/manager/ssl/tests/mochitest/stricttransportsecurity/.eslintrc.js @@ -5,5 +5,5 @@ module.exports = { // eslint-disable-line no-undef // use anything not also available to plain mochitests. Since plain mochitests // are the majority, we take the safer option and only extend the // mochitest-plain eslintrc file. - "extends": "../../../../../../testing/mochitest/mochitest.eslintrc.js" + "extends": "plugin:mozilla/mochitest-test" }; diff --git a/security/manager/ssl/tests/unit/.eslintrc.js b/security/manager/ssl/tests/unit/.eslintrc.js index 1f96e78215a7..2a36ab81b2f9 100644 --- a/security/manager/ssl/tests/unit/.eslintrc.js +++ b/security/manager/ssl/tests/unit/.eslintrc.js @@ -1,5 +1,5 @@ "use strict"; module.exports = { // eslint-disable-line no-undef - "extends": "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "extends": "plugin:mozilla/xpcshell-test" }; diff --git a/services/cloudsync/tests/mochitest/.eslintrc.js b/services/cloudsync/tests/mochitest/.eslintrc.js index 2c669d844eb0..a3b8c411daf9 100644 --- a/services/cloudsync/tests/mochitest/.eslintrc.js +++ b/services/cloudsync/tests/mochitest/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/chrome.eslintrc.js" + "plugin:mozilla/chrome-test" ] }; diff --git a/services/cloudsync/tests/xpcshell/.eslintrc.js b/services/cloudsync/tests/xpcshell/.eslintrc.js index fee088c17903..70fe35407782 100644 --- a/services/cloudsync/tests/xpcshell/.eslintrc.js +++ b/services/cloudsync/tests/xpcshell/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/services/common/tests/unit/.eslintrc.js b/services/common/tests/unit/.eslintrc.js index fee088c17903..70fe35407782 100644 --- a/services/common/tests/unit/.eslintrc.js +++ b/services/common/tests/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/services/crypto/component/tests/unit/.eslintrc.js b/services/crypto/component/tests/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/services/crypto/component/tests/unit/.eslintrc.js +++ b/services/crypto/component/tests/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/services/crypto/tests/unit/.eslintrc.js b/services/crypto/tests/unit/.eslintrc.js index fee088c17903..70fe35407782 100644 --- a/services/crypto/tests/unit/.eslintrc.js +++ b/services/crypto/tests/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/services/fxaccounts/tests/browser/.eslintrc.js b/services/fxaccounts/tests/browser/.eslintrc.js index 2c669d844eb0..a3b8c411daf9 100644 --- a/services/fxaccounts/tests/browser/.eslintrc.js +++ b/services/fxaccounts/tests/browser/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/chrome.eslintrc.js" + "plugin:mozilla/chrome-test" ] }; diff --git a/services/fxaccounts/tests/mochitest/.eslintrc.js b/services/fxaccounts/tests/mochitest/.eslintrc.js index 3c788d6d681c..8c8be53cd53d 100644 --- a/services/fxaccounts/tests/mochitest/.eslintrc.js +++ b/services/fxaccounts/tests/mochitest/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/mochitest.eslintrc.js" + "plugin:mozilla/mochitest-test" ] }; diff --git a/services/fxaccounts/tests/xpcshell/.eslintrc.js b/services/fxaccounts/tests/xpcshell/.eslintrc.js index fee088c17903..70fe35407782 100644 --- a/services/fxaccounts/tests/xpcshell/.eslintrc.js +++ b/services/fxaccounts/tests/xpcshell/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/services/sync/tests/tps/.eslintrc.js b/services/sync/tests/tps/.eslintrc.js index f8c4438dc230..fc7c3a4c6a61 100644 --- a/services/sync/tests/tps/.eslintrc.js +++ b/services/sync/tests/tps/.eslintrc.js @@ -2,7 +2,7 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/mochitest.eslintrc.js" + "plugin:mozilla/mochitest-test" ], globals: { diff --git a/services/sync/tests/unit/.eslintrc.js b/services/sync/tests/unit/.eslintrc.js index fee088c17903..70fe35407782 100644 --- a/services/sync/tests/unit/.eslintrc.js +++ b/services/sync/tests/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/storage/test/unit/.eslintrc.js b/storage/test/unit/.eslintrc.js index 9b55b0b68842..70fe35407782 100644 --- a/storage/test/unit/.eslintrc.js +++ b/storage/test/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/aboutmemory/tests/.eslintrc.js b/toolkit/components/aboutmemory/tests/.eslintrc.js index 2c669d844eb0..a3b8c411daf9 100644 --- a/toolkit/components/aboutmemory/tests/.eslintrc.js +++ b/toolkit/components/aboutmemory/tests/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/chrome.eslintrc.js" + "plugin:mozilla/chrome-test" ] }; diff --git a/toolkit/components/aboutmemory/tests/xpcshell/.eslintrc.js b/toolkit/components/aboutmemory/tests/xpcshell/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/aboutmemory/tests/xpcshell/.eslintrc.js +++ b/toolkit/components/aboutmemory/tests/xpcshell/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/aboutperformance/tests/browser/.eslintrc.js b/toolkit/components/aboutperformance/tests/browser/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/toolkit/components/aboutperformance/tests/browser/.eslintrc.js +++ b/toolkit/components/aboutperformance/tests/browser/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/toolkit/components/addoncompat/tests/browser/.eslintrc.js b/toolkit/components/addoncompat/tests/browser/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/toolkit/components/addoncompat/tests/browser/.eslintrc.js +++ b/toolkit/components/addoncompat/tests/browser/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/toolkit/components/alerts/test/.eslintrc.js b/toolkit/components/alerts/test/.eslintrc.js index 3c788d6d681c..8c8be53cd53d 100644 --- a/toolkit/components/alerts/test/.eslintrc.js +++ b/toolkit/components/alerts/test/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/mochitest.eslintrc.js" + "plugin:mozilla/mochitest-test" ] }; diff --git a/toolkit/components/asyncshutdown/tests/xpcshell/.eslintrc.js b/toolkit/components/asyncshutdown/tests/xpcshell/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/asyncshutdown/tests/xpcshell/.eslintrc.js +++ b/toolkit/components/asyncshutdown/tests/xpcshell/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/autocomplete/tests/unit/.eslintrc.js b/toolkit/components/autocomplete/tests/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/autocomplete/tests/unit/.eslintrc.js +++ b/toolkit/components/autocomplete/tests/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/captivedetect/test/unit/.eslintrc.js b/toolkit/components/captivedetect/test/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/captivedetect/test/unit/.eslintrc.js +++ b/toolkit/components/captivedetect/test/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/commandlines/test/unit/.eslintrc.js b/toolkit/components/commandlines/test/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/commandlines/test/unit/.eslintrc.js +++ b/toolkit/components/commandlines/test/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/commandlines/test/unit_unix/.eslintrc.js b/toolkit/components/commandlines/test/unit_unix/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/commandlines/test/unit_unix/.eslintrc.js +++ b/toolkit/components/commandlines/test/unit_unix/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/commandlines/test/unit_win/.eslintrc.js b/toolkit/components/commandlines/test/unit_win/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/commandlines/test/unit_win/.eslintrc.js +++ b/toolkit/components/commandlines/test/unit_win/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/contentprefs/tests/mochitest/.eslintrc.js b/toolkit/components/contentprefs/tests/mochitest/.eslintrc.js index 64a4eda73171..8c8be53cd53d 100644 --- a/toolkit/components/contentprefs/tests/mochitest/.eslintrc.js +++ b/toolkit/components/contentprefs/tests/mochitest/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/mochitest.eslintrc.js" + "plugin:mozilla/mochitest-test" ] }; diff --git a/toolkit/components/contentprefs/tests/unit/.eslintrc.js b/toolkit/components/contentprefs/tests/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/contentprefs/tests/unit/.eslintrc.js +++ b/toolkit/components/contentprefs/tests/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/contentprefs/tests/unit_cps2/.eslintrc.js b/toolkit/components/contentprefs/tests/unit_cps2/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/contentprefs/tests/unit_cps2/.eslintrc.js +++ b/toolkit/components/contentprefs/tests/unit_cps2/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/contextualidentity/tests/unit/.eslintrc.js b/toolkit/components/contextualidentity/tests/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/contextualidentity/tests/unit/.eslintrc.js +++ b/toolkit/components/contextualidentity/tests/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/crashes/tests/xpcshell/.eslintrc.js b/toolkit/components/crashes/tests/xpcshell/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/crashes/tests/xpcshell/.eslintrc.js +++ b/toolkit/components/crashes/tests/xpcshell/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/crashmonitor/test/unit/.eslintrc.js b/toolkit/components/crashmonitor/test/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/crashmonitor/test/unit/.eslintrc.js +++ b/toolkit/components/crashmonitor/test/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/ctypes/tests/chrome/.eslintrc.js b/toolkit/components/ctypes/tests/chrome/.eslintrc.js index 8c0f4f574c28..a3b8c411daf9 100644 --- a/toolkit/components/ctypes/tests/chrome/.eslintrc.js +++ b/toolkit/components/ctypes/tests/chrome/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/chrome.eslintrc.js" + "plugin:mozilla/chrome-test" ] }; diff --git a/toolkit/components/ctypes/tests/unit/.eslintrc.js b/toolkit/components/ctypes/tests/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/ctypes/tests/unit/.eslintrc.js +++ b/toolkit/components/ctypes/tests/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/downloads/test/unit/.eslintrc.js b/toolkit/components/downloads/test/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/downloads/test/unit/.eslintrc.js +++ b/toolkit/components/downloads/test/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/extensions/test/browser/.eslintrc.js b/toolkit/components/extensions/test/browser/.eslintrc.js index 229c4843e80d..1e49d1fa2f31 100644 --- a/toolkit/components/extensions/test/browser/.eslintrc.js +++ b/toolkit/components/extensions/test/browser/.eslintrc.js @@ -1,7 +1,7 @@ "use strict"; -module.exports = { // eslint-disable-line no-undef - "extends": "../../../../../testing/mochitest/mochitest.eslintrc.js", +module.exports = { + "extends": "plugin:mozilla/mochitest-test", "env": { "webextensions": true, @@ -14,6 +14,6 @@ module.exports = { // eslint-disable-line no-undef }, "rules": { - "no-shadow": 0, + "no-shadow": "off", }, }; diff --git a/toolkit/components/extensions/test/mochitest/.eslintrc.js b/toolkit/components/extensions/test/mochitest/.eslintrc.js index debff238bc1b..5fc296a8597e 100644 --- a/toolkit/components/extensions/test/mochitest/.eslintrc.js +++ b/toolkit/components/extensions/test/mochitest/.eslintrc.js @@ -1,7 +1,7 @@ "use strict"; module.exports = { // eslint-disable-line no-undef - "extends": "../../../../../testing/mochitest/mochitest.eslintrc.js", + "extends": "plugin:mozilla/mochitest-test", "env": { "browser": true, diff --git a/toolkit/components/extensions/test/xpcshell/.eslintrc.js b/toolkit/components/extensions/test/xpcshell/.eslintrc.js index 91539a2b90c8..fc9d5727ff2b 100644 --- a/toolkit/components/extensions/test/xpcshell/.eslintrc.js +++ b/toolkit/components/extensions/test/xpcshell/.eslintrc.js @@ -1,7 +1,7 @@ "use strict"; -module.exports = { // eslint-disable-line no-undef - "extends": "../../../../../testing/xpcshell/xpcshell.eslintrc.js", +module.exports = { + "extends": "plugin:mozilla/xpcshell-test", "globals": { "browser": false, diff --git a/toolkit/components/feeds/test/.eslintrc.js b/toolkit/components/feeds/test/.eslintrc.js index 89764b5510e5..f5e163820ec4 100644 --- a/toolkit/components/feeds/test/.eslintrc.js +++ b/toolkit/components/feeds/test/.eslintrc.js @@ -2,7 +2,7 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/chrome.eslintrc.js", - "../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/chrome-test", + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/filepicker/test/unit/.eslintrc.js b/toolkit/components/filepicker/test/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/filepicker/test/unit/.eslintrc.js +++ b/toolkit/components/filepicker/test/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/filewatcher/tests/xpcshell/.eslintrc.js b/toolkit/components/filewatcher/tests/xpcshell/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/filewatcher/tests/xpcshell/.eslintrc.js +++ b/toolkit/components/filewatcher/tests/xpcshell/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/formautofill/test/.eslintrc.js b/toolkit/components/formautofill/test/.eslintrc.js index c764b133dc9c..b1c842d8a6db 100644 --- a/toolkit/components/formautofill/test/.eslintrc.js +++ b/toolkit/components/formautofill/test/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/toolkit/components/formautofill/test/browser/.eslintrc.js b/toolkit/components/formautofill/test/browser/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/toolkit/components/formautofill/test/browser/.eslintrc.js +++ b/toolkit/components/formautofill/test/browser/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/toolkit/components/formautofill/test/chrome/.eslintrc.js b/toolkit/components/formautofill/test/chrome/.eslintrc.js index 8c0f4f574c28..a3b8c411daf9 100644 --- a/toolkit/components/formautofill/test/chrome/.eslintrc.js +++ b/toolkit/components/formautofill/test/chrome/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/chrome.eslintrc.js" + "plugin:mozilla/chrome-test" ] }; diff --git a/toolkit/components/formautofill/test/xpcshell/.eslintrc.js b/toolkit/components/formautofill/test/xpcshell/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/formautofill/test/xpcshell/.eslintrc.js +++ b/toolkit/components/formautofill/test/xpcshell/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/jsdownloads/test/browser/.eslintrc.js b/toolkit/components/jsdownloads/test/browser/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/toolkit/components/jsdownloads/test/browser/.eslintrc.js +++ b/toolkit/components/jsdownloads/test/browser/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/toolkit/components/jsdownloads/test/data/.eslintrc.js b/toolkit/components/jsdownloads/test/data/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/jsdownloads/test/data/.eslintrc.js +++ b/toolkit/components/jsdownloads/test/data/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/jsdownloads/test/unit/.eslintrc.js b/toolkit/components/jsdownloads/test/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/jsdownloads/test/unit/.eslintrc.js +++ b/toolkit/components/jsdownloads/test/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/lz4/tests/xpcshell/.eslintrc.js b/toolkit/components/lz4/tests/xpcshell/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/lz4/tests/xpcshell/.eslintrc.js +++ b/toolkit/components/lz4/tests/xpcshell/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/mediasniffer/test/unit/.eslintrc.js b/toolkit/components/mediasniffer/test/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/mediasniffer/test/unit/.eslintrc.js +++ b/toolkit/components/mediasniffer/test/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/mozintl/test/.eslintrc.js b/toolkit/components/mozintl/test/.eslintrc.js index fee088c17903..70fe35407782 100644 --- a/toolkit/components/mozintl/test/.eslintrc.js +++ b/toolkit/components/mozintl/test/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/mozprotocol/tests/.eslintrc.js b/toolkit/components/mozprotocol/tests/.eslintrc.js index 7c8f827a61f2..b079a3a21e01 100644 --- a/toolkit/components/mozprotocol/tests/.eslintrc.js +++ b/toolkit/components/mozprotocol/tests/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/chrome.eslintrc.js" + "plugin:mozilla/chrome-test" ], }; diff --git a/toolkit/components/osfile/tests/mochi/.eslintrc.js b/toolkit/components/osfile/tests/mochi/.eslintrc.js index 8c0f4f574c28..a3b8c411daf9 100644 --- a/toolkit/components/osfile/tests/mochi/.eslintrc.js +++ b/toolkit/components/osfile/tests/mochi/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/chrome.eslintrc.js" + "plugin:mozilla/chrome-test" ] }; diff --git a/toolkit/components/osfile/tests/xpcshell/.eslintrc.js b/toolkit/components/osfile/tests/xpcshell/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/osfile/tests/xpcshell/.eslintrc.js +++ b/toolkit/components/osfile/tests/xpcshell/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/passwordmgr/test/.eslintrc.js b/toolkit/components/passwordmgr/test/.eslintrc.js index ca626f31ce61..ebf309aa4b2a 100644 --- a/toolkit/components/passwordmgr/test/.eslintrc.js +++ b/toolkit/components/passwordmgr/test/.eslintrc.js @@ -2,8 +2,8 @@ module.exports = { // eslint-disable-line no-undef "extends": [ - "../../../../testing/mochitest/mochitest.eslintrc.js", - "../../../../testing/mochitest/chrome.eslintrc.js" + "plugin:mozilla/mochitest-test", + "plugin:mozilla/chrome-test" ], "rules": { "brace-style": "off", diff --git a/toolkit/components/passwordmgr/test/browser/.eslintrc.js b/toolkit/components/passwordmgr/test/browser/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/toolkit/components/passwordmgr/test/browser/.eslintrc.js +++ b/toolkit/components/passwordmgr/test/browser/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/toolkit/components/passwordmgr/test/unit/.eslintrc.js b/toolkit/components/passwordmgr/test/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/passwordmgr/test/unit/.eslintrc.js +++ b/toolkit/components/passwordmgr/test/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/perf/.eslintrc.js b/toolkit/components/perf/.eslintrc.js index 4e6d4bcf08e2..a3b8c411daf9 100644 --- a/toolkit/components/perf/.eslintrc.js +++ b/toolkit/components/perf/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../testing/mochitest/chrome.eslintrc.js" + "plugin:mozilla/chrome-test" ] }; diff --git a/toolkit/components/perfmonitoring/tests/browser/.eslintrc.js b/toolkit/components/perfmonitoring/tests/browser/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/toolkit/components/perfmonitoring/tests/browser/.eslintrc.js +++ b/toolkit/components/perfmonitoring/tests/browser/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/toolkit/components/places/tests/.eslintrc.js b/toolkit/components/places/tests/.eslintrc.js index d5283c9665bf..6bf1272d1225 100644 --- a/toolkit/components/places/tests/.eslintrc.js +++ b/toolkit/components/places/tests/.eslintrc.js @@ -2,8 +2,8 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/mochitest.eslintrc.js", - "../../../../testing/mochitest/chrome.eslintrc.js", - "../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/mochitest-test", + "plugin:mozilla/chrome-test", + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/places/tests/bookmarks/.eslintrc.js b/toolkit/components/places/tests/bookmarks/.eslintrc.js index 75a6bf7923b8..4e1571513be5 100644 --- a/toolkit/components/places/tests/bookmarks/.eslintrc.js +++ b/toolkit/components/places/tests/bookmarks/.eslintrc.js @@ -2,7 +2,7 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ], "parserOptions": { "ecmaVersion": 8, diff --git a/toolkit/components/places/tests/browser/.eslintrc.js b/toolkit/components/places/tests/browser/.eslintrc.js index 7a41a9cde026..bf2747b9c3a6 100644 --- a/toolkit/components/places/tests/browser/.eslintrc.js +++ b/toolkit/components/places/tests/browser/.eslintrc.js @@ -2,7 +2,7 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js", - "../../../../../testing/mochitest/mochitest.eslintrc.js" + "plugin:mozilla/browser-test", + "plugin:mozilla/mochitest-test" ] }; diff --git a/toolkit/components/places/tests/chrome/.eslintrc.js b/toolkit/components/places/tests/chrome/.eslintrc.js index bf379df8dfeb..69040160a911 100644 --- a/toolkit/components/places/tests/chrome/.eslintrc.js +++ b/toolkit/components/places/tests/chrome/.eslintrc.js @@ -2,7 +2,7 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/chrome.eslintrc.js", - "../../../../../testing/mochitest/mochitest.eslintrc.js" + "plugin:mozilla/chrome-test", + "plugin:mozilla/mochitest-test" ] }; diff --git a/toolkit/components/places/tests/expiration/.eslintrc.js b/toolkit/components/places/tests/expiration/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/places/tests/expiration/.eslintrc.js +++ b/toolkit/components/places/tests/expiration/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/places/tests/favicons/.eslintrc.js b/toolkit/components/places/tests/favicons/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/places/tests/favicons/.eslintrc.js +++ b/toolkit/components/places/tests/favicons/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/places/tests/history/.eslintrc.js b/toolkit/components/places/tests/history/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/places/tests/history/.eslintrc.js +++ b/toolkit/components/places/tests/history/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/places/tests/migration/.eslintrc.js b/toolkit/components/places/tests/migration/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/places/tests/migration/.eslintrc.js +++ b/toolkit/components/places/tests/migration/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/places/tests/queries/.eslintrc.js b/toolkit/components/places/tests/queries/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/places/tests/queries/.eslintrc.js +++ b/toolkit/components/places/tests/queries/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/places/tests/unifiedcomplete/.eslintrc.js b/toolkit/components/places/tests/unifiedcomplete/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/places/tests/unifiedcomplete/.eslintrc.js +++ b/toolkit/components/places/tests/unifiedcomplete/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/places/tests/unit/.eslintrc.js b/toolkit/components/places/tests/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/places/tests/unit/.eslintrc.js +++ b/toolkit/components/places/tests/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/printing/tests/.eslintrc.js b/toolkit/components/printing/tests/.eslintrc.js index 7c8f827a61f2..b079a3a21e01 100644 --- a/toolkit/components/printing/tests/.eslintrc.js +++ b/toolkit/components/printing/tests/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/chrome.eslintrc.js" + "plugin:mozilla/chrome-test" ], }; diff --git a/toolkit/components/promiseworker/tests/xpcshell/.eslintrc.js b/toolkit/components/promiseworker/tests/xpcshell/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/promiseworker/tests/xpcshell/.eslintrc.js +++ b/toolkit/components/promiseworker/tests/xpcshell/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/prompts/test/.eslintrc.js b/toolkit/components/prompts/test/.eslintrc.js index f0d3f7f89879..82bc13016634 100644 --- a/toolkit/components/prompts/test/.eslintrc.js +++ b/toolkit/components/prompts/test/.eslintrc.js @@ -2,7 +2,7 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/mochitest.eslintrc.js" + "plugin:mozilla/mochitest-test" ], "rules": { // ownerGlobal doesn't exist in content privileged windows. diff --git a/toolkit/components/reader/test/.eslintrc.js b/toolkit/components/reader/test/.eslintrc.js index c764b133dc9c..b1c842d8a6db 100644 --- a/toolkit/components/reader/test/.eslintrc.js +++ b/toolkit/components/reader/test/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/toolkit/components/remotebrowserutils/tests/browser/.eslintrc.js b/toolkit/components/remotebrowserutils/tests/browser/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/toolkit/components/remotebrowserutils/tests/browser/.eslintrc.js +++ b/toolkit/components/remotebrowserutils/tests/browser/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/toolkit/components/satchel/test/.eslintrc.js b/toolkit/components/satchel/test/.eslintrc.js index 3c788d6d681c..8c8be53cd53d 100644 --- a/toolkit/components/satchel/test/.eslintrc.js +++ b/toolkit/components/satchel/test/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/mochitest.eslintrc.js" + "plugin:mozilla/mochitest-test" ] }; diff --git a/toolkit/components/satchel/test/browser/.eslintrc.js b/toolkit/components/satchel/test/browser/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/toolkit/components/satchel/test/browser/.eslintrc.js +++ b/toolkit/components/satchel/test/browser/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/toolkit/components/satchel/test/unit/.eslintrc.js b/toolkit/components/satchel/test/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/satchel/test/unit/.eslintrc.js +++ b/toolkit/components/satchel/test/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/search/tests/xpcshell/.eslintrc.js b/toolkit/components/search/tests/xpcshell/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/search/tests/xpcshell/.eslintrc.js +++ b/toolkit/components/search/tests/xpcshell/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/social/test/xpcshell/.eslintrc.js b/toolkit/components/social/test/xpcshell/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/social/test/xpcshell/.eslintrc.js +++ b/toolkit/components/social/test/xpcshell/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/startup/tests/browser/.eslintrc.js b/toolkit/components/startup/tests/browser/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/toolkit/components/startup/tests/browser/.eslintrc.js +++ b/toolkit/components/startup/tests/browser/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/toolkit/components/startup/tests/unit/.eslintrc.js b/toolkit/components/startup/tests/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/startup/tests/unit/.eslintrc.js +++ b/toolkit/components/startup/tests/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/telemetry/tests/browser/.eslintrc.js b/toolkit/components/telemetry/tests/browser/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/toolkit/components/telemetry/tests/browser/.eslintrc.js +++ b/toolkit/components/telemetry/tests/browser/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/toolkit/components/telemetry/tests/unit/.eslintrc.js b/toolkit/components/telemetry/tests/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/telemetry/tests/unit/.eslintrc.js +++ b/toolkit/components/telemetry/tests/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/terminator/tests/xpcshell/.eslintrc.js b/toolkit/components/terminator/tests/xpcshell/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/terminator/tests/xpcshell/.eslintrc.js +++ b/toolkit/components/terminator/tests/xpcshell/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/thumbnails/test/.eslintrc.js b/toolkit/components/thumbnails/test/.eslintrc.js index f6f8d62c2437..c817fbf00fd0 100644 --- a/toolkit/components/thumbnails/test/.eslintrc.js +++ b/toolkit/components/thumbnails/test/.eslintrc.js @@ -2,7 +2,7 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/browser.eslintrc.js", - "../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/browser-test", + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/timermanager/tests/unit/.eslintrc.js b/toolkit/components/timermanager/tests/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/timermanager/tests/unit/.eslintrc.js +++ b/toolkit/components/timermanager/tests/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/tooltiptext/tests/.eslintrc.js b/toolkit/components/tooltiptext/tests/.eslintrc.js index c764b133dc9c..b1c842d8a6db 100644 --- a/toolkit/components/tooltiptext/tests/.eslintrc.js +++ b/toolkit/components/tooltiptext/tests/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/toolkit/components/url-classifier/tests/mochitest/.eslintrc.js b/toolkit/components/url-classifier/tests/mochitest/.eslintrc.js index 58b3df4a7405..5993a0cce3cf 100644 --- a/toolkit/components/url-classifier/tests/mochitest/.eslintrc.js +++ b/toolkit/components/url-classifier/tests/mochitest/.eslintrc.js @@ -2,7 +2,7 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/mochitest.eslintrc.js", - "../../../../../testing/mochitest/chrome.eslintrc.js" + "plugin:mozilla/mochitest-test", + "plugin:mozilla/chrome-test" ] }; diff --git a/toolkit/components/url-classifier/tests/unit/.eslintrc.js b/toolkit/components/url-classifier/tests/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/url-classifier/tests/unit/.eslintrc.js +++ b/toolkit/components/url-classifier/tests/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/urlformatter/tests/unit/.eslintrc.js b/toolkit/components/urlformatter/tests/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/urlformatter/tests/unit/.eslintrc.js +++ b/toolkit/components/urlformatter/tests/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/components/viewsource/test/.eslintrc.js b/toolkit/components/viewsource/test/.eslintrc.js index 2c669d844eb0..a3b8c411daf9 100644 --- a/toolkit/components/viewsource/test/.eslintrc.js +++ b/toolkit/components/viewsource/test/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/chrome.eslintrc.js" + "plugin:mozilla/chrome-test" ] }; diff --git a/toolkit/components/viewsource/test/browser/.eslintrc.js b/toolkit/components/viewsource/test/browser/.eslintrc.js index 7c80211924ef..b1c842d8a6db 100644 --- a/toolkit/components/viewsource/test/browser/.eslintrc.js +++ b/toolkit/components/viewsource/test/browser/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/toolkit/components/windowcreator/test/.eslintrc.js b/toolkit/components/windowcreator/test/.eslintrc.js index a17c2d1b6f65..d331fa263fb0 100644 --- a/toolkit/components/windowcreator/test/.eslintrc.js +++ b/toolkit/components/windowcreator/test/.eslintrc.js @@ -2,8 +2,8 @@ module.exports = { // eslint-disable-line no-undef "extends": [ - "../../../../testing/mochitest/browser.eslintrc.js", - "../../../../testing/mochitest/chrome.eslintrc.js", - "../../../../testing/mochitest/mochitest.eslintrc.js", + "plugin:mozilla/browser-test", + "plugin:mozilla/chrome-test", + "plugin:mozilla/mochitest-test", ] }; diff --git a/toolkit/components/windowcreator/tests/unit/.eslintrc.js b/toolkit/components/windowcreator/tests/unit/.eslintrc.js index 41a50233af81..02e6cc329ffa 100644 --- a/toolkit/components/windowcreator/tests/unit/.eslintrc.js +++ b/toolkit/components/windowcreator/tests/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { // eslint-disable-line no-undef "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js", + "plugin:mozilla/xpcshell-test", ] }; diff --git a/toolkit/components/windowwatcher/test/.eslintrc.js b/toolkit/components/windowwatcher/test/.eslintrc.js index a17c2d1b6f65..d331fa263fb0 100644 --- a/toolkit/components/windowwatcher/test/.eslintrc.js +++ b/toolkit/components/windowwatcher/test/.eslintrc.js @@ -2,8 +2,8 @@ module.exports = { // eslint-disable-line no-undef "extends": [ - "../../../../testing/mochitest/browser.eslintrc.js", - "../../../../testing/mochitest/chrome.eslintrc.js", - "../../../../testing/mochitest/mochitest.eslintrc.js", + "plugin:mozilla/browser-test", + "plugin:mozilla/chrome-test", + "plugin:mozilla/mochitest-test", ] }; diff --git a/toolkit/components/workerloader/tests/.eslintrc.js b/toolkit/components/workerloader/tests/.eslintrc.js index 2c669d844eb0..a3b8c411daf9 100644 --- a/toolkit/components/workerloader/tests/.eslintrc.js +++ b/toolkit/components/workerloader/tests/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/chrome.eslintrc.js" + "plugin:mozilla/chrome-test" ] }; diff --git a/toolkit/components/xulstore/tests/chrome/.eslintrc.js b/toolkit/components/xulstore/tests/chrome/.eslintrc.js index 8c0f4f574c28..a3b8c411daf9 100644 --- a/toolkit/components/xulstore/tests/chrome/.eslintrc.js +++ b/toolkit/components/xulstore/tests/chrome/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/chrome.eslintrc.js" + "plugin:mozilla/chrome-test" ] }; diff --git a/toolkit/components/xulstore/tests/xpcshell/.eslintrc.js b/toolkit/components/xulstore/tests/xpcshell/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/components/xulstore/tests/xpcshell/.eslintrc.js +++ b/toolkit/components/xulstore/tests/xpcshell/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/content/tests/browser/.eslintrc.js b/toolkit/content/tests/browser/.eslintrc.js index c764b133dc9c..b1c842d8a6db 100644 --- a/toolkit/content/tests/browser/.eslintrc.js +++ b/toolkit/content/tests/browser/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/toolkit/content/tests/chrome/.eslintrc.js b/toolkit/content/tests/chrome/.eslintrc.js index 2c669d844eb0..a3b8c411daf9 100644 --- a/toolkit/content/tests/chrome/.eslintrc.js +++ b/toolkit/content/tests/chrome/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/chrome.eslintrc.js" + "plugin:mozilla/chrome-test" ] }; diff --git a/toolkit/content/tests/mochitest/.eslintrc.js b/toolkit/content/tests/mochitest/.eslintrc.js index 3c788d6d681c..8c8be53cd53d 100644 --- a/toolkit/content/tests/mochitest/.eslintrc.js +++ b/toolkit/content/tests/mochitest/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/mochitest.eslintrc.js" + "plugin:mozilla/mochitest-test" ] }; diff --git a/toolkit/content/tests/unit/.eslintrc.js b/toolkit/content/tests/unit/.eslintrc.js index fee088c17903..70fe35407782 100644 --- a/toolkit/content/tests/unit/.eslintrc.js +++ b/toolkit/content/tests/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/content/tests/widgets/.eslintrc.js b/toolkit/content/tests/widgets/.eslintrc.js index e149193751d8..5993a0cce3cf 100644 --- a/toolkit/content/tests/widgets/.eslintrc.js +++ b/toolkit/content/tests/widgets/.eslintrc.js @@ -2,7 +2,7 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/mochitest.eslintrc.js", - "../../../../testing/mochitest/chrome.eslintrc.js" + "plugin:mozilla/mochitest-test", + "plugin:mozilla/chrome-test" ] }; diff --git a/toolkit/crashreporter/test/browser/.eslintrc.js b/toolkit/crashreporter/test/browser/.eslintrc.js index c764b133dc9c..b1c842d8a6db 100644 --- a/toolkit/crashreporter/test/browser/.eslintrc.js +++ b/toolkit/crashreporter/test/browser/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/toolkit/crashreporter/test/unit/.eslintrc.js b/toolkit/crashreporter/test/unit/.eslintrc.js index fee088c17903..70fe35407782 100644 --- a/toolkit/crashreporter/test/unit/.eslintrc.js +++ b/toolkit/crashreporter/test/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/crashreporter/test/unit_ipc/.eslintrc.js b/toolkit/crashreporter/test/unit_ipc/.eslintrc.js index fee088c17903..70fe35407782 100644 --- a/toolkit/crashreporter/test/unit_ipc/.eslintrc.js +++ b/toolkit/crashreporter/test/unit_ipc/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/forgetaboutsite/test/browser/.eslintrc.js b/toolkit/forgetaboutsite/test/browser/.eslintrc.js index c764b133dc9c..b1c842d8a6db 100644 --- a/toolkit/forgetaboutsite/test/browser/.eslintrc.js +++ b/toolkit/forgetaboutsite/test/browser/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/toolkit/forgetaboutsite/test/unit/.eslintrc.js b/toolkit/forgetaboutsite/test/unit/.eslintrc.js index fee088c17903..70fe35407782 100644 --- a/toolkit/forgetaboutsite/test/unit/.eslintrc.js +++ b/toolkit/forgetaboutsite/test/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/modules/subprocess/test/xpcshell/.eslintrc.js b/toolkit/modules/subprocess/test/xpcshell/.eslintrc.js index fc63a79b75a3..2fb33d410074 100644 --- a/toolkit/modules/subprocess/test/xpcshell/.eslintrc.js +++ b/toolkit/modules/subprocess/test/xpcshell/.eslintrc.js @@ -1,5 +1,5 @@ "use strict"; -module.exports = { // eslint-disable-line no-undef - "extends": "../../../../../testing/xpcshell/xpcshell.eslintrc.js", +module.exports = { + "extends": "plugin:mozilla/xpcshell-test", }; diff --git a/toolkit/modules/tests/browser/.eslintrc.js b/toolkit/modules/tests/browser/.eslintrc.js index c764b133dc9c..b1c842d8a6db 100644 --- a/toolkit/modules/tests/browser/.eslintrc.js +++ b/toolkit/modules/tests/browser/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/toolkit/modules/tests/chrome/.eslintrc.js b/toolkit/modules/tests/chrome/.eslintrc.js index 2c669d844eb0..a3b8c411daf9 100644 --- a/toolkit/modules/tests/chrome/.eslintrc.js +++ b/toolkit/modules/tests/chrome/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/chrome.eslintrc.js" + "plugin:mozilla/chrome-test" ] }; diff --git a/toolkit/modules/tests/modules/.eslintrc.js b/toolkit/modules/tests/modules/.eslintrc.js index fee088c17903..70fe35407782 100644 --- a/toolkit/modules/tests/modules/.eslintrc.js +++ b/toolkit/modules/tests/modules/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/modules/tests/xpcshell/.eslintrc.js b/toolkit/modules/tests/xpcshell/.eslintrc.js index fee088c17903..70fe35407782 100644 --- a/toolkit/modules/tests/xpcshell/.eslintrc.js +++ b/toolkit/modules/tests/xpcshell/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/mozapps/downloads/tests/chrome/.eslintrc.js b/toolkit/mozapps/downloads/tests/chrome/.eslintrc.js index 8c0f4f574c28..a3b8c411daf9 100644 --- a/toolkit/mozapps/downloads/tests/chrome/.eslintrc.js +++ b/toolkit/mozapps/downloads/tests/chrome/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/chrome.eslintrc.js" + "plugin:mozilla/chrome-test" ] }; diff --git a/toolkit/mozapps/downloads/tests/unit/.eslintrc.js b/toolkit/mozapps/downloads/tests/unit/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/mozapps/downloads/tests/unit/.eslintrc.js +++ b/toolkit/mozapps/downloads/tests/unit/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/mozapps/extensions/test/browser/.eslintrc.js b/toolkit/mozapps/extensions/test/browser/.eslintrc.js index 34c6b10013d1..d56d7cb16e89 100644 --- a/toolkit/mozapps/extensions/test/browser/.eslintrc.js +++ b/toolkit/mozapps/extensions/test/browser/.eslintrc.js @@ -2,7 +2,7 @@ module.exports = { // eslint-disable-line no-undef "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ], "rules": { diff --git a/toolkit/mozapps/extensions/test/mochitest/.eslintrc.js b/toolkit/mozapps/extensions/test/mochitest/.eslintrc.js index 383da0f41edd..f993edc09041 100644 --- a/toolkit/mozapps/extensions/test/mochitest/.eslintrc.js +++ b/toolkit/mozapps/extensions/test/mochitest/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { // eslint-disable-line no-undef "extends": [ - "../../../../../testing/mochitest/mochitest.eslintrc.js" + "plugin:mozilla/mochitest-test" ] }; diff --git a/toolkit/mozapps/extensions/test/xpcshell/.eslintrc.js b/toolkit/mozapps/extensions/test/xpcshell/.eslintrc.js index d67ce59025e0..95b8c9b7670a 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/.eslintrc.js +++ b/toolkit/mozapps/extensions/test/xpcshell/.eslintrc.js @@ -2,7 +2,7 @@ module.exports = { // eslint-disable-line no-undef "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ], "rules": { "no-unused-vars": ["error", {"args": "none", "varsIgnorePattern": "^(Cc|Ci|Cr|Cu|EXPORTED_SYMBOLS|end_test)$"}], diff --git a/toolkit/mozapps/extensions/test/xpinstall/.eslintrc.js b/toolkit/mozapps/extensions/test/xpinstall/.eslintrc.js index 2852eb81d188..b1c842d8a6db 100644 --- a/toolkit/mozapps/extensions/test/xpinstall/.eslintrc.js +++ b/toolkit/mozapps/extensions/test/xpinstall/.eslintrc.js @@ -1,7 +1,7 @@ "use strict"; -module.exports = { // eslint-disable-line no-undef +module.exports = { "extends": [ - "../../../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/browser-test" ] }; diff --git a/toolkit/mozapps/update/tests/chrome/.eslintrc.js b/toolkit/mozapps/update/tests/chrome/.eslintrc.js index 8c0f4f574c28..a3b8c411daf9 100644 --- a/toolkit/mozapps/update/tests/chrome/.eslintrc.js +++ b/toolkit/mozapps/update/tests/chrome/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/mochitest/chrome.eslintrc.js" + "plugin:mozilla/chrome-test" ] }; diff --git a/toolkit/mozapps/update/tests/unit_aus_update/.eslintrc.js b/toolkit/mozapps/update/tests/unit_aus_update/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/mozapps/update/tests/unit_aus_update/.eslintrc.js +++ b/toolkit/mozapps/update/tests/unit_aus_update/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/mozapps/update/tests/unit_base_updater/.eslintrc.js b/toolkit/mozapps/update/tests/unit_base_updater/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/mozapps/update/tests/unit_base_updater/.eslintrc.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/mozapps/update/tests/unit_service_updater/.eslintrc.js b/toolkit/mozapps/update/tests/unit_service_updater/.eslintrc.js index d35787cd2c49..70fe35407782 100644 --- a/toolkit/mozapps/update/tests/unit_service_updater/.eslintrc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../../testing/xpcshell/xpcshell.eslintrc.js" + "plugin:mozilla/xpcshell-test" ] }; diff --git a/toolkit/profile/test/.eslintrc.js b/toolkit/profile/test/.eslintrc.js index 4e6d4bcf08e2..a3b8c411daf9 100644 --- a/toolkit/profile/test/.eslintrc.js +++ b/toolkit/profile/test/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../testing/mochitest/chrome.eslintrc.js" + "plugin:mozilla/chrome-test" ] }; diff --git a/toolkit/themes/osx/mochitests/.eslintrc.js b/toolkit/themes/osx/mochitests/.eslintrc.js index 2c669d844eb0..a3b8c411daf9 100644 --- a/toolkit/themes/osx/mochitests/.eslintrc.js +++ b/toolkit/themes/osx/mochitests/.eslintrc.js @@ -2,6 +2,6 @@ module.exports = { "extends": [ - "../../../../testing/mochitest/chrome.eslintrc.js" + "plugin:mozilla/chrome-test" ] }; diff --git a/toolkit/xre/test/.eslintrc.js b/toolkit/xre/test/.eslintrc.js index 4305ee69e302..ff1b5b846239 100644 --- a/toolkit/xre/test/.eslintrc.js +++ b/toolkit/xre/test/.eslintrc.js @@ -2,7 +2,7 @@ module.exports = { "extends": [ - "../../../testing/mochitest/mochitest.eslintrc.js", - "../../../testing/mochitest/browser.eslintrc.js" + "plugin:mozilla/mochitest-test", + "plugin:mozilla/browser-test" ] }; From d7d8be9285ef5fa9de0ef806e590aaae4814ea51 Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Wed, 22 Mar 2017 10:43:00 +0100 Subject: [PATCH 57/63] Bug 1347712 - Move toolkit/.eslintrc.js rules into a 'recommended' set within eslint-plugin-mozilla. r=jaws MozReview-Commit-ID: Jy4apKnmWcV --HG-- rename : toolkit/.eslintrc.js => tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js extra : rebase_source : ae0c740c1c2a9cf620c1ac34024622ade12e6fd4 --- browser/.eslintrc.js | 7 +- browser/components/.eslintrc.js | 2 +- js/src/builtin/.eslintrc.js | 2 +- js/src/shell/.eslintrc.js | 2 +- security/manager/.eslintrc.js | 2 +- storage/.eslintrc.js | 2 +- toolkit/.eslintrc.js | 287 +---------------- toolkit/mozapps/extensions/.eslintrc.js | 2 +- .../lib/configs/recommended.js | 299 ++++++++++++++++++ .../eslint/eslint-plugin-mozilla/lib/index.js | 1 + 10 files changed, 317 insertions(+), 289 deletions(-) create mode 100644 tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js diff --git a/browser/.eslintrc.js b/browser/.eslintrc.js index 6f0bffef89c9..0170904faeb6 100644 --- a/browser/.eslintrc.js +++ b/browser/.eslintrc.js @@ -2,11 +2,14 @@ module.exports = { "extends": [ - "../toolkit/.eslintrc.js" + "plugin:mozilla/recommended" ], "rules": { + // XXX Bug 1326071 - This should be reduced down - probably to 20 or to + // be removed & synced with the mozilla/recommended value. + "complexity": ["error", {"max": 40}], + "no-shadow": "error", - "no-undef": "error" } }; diff --git a/browser/components/.eslintrc.js b/browser/components/.eslintrc.js index 63dbf791fa0a..c7f34c63b8b3 100644 --- a/browser/components/.eslintrc.js +++ b/browser/components/.eslintrc.js @@ -3,7 +3,7 @@ module.exports = { rules: { // XXX Bug 1326071 - This should be reduced down - probably to 20 or to - // be removed & synced with the toolkit/.eslintrc.js value. + // be removed & synced with the mozilla/recommended value. "complexity": ["error", {"max": 69}], } }; diff --git a/js/src/builtin/.eslintrc.js b/js/src/builtin/.eslintrc.js index 83bb7ce846ec..458f725de206 100644 --- a/js/src/builtin/.eslintrc.js +++ b/js/src/builtin/.eslintrc.js @@ -2,7 +2,7 @@ module.exports = { "extends": [ - "../../../toolkit/.eslintrc.js" + "plugin:mozilla/recommended" ], "plugins": [ diff --git a/js/src/shell/.eslintrc.js b/js/src/shell/.eslintrc.js index a099e92f0c26..fb19390940ae 100644 --- a/js/src/shell/.eslintrc.js +++ b/js/src/shell/.eslintrc.js @@ -2,7 +2,7 @@ module.exports = { "extends": [ - "../../../toolkit/.eslintrc.js" + "plugin:mozilla/recommended" ], "rules": { diff --git a/security/manager/.eslintrc.js b/security/manager/.eslintrc.js index f6ab1c2c7fe2..94fa37d11665 100644 --- a/security/manager/.eslintrc.js +++ b/security/manager/.eslintrc.js @@ -2,7 +2,7 @@ module.exports = { "extends": [ - "../../toolkit/.eslintrc.js" + "plugin:mozilla/recommended" ], "rules": { // Enforce return statements in callbacks of array methods. diff --git a/storage/.eslintrc.js b/storage/.eslintrc.js index 4784193d1972..34e393ef8d8a 100644 --- a/storage/.eslintrc.js +++ b/storage/.eslintrc.js @@ -2,7 +2,7 @@ module.exports = { "extends": [ - "../toolkit/.eslintrc.js" + "plugin:mozilla/recommended" ], rules: { diff --git a/toolkit/.eslintrc.js b/toolkit/.eslintrc.js index 08be7c9cfcf2..5a3c217ecc6e 100644 --- a/toolkit/.eslintrc.js +++ b/toolkit/.eslintrc.js @@ -1,288 +1,13 @@ "use strict"; module.exports = { - // When adding items to this file please check for effects on all of toolkit - // and browser - "rules": { - // Braces only needed for multi-line arrow function blocks - // "arrow-body-style": ["error", "as-needed"], + extends: [ + "plugin:mozilla/recommended" + ], - // Require spacing around => - "arrow-spacing": "error", - - // Always require spacing around a single line block - "block-spacing": "error", - - // No newline before open brace for a block - "brace-style": ["error", "1tbs", { "allowSingleLine": true }], - - // No space before always a space after a comma - "comma-spacing": ["error", {"before": false, "after": true}], - - // Commas at the end of the line not the start - // "comma-style": "error", - - // Warn about cyclomatic complexity in functions. - // XXX Bug 1326071 - This should be reduced down - probably to 20. + rules: { + // XXX Bug 1326071 - This should be reduced down - probably to 20 or to + // be removed & synced with the mozilla/recommended value. "complexity": ["error", {"max": 48}], - - // Don't require spaces around computed properties - "computed-property-spacing": ["error", "never"], - - // Functions must always return something or nothing - "consistent-return": "error", - - // Require braces around blocks that start a new line - // Note that this rule is likely to be overridden on a per-directory basis - // very frequently. - // "curly": ["error", "multi-line"], - - // Always require a trailing EOL - "eol-last": "error", - - // No spaces between function name and parentheses - "func-call-spacing": "error", - - // Require function* name() - // "generator-star-spacing": ["error", {"before": false, "after": true}], - - // Two space indent - // "indent": ["error", 2, { "SwitchCase": 1 }], - - // Space after colon not before in property declarations - // "key-spacing": ["error", { "beforeColon": false, "afterColon": true, "mode": "minimum" }], - - // Require spaces before and after keywords - "keyword-spacing": "error", - - // Unix linebreaks - "linebreak-style": ["error", "unix"], - - // Don't enforce the maximum depth that blocks can be nested. The complexity - // rule is a better rule to check this. - "max-depth": "off", - - // Always require parenthesis for new calls - // "new-parens": "error", - - // Use [] instead of Array() - // "no-array-constructor": "error", - - // Disallow assignment operators in conditional statements - "no-cond-assign": "error", - - // Disallow the use of debugger - "no-debugger": "error", - - // Disallow deleting variables - "no-delete-var": "error", - - // No duplicate arguments in function declarations - "no-dupe-args": "error", - - // No duplicate keys in object declarations - "no-dupe-keys": "error", - - // No duplicate cases in switch statements - "no-duplicate-case": "error", - - // Disallow unnecessary calls to .bind() - "no-extra-bind": "error", - - // No labels - "no-labels": "error", - - // Disallow unnecessary nested blocks - "no-lone-blocks": "error", - - // If an if block ends with a return no need for an else block - "no-else-return": "error", - - // No empty statements - "no-empty": ["error", {"allowEmptyCatch": true}], - - // No empty character classes in regex - "no-empty-character-class": "error", - - // Disallow empty destructuring - "no-empty-pattern": "error", - - // No assiging to exception variable - "no-ex-assign": "error", - - // No using !! where casting to boolean is already happening - "no-extra-boolean-cast": "error", - - // No double semicolon - "no-extra-semi": "error", - - // No overwriting defined functions - "no-func-assign": "error", - - // No invalid regular expresions - "no-invalid-regexp": "error", - - // No odd whitespace characters - "no-irregular-whitespace": "error", - - // Disallow the use of the __iterator__ property - "no-iterator": "error", - - // No single if block inside an else block - "no-lonely-if": "error", - - // No mixing spaces and tabs in indent - "no-mixed-spaces-and-tabs": ["error", "smart-tabs"], - - // No unnecessary spacing - "no-multi-spaces": ["error", { exceptions: { "AssignmentExpression": true, "VariableDeclarator": true, "ArrayExpression": true, "ObjectExpression": true } }], - - // No reassigning native JS objects - "no-native-reassign": "error", - - // Nested ternary statements are confusing - "no-nested-ternary": "error", - - // Use {} instead of new Object() - "no-new-object": "error", - - // No Math() or JSON() - "no-obj-calls": "error", - - // No octal literals - "no-octal": "error", - - // No redeclaring variables - "no-redeclare": "error", - - // Disallow multiple spaces in regular expressions - "no-regex-spaces": "error", - - // Disallow assignments where both sides are exactly the same - "no-self-assign": "error", - - // No unnecessary comparisons - "no-self-compare": "error", - - // No declaring variables from an outer scope - // "no-shadow": "error", - - // No declaring variables that hide things like arguments - "no-shadow-restricted-names": "error", - - // Disallow sparse arrays - "no-sparse-arrays": "error", - - // No trailing whitespace - "no-trailing-spaces": "error", - - // No using undeclared variables - "no-undef": "error", - - // Error on newline where a semicolon is needed - "no-unexpected-multiline": "error", - - // No unreachable statements - "no-unreachable": "error", - - // Disallow control flow statements in finally blocks - "no-unsafe-finally": "error", - - // No declaring variables that are never used - "no-unused-vars": ["error", { - "vars": "local", - "varsIgnorePattern": "^Cc|Ci|Cu|Cr|EXPORTED_SYMBOLS", - "args": "none", - }], - - // No using variables before defined - // "no-use-before-define": ["error", "nofunc"], - - // Disallow unnecessary .call() and .apply() - "no-useless-call": "error", - - // Disallow redundant return statements - "no-useless-return": "error", - - // No using with - "no-with": "error", - - // Require object-literal shorthand with ES6 method syntax - "object-shorthand": ["error", "always", { "avoidQuotes": true }], - - // Require double-quotes everywhere, except where quotes are escaped - // or template literals are used. - "quotes": ["error", "double", { "avoidEscape": true, "allowTemplateLiterals": true }], - - // No spacing inside rest or spread expressions - "rest-spread-spacing": "error", - - // Always require semicolon at end of statement - // "semi": ["error", "always"], - - // Require space before blocks - "space-before-blocks": "error", - - // Never use spaces before function parentheses - "space-before-function-paren": ["error", "never"], - - // No space padding in parentheses - // "space-in-parens": ["error", "never"], - - // Require spaces around operators - "space-infix-ops": ["error", { "int32Hint": true }], - - // ++ and -- should not need spacing - "space-unary-ops": ["error", { - "words": true, - "nonwords": false, - "overrides": { - "typeof": false // We tend to use typeof as a function call - } - }], - - // Requires or disallows a whitespace (space or tab) beginning a comment - "spaced-comment": "error", - - // No comparisons to NaN - "use-isnan": "error", - - // Only check typeof against valid results - "valid-typeof": "error", - - // Don't concatenate string literals together (unless they span multiple - // lines) - "no-useless-concat": "error", - }, - "env": { - "es6": true, - "browser": true, - }, - "globals": { - "BroadcastChannel": false, - // Specific to Firefox (Chrome code only). - "ChromeWindow": false, - "ChromeWorker": false, - "ChromeUtils": false, - "Components": false, - "dump": true, - // Specific to Firefox - // https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/InternalError - "InternalError": true, - "KeyEvent": false, - "openDialog": false, - "MenuBoxObject": false, - // Specific to Firefox (Chrome code only). - "MozSelfSupport": false, - "SimpleGestureEvent": false, - "sizeToContent": false, - "SharedArrayBuffer": false, - // Note: StopIteration will likely be removed as part of removing legacy - // generators, see bug 968038. - "StopIteration": false, - // Specific to Firefox - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/uneval - "uneval": false, - "XULElement": false, } }; diff --git a/toolkit/mozapps/extensions/.eslintrc.js b/toolkit/mozapps/extensions/.eslintrc.js index 907fbc669140..e4926123f907 100644 --- a/toolkit/mozapps/extensions/.eslintrc.js +++ b/toolkit/mozapps/extensions/.eslintrc.js @@ -4,7 +4,7 @@ module.exports = { // eslint-disable-line no-undef "rules": { // Warn about cyclomatic complexity in functions. // XXX Bug 1326071 - This should be reduced down - probably to 20 or to - // be removed & synced with the toolkit/.eslintrc.js value. + // be removed & synced with the mozilla/recommended value. "complexity": ["error", {"max": 60}], // No using undeclared variables diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js new file mode 100644 index 000000000000..333047fd0973 --- /dev/null +++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js @@ -0,0 +1,299 @@ +"use strict"; + +module.exports = { + // When adding items to this file please check for effects on all of toolkit + // and browser + "rules": { + // Braces only needed for multi-line arrow function blocks + // "arrow-body-style": ["error", "as-needed"], + + // Require spacing around => + "arrow-spacing": "error", + + // Always require spacing around a single line block + "block-spacing": "error", + + // No newline before open brace for a block + "brace-style": ["error", "1tbs", { "allowSingleLine": true }], + + // No space before always a space after a comma + "comma-spacing": ["error", {"before": false, "after": true}], + + // Commas at the end of the line not the start + // "comma-style": "error", + + // Warn about cyclomatic complexity in functions. + // XXX Get this down to 20? + "complexity": ["error", {"max": 35}], + + // Don't require spaces around computed properties + "computed-property-spacing": ["error", "never"], + + // Functions must always return something or nothing + "consistent-return": "error", + + // Require braces around blocks that start a new line + // Note that this rule is likely to be overridden on a per-directory basis + // very frequently. + // "curly": ["error", "multi-line"], + + // Always require a trailing EOL + "eol-last": "error", + + // No spaces between function name and parentheses + "func-call-spacing": "error", + + // Require function* name() + // "generator-star-spacing": ["error", {"before": false, "after": true}], + + // Two space indent + // "indent": ["error", 2, { "SwitchCase": 1 }], + + // Space after colon not before in property declarations + // "key-spacing": ["error", { "beforeColon": false, "afterColon": true, + // "mode": "minimum" }], + + // Require spaces before and after keywords + "keyword-spacing": "error", + + // Unix linebreaks + "linebreak-style": ["error", "unix"], + + // Don't enforce the maximum depth that blocks can be nested. The complexity + // rule is a better rule to check this. + "max-depth": "off", + + // Always require parenthesis for new calls + // "new-parens": "error", + + // Use [] instead of Array() + // "no-array-constructor": "error", + + // Disallow assignment operators in conditional statements + "no-cond-assign": "error", + + // Disallow the use of debugger + "no-debugger": "error", + + // Disallow deleting variables + "no-delete-var": "error", + + // No duplicate arguments in function declarations + "no-dupe-args": "error", + + // No duplicate keys in object declarations + "no-dupe-keys": "error", + + // No duplicate cases in switch statements + "no-duplicate-case": "error", + + // Disallow unnecessary calls to .bind() + "no-extra-bind": "error", + + // No labels + "no-labels": "error", + + // Disallow unnecessary nested blocks + "no-lone-blocks": "error", + + // If an if block ends with a return no need for an else block + "no-else-return": "error", + + // No empty statements + "no-empty": ["error", {"allowEmptyCatch": true}], + + // No empty character classes in regex + "no-empty-character-class": "error", + + // Disallow empty destructuring + "no-empty-pattern": "error", + + // No assiging to exception variable + "no-ex-assign": "error", + + // No using !! where casting to boolean is already happening + "no-extra-boolean-cast": "error", + + // No double semicolon + "no-extra-semi": "error", + + // No overwriting defined functions + "no-func-assign": "error", + + // No invalid regular expresions + "no-invalid-regexp": "error", + + // No odd whitespace characters + "no-irregular-whitespace": "error", + + // Disallow the use of the __iterator__ property + "no-iterator": "error", + + // No single if block inside an else block + "no-lonely-if": "error", + + // No mixing spaces and tabs in indent + "no-mixed-spaces-and-tabs": ["error", "smart-tabs"], + + // No unnecessary spacing + "no-multi-spaces": ["error", { exceptions: { + "AssignmentExpression": true, + "VariableDeclarator": true, + "ArrayExpression": true, + "ObjectExpression": true + } }], + + // No reassigning native JS objects + "no-native-reassign": "error", + + // Nested ternary statements are confusing + "no-nested-ternary": "error", + + // Use {} instead of new Object() + "no-new-object": "error", + + // No Math() or JSON() + "no-obj-calls": "error", + + // No octal literals + "no-octal": "error", + + // No redeclaring variables + "no-redeclare": "error", + + // Disallow multiple spaces in regular expressions + "no-regex-spaces": "error", + + // Disallow assignments where both sides are exactly the same + "no-self-assign": "error", + + // No unnecessary comparisons + "no-self-compare": "error", + + // No declaring variables from an outer scope + // "no-shadow": "error", + + // No declaring variables that hide things like arguments + "no-shadow-restricted-names": "error", + + // Disallow sparse arrays + "no-sparse-arrays": "error", + + // No trailing whitespace + "no-trailing-spaces": "error", + + // No using undeclared variables + "no-undef": "error", + + // Error on newline where a semicolon is needed + "no-unexpected-multiline": "error", + + // No unreachable statements + "no-unreachable": "error", + + // Disallow control flow statements in finally blocks + "no-unsafe-finally": "error", + + // No declaring variables that are never used + "no-unused-vars": ["error", { + "vars": "local", + "varsIgnorePattern": "^Cc|Ci|Cu|Cr|EXPORTED_SYMBOLS", + "args": "none" + }], + + // No using variables before defined + // "no-use-before-define": ["error", "nofunc"], + + // Disallow unnecessary .call() and .apply() + "no-useless-call": "error", + + // Disallow redundant return statements + "no-useless-return": "error", + + // No using with + "no-with": "error", + + // Require object-literal shorthand with ES6 method syntax + "object-shorthand": ["error", "always", { "avoidQuotes": true }], + + // Require double-quotes everywhere, except where quotes are escaped + // or template literals are used. + "quotes": ["error", "double", { + "avoidEscape": true, + "allowTemplateLiterals": true + }], + + // No spacing inside rest or spread expressions + "rest-spread-spacing": "error", + + // Always require semicolon at end of statement + // "semi": ["error", "always"], + + // Require space before blocks + "space-before-blocks": "error", + + // Never use spaces before function parentheses + "space-before-function-paren": ["error", "never"], + + // No space padding in parentheses + // "space-in-parens": ["error", "never"], + + // Require spaces around operators + "space-infix-ops": ["error", { "int32Hint": true }], + + // ++ and -- should not need spacing + "space-unary-ops": ["error", { + "words": true, + "nonwords": false, + "overrides": { + "typeof": false // We tend to use typeof as a function call + } + }], + + // Requires or disallows a whitespace (space or tab) beginning a comment + "spaced-comment": "error", + + // No comparisons to NaN + "use-isnan": "error", + + // Only check typeof against valid results + "valid-typeof": "error", + + // Don't concatenate string literals together (unless they span multiple + // lines) + "no-useless-concat": "error" + }, + "env": { + "es6": true, + "browser": true + }, + "globals": { + "BroadcastChannel": false, + // Specific to Firefox (Chrome code only). + "ChromeWindow": false, + "ChromeWorker": false, + "ChromeUtils": false, + "Components": false, + "dump": true, + // Specific to Firefox + // eslint-disable-next-line max-len + // https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/InternalError + "InternalError": true, + "KeyEvent": false, + "openDialog": false, + "MenuBoxObject": false, + // Specific to Firefox (Chrome code only). + "MozSelfSupport": false, + "SimpleGestureEvent": false, + "sizeToContent": false, + "SharedArrayBuffer": false, + // Note: StopIteration will likely be removed as part of removing legacy + // generators, see bug 968038. + "StopIteration": false, + // Specific to Firefox + // eslint-disable-next-line max-len + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/uneval + "uneval": false, + "XULElement": false + } +}; diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/index.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/index.js index ea2b84eebcad..eb9fe76bb96e 100644 --- a/tools/lint/eslint/eslint-plugin-mozilla/lib/index.js +++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/index.js @@ -16,6 +16,7 @@ module.exports = { "browser-test": require("../lib/configs/browser-test"), "chrome-test": require("../lib/configs/chrome-test"), "mochitest-test": require("../lib/configs/mochitest-test"), + "recommended": require("../lib/configs/recommended"), "xpcshell-test": require("../lib/configs/xpcshell-test") }, environments: { From c225eb988439491c2c082b54c66697301d54bbb9 Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Tue, 21 Mar 2017 15:40:33 +0100 Subject: [PATCH 58/63] Bug 1347712 - Add the tree-wide rules and config to the recommended eslint-plugin-mozilla config, to make it easier for outside projects. r=jaws MozReview-Commit-ID: K7X57ZNppkE --HG-- extra : rebase_source : 697cdbcbbc732a7ae5b538112f3c603943e86692 --- .../lib/configs/recommended.js | 27 ++++++++++++++++--- .../eslint/eslint-plugin-mozilla/package.json | 2 +- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js index 333047fd0973..160099ae7221 100644 --- a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js +++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js @@ -1,9 +1,29 @@ "use strict"; module.exports = { + // When adding items to this file please check for effects on sub-directories. + "plugins": [ + "mozilla" + ], + "env": { + "browser": true, + "es6": true + }, + "parserOptions": { + "ecmaVersion": 8 + }, // When adding items to this file please check for effects on all of toolkit // and browser "rules": { + "mozilla/avoid-removeChild": "error", + "mozilla/avoid-nsISupportsString-preferences": "error", + "mozilla/import-globals": "error", + "mozilla/no-import-into-var-and-global": "error", + "mozilla/no-useless-parameters": "error", + "mozilla/no-useless-removeEventListener": "error", + "mozilla/use-default-preference-values": "error", + "mozilla/use-ownerGlobal": "error", + // Braces only needed for multi-line arrow function blocks // "arrow-body-style": ["error", "as-needed"], @@ -194,6 +214,9 @@ module.exports = { // Disallow control flow statements in finally blocks "no-unsafe-finally": "error", + // No (!foo in bar) or (!object instanceof Class) + "no-unsafe-negation": "error", + // No declaring variables that are never used "no-unused-vars": ["error", { "vars": "local", @@ -263,10 +286,6 @@ module.exports = { // lines) "no-useless-concat": "error" }, - "env": { - "es6": true, - "browser": true - }, "globals": { "BroadcastChannel": false, // Specific to Firefox (Chrome code only). diff --git a/tools/lint/eslint/eslint-plugin-mozilla/package.json b/tools/lint/eslint/eslint-plugin-mozilla/package.json index 99dcae8214eb..06c34ca2a064 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.31", + "version": "0.2.32", "description": "A collection of rules that help enforce JavaScript coding standard in the Mozilla project.", "keywords": [ "eslint", From 1cf3c627476358152b01881da24d13031b584528 Mon Sep 17 00:00:00 2001 From: Kaku Kuo Date: Wed, 22 Mar 2017 14:33:11 +0800 Subject: [PATCH 59/63] Bug 1349456 part 1 - correct indentation; r=jwwang MozReview-Commit-ID: 4i8sQaotJpO --HG-- extra : rebase_source : 601553fb2ac3715b6a89cfb64d8c3d3b8880af25 --- dom/html/HTMLMediaElement.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp index 8e995e0bbb03..ae9f1bfda58d 100644 --- a/dom/html/HTMLMediaElement.cpp +++ b/dom/html/HTMLMediaElement.cpp @@ -3334,7 +3334,7 @@ HTMLMediaElement::CaptureStreamInternal(bool aFinishWhenEnded, { MOZ_RELEASE_ASSERT(aGraph); - MarkAsContentSource(CallerAPI::CAPTURE_STREAM); + MarkAsContentSource(CallerAPI::CAPTURE_STREAM); nsPIDOMWindowInner* window = OwnerDoc()->GetInnerWindow(); if (!window) { From c4629a637df0d06c6af61a02c94ac2d3476ea6d0 Mon Sep 17 00:00:00 2001 From: Kaku Kuo Date: Wed, 22 Mar 2017 14:46:09 +0800 Subject: [PATCH 60/63] Bug 1349456 part 2 - mark elemet as tainted while captured via MozCaptureStream(); r=jwwang MozReview-Commit-ID: 1V776bLuH43 --HG-- extra : rebase_source : 546587dc77dba4931788359a0a80507892594a7d --- dom/html/HTMLMediaElement.cpp | 18 ++++++++++++------ dom/html/HTMLMediaElement.h | 4 ++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp index ae9f1bfda58d..576ca055d467 100644 --- a/dom/html/HTMLMediaElement.cpp +++ b/dom/html/HTMLMediaElement.cpp @@ -1532,12 +1532,7 @@ HTMLMediaElement::SetVisible(bool aVisible) already_AddRefed HTMLMediaElement::GetCurrentImage() { - // Mark the decoder owned by the element as tainted so that the - // suspend-video-decoder is disabled. - mHasSuspendTaint = true; - if (mDecoder) { - mDecoder->SetSuspendTaint(true); - } + MarkAsTainted(); // TODO: In bug 1345404, handle case when video decoder is already suspended. ImageContainer* container = GetImageContainer(); @@ -3335,6 +3330,7 @@ HTMLMediaElement::CaptureStreamInternal(bool aFinishWhenEnded, MOZ_RELEASE_ASSERT(aGraph); MarkAsContentSource(CallerAPI::CAPTURE_STREAM); + MarkAsTainted(); nsPIDOMWindowInner* window = OwnerDoc()->GetInnerWindow(); if (!window) { @@ -7484,6 +7480,16 @@ HTMLMediaElement::CreateGMPCrashHelper() return MakeAndAddRef(this); } +void +HTMLMediaElement::MarkAsTainted() +{ + mHasSuspendTaint = true; + + if (mDecoder) { + mDecoder->SetSuspendTaint(true); + } +} + bool HasDebuggerPrivilege(JSContext* aCx, JSObject* aObj) { return nsContentUtils::CallerHasPermission(aCx, diff --git a/dom/html/HTMLMediaElement.h b/dom/html/HTMLMediaElement.h index 7fc2caf28cb5..6feb096d58f9 100644 --- a/dom/html/HTMLMediaElement.h +++ b/dom/html/HTMLMediaElement.h @@ -1310,6 +1310,10 @@ protected: // Pass information for deciding the video decode mode to decoder. void NotifyDecoderActivityChanges() const; + // Mark the decoder owned by the element as tainted so that the + // suspend-video-decoder is disabled. + void MarkAsTainted(); + // The current decoder. Load() has been called on this decoder. // At most one of mDecoder and mSrcStream can be non-null. RefPtr mDecoder; From 871c76462e176952688b4df1f6c989494f402070 Mon Sep 17 00:00:00 2001 From: Kaku Kuo Date: Wed, 22 Mar 2017 15:03:19 +0800 Subject: [PATCH 61/63] Bug 1349456 part 3 - test element become tainted while captured via MozCaptureStream(); r=jwwang MozReview-Commit-ID: 4nJHwZjZ2zG --HG-- extra : rebase_source : 4e43cea30088b3e1f4858ace2a1bbe7f85c540fe --- dom/media/test/mochitest.ini | 3 ++ ...ground_video_tainted_by_capturestream.html | 46 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 dom/media/test/test_background_video_tainted_by_capturestream.html diff --git a/dom/media/test/mochitest.ini b/dom/media/test/mochitest.ini index 91fe6fd9a543..0f9647c8275d 100644 --- a/dom/media/test/mochitest.ini +++ b/dom/media/test/mochitest.ini @@ -1149,6 +1149,9 @@ tags = suspend [test_background_video_suspend_ends.html] skip-if = toolkit == 'android' # bug 1295884, android(bug 1304480, bug 1232305) tags = suspend +[test_background_video_tainted_by_capturestream.html] +skip-if = toolkit == 'android' # bug 1346705 +tags = suspend [test_background_video_tainted_by_drawimage.html] skip-if = toolkit == 'android' # bug 1346705 tags = suspend diff --git a/dom/media/test/test_background_video_tainted_by_capturestream.html b/dom/media/test/test_background_video_tainted_by_capturestream.html new file mode 100644 index 000000000000..64fdad3b15de --- /dev/null +++ b/dom/media/test/test_background_video_tainted_by_capturestream.html @@ -0,0 +1,46 @@ + + +Test Background Video Is Tainted By captureStream + + + + + \ No newline at end of file From 1ae5278f6ad46ecf71fc3cf6367b27e794365f0b Mon Sep 17 00:00:00 2001 From: Kaku Kuo Date: Wed, 22 Mar 2017 15:21:44 +0800 Subject: [PATCH 62/63] Bug 1349459 part 1 - mark element as tainted when CreateImageBitmap() is used; r=jwwang,mattwoodrow In this patch, we simply modify the ImageBitmap::createInternal(..., HTMLMediaElement&, ...) method to use HTMLMediaElement::GetCurrentImage() utility and HTMLMediaElement::GetCurrentImage() marks the videl element as tainted. MozReview-Commit-ID: KyN2xRqKVrr --HG-- extra : rebase_source : 5e0e0400f1848823751cd88f2bbe734bc5aec5fe --- dom/canvas/ImageBitmap.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/dom/canvas/ImageBitmap.cpp b/dom/canvas/ImageBitmap.cpp index b37e593feab0..38a529d4f1ab 100644 --- a/dom/canvas/ImageBitmap.cpp +++ b/dom/canvas/ImageBitmap.cpp @@ -827,15 +827,7 @@ ImageBitmap::CreateInternal(nsIGlobalObject* aGlobal, HTMLVideoElement& aVideoEl } // Create ImageBitmap. - ImageContainer *container = aVideoEl.GetImageContainer(); - - if (!container) { - aRv.Throw(NS_ERROR_NOT_AVAILABLE); - return nullptr; - } - - AutoLockImage lockImage(container); - layers::Image* data = lockImage.GetImage(); + RefPtr data = aVideoEl.GetCurrentImage(); if (!data) { aRv.Throw(NS_ERROR_NOT_AVAILABLE); return nullptr; From 0f173417cb9fc1af13a5622f0749bdb8858d31a5 Mon Sep 17 00:00:00 2001 From: Kaku Kuo Date: Wed, 22 Mar 2017 15:32:03 +0800 Subject: [PATCH 63/63] Bug 1349459 part 2 - test element as tainted when CreateImageBitmap() is used; r=jwwang MozReview-Commit-ID: 6zjugUsA4fZ --HG-- extra : rebase_source : ee9b3cbcb5fed0641b6d7ec230e1d9a17d3098d4 --- dom/media/test/mochitest.ini | 3 ++ ...nd_video_tainted_by_createimagebitmap.html | 42 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 dom/media/test/test_background_video_tainted_by_createimagebitmap.html diff --git a/dom/media/test/mochitest.ini b/dom/media/test/mochitest.ini index 0f9647c8275d..0b446bbc8021 100644 --- a/dom/media/test/mochitest.ini +++ b/dom/media/test/mochitest.ini @@ -1152,6 +1152,9 @@ tags = suspend [test_background_video_tainted_by_capturestream.html] skip-if = toolkit == 'android' # bug 1346705 tags = suspend +[test_background_video_tainted_by_createimagebitmap.html] +skip-if = toolkit == 'android' # bug 1346705 +tags = suspend [test_background_video_tainted_by_drawimage.html] skip-if = toolkit == 'android' # bug 1346705 tags = suspend diff --git a/dom/media/test/test_background_video_tainted_by_createimagebitmap.html b/dom/media/test/test_background_video_tainted_by_createimagebitmap.html new file mode 100644 index 000000000000..cd884f914454 --- /dev/null +++ b/dom/media/test/test_background_video_tainted_by_createimagebitmap.html @@ -0,0 +1,42 @@ + + +Test Background Video Is Tainted By createImageBitmap + + + + + \ No newline at end of file