From 1c7958b26f7a870d84d0c04e521b6d80099d7782 Mon Sep 17 00:00:00 2001 From: Mayank Madan Date: Thu, 1 Mar 2018 02:09:00 +0200 Subject: [PATCH 01/67] Bug 1441129 - "Change the Memory Tool's Snapshot List Item delete button from a div to a button" [r=mratcliffe] --- devtools/client/memory/components/SnapshotListItem.js | 2 +- devtools/client/themes/memory.css | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/devtools/client/memory/components/SnapshotListItem.js b/devtools/client/memory/components/SnapshotListItem.js index c8d1b7f6ea29..cbccb9197989 100644 --- a/devtools/client/memory/components/SnapshotListItem.js +++ b/devtools/client/memory/components/SnapshotListItem.js @@ -91,7 +91,7 @@ class SnapshotListItem extends Component { className: "save", }, L10N.getStr("snapshot.io.save")); - let deleteButton = !snapshot.path ? void 0 : dom.div({ + let deleteButton = !snapshot.path ? void 0 : dom.button({ onClick: () => onDelete(snapshot), className: "delete", title: L10N.getStr("snapshot.io.delete") diff --git a/devtools/client/themes/memory.css b/devtools/client/themes/memory.css index ef0c338b9e28..1962d98429d5 100644 --- a/devtools/client/themes/memory.css +++ b/devtools/client/themes/memory.css @@ -209,9 +209,13 @@ html, body, #app, #memory-tool { .snapshot-list-item .delete { cursor: pointer; + background-color: transparent; + border: 0; + padding: 0; position: relative; min-height: 1em; min-width: 1.3em; + color: currentColor; } .snapshot-list-item .delete::before { From c06004b0d832223eb3869ad5f0b075c334b9a653 Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Thu, 1 Mar 2018 15:36:13 +0100 Subject: [PATCH 02/67] Bug 1437450 - Disable Ion no-clone optimization for regexps if the graph contains try blocks. r=nbp --HG-- extra : rebase_source : fb1731d33366d07bb70a3da1fc8aa0f9efff8513 --- js/src/jit/IonAnalysis.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/js/src/jit/IonAnalysis.cpp b/js/src/jit/IonAnalysis.cpp index bd95ccb67493..de3a516e9423 100644 --- a/js/src/jit/IonAnalysis.cpp +++ b/js/src/jit/IonAnalysis.cpp @@ -2229,6 +2229,12 @@ IsRegExpHoistable(MIRGenerator* mir, MDefinition* regexp, MDefinitionVector& wor bool jit::MakeMRegExpHoistable(MIRGenerator* mir, MIRGraph& graph) { + // If we are compiling try blocks, regular expressions may be observable + // from catch blocks (which Ion does not compile). For now just disable the + // pass in this case. + if (graph.hasTryBlock()) + return true; + MDefinitionVector worklist(graph.alloc()); for (ReversePostorderIterator block(graph.rpoBegin()); block != graph.rpoEnd(); block++) { From 13f14e181bfe5ba09b2a1648ee7bed5f47a9b0e2 Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Thu, 1 Mar 2018 15:37:29 +0100 Subject: [PATCH 03/67] Bug 1441006 - Use unsigned type for SlotsEdge start/count. r=jonco --HG-- extra : rebase_source : 3fa42e2aa75c441668401d0b985b2c6c86a8719d --- js/src/gc/Marking.cpp | 19 +++++++++++-------- js/src/gc/StoreBuffer.h | 20 +++++++++++--------- js/src/jit/VMFunctions.cpp | 5 ++++- 3 files changed, 26 insertions(+), 18 deletions(-) diff --git a/js/src/gc/Marking.cpp b/js/src/gc/Marking.cpp index 0078b4d6726b..a7e4b8dec7e7 100644 --- a/js/src/gc/Marking.cpp +++ b/js/src/gc/Marking.cpp @@ -2777,18 +2777,21 @@ js::gc::StoreBuffer::SlotsEdge::trace(TenuringTracer& mover) const return; if (kind() == ElementKind) { - int32_t initLen = obj->getDenseInitializedLength(); - int32_t numShifted = obj->getElementsHeader()->numShiftedElements(); - int32_t clampedStart = Min(Max(0, start_ - numShifted), initLen); - int32_t clampedEnd = Min(Max(0, start_ + count_ - numShifted), initLen); - MOZ_ASSERT(clampedStart >= 0); + uint32_t initLen = obj->getDenseInitializedLength(); + uint32_t numShifted = obj->getElementsHeader()->numShiftedElements(); + uint32_t clampedStart = start_; + clampedStart = numShifted < clampedStart ? clampedStart - numShifted : 0; + clampedStart = Min(clampedStart, initLen); + uint32_t clampedEnd = start_ + count_; + clampedEnd = numShifted < clampedEnd ? clampedEnd - numShifted : 0; + clampedEnd = Min(clampedEnd, initLen); MOZ_ASSERT(clampedStart <= clampedEnd); mover.traceSlots(static_cast(obj->getDenseElements() + clampedStart) ->unsafeUnbarrieredForTracing(), clampedEnd - clampedStart); } else { - int32_t start = Min(uint32_t(start_), obj->slotSpan()); - int32_t end = Min(uint32_t(start_) + count_, obj->slotSpan()); - MOZ_ASSERT(end >= start); + uint32_t start = Min(start_, obj->slotSpan()); + uint32_t end = Min(start_ + count_, obj->slotSpan()); + MOZ_ASSERT(start <= end); mover.traceObjectSlots(obj, start, end - start); } } diff --git a/js/src/gc/StoreBuffer.h b/js/src/gc/StoreBuffer.h index 26c40cdb598f..303a438cb703 100644 --- a/js/src/gc/StoreBuffer.h +++ b/js/src/gc/StoreBuffer.h @@ -276,17 +276,17 @@ class StoreBuffer const static int ElementKind = 1; uintptr_t objectAndKind_; // NativeObject* | Kind - int32_t start_; - int32_t count_; + uint32_t start_; + uint32_t count_; SlotsEdge() : objectAndKind_(0), start_(0), count_(0) {} - SlotsEdge(NativeObject* object, int kind, int32_t start, int32_t count) + SlotsEdge(NativeObject* object, int kind, uint32_t start, uint32_t count) : objectAndKind_(uintptr_t(object) | kind), start_(start), count_(count) { MOZ_ASSERT((uintptr_t(object) & 1) == 0); MOZ_ASSERT(kind <= 1); - MOZ_ASSERT(start >= 0); MOZ_ASSERT(count > 0); + MOZ_ASSERT(start + count > start); } NativeObject* object() const { return reinterpret_cast(objectAndKind_ & ~1); } @@ -313,10 +313,12 @@ class StoreBuffer // is particularly useful for coalescing a series of increasing or // decreasing single index writes 0, 1, 2, ..., N into a SlotsEdge // range of elements [0, N]. - auto end = start_ + count_ + 1; - auto start = start_ - 1; + uint32_t end = start_ + count_ + 1; + uint32_t start = start_ > 0 ? start_ - 1 : 0; + MOZ_ASSERT(start < end); - auto otherEnd = other.start_ + other.count_; + uint32_t otherEnd = other.start_ + other.count_; + MOZ_ASSERT(other.start_ <= otherEnd); return (start <= other.start_ && other.start_ <= end) || (start <= otherEnd && otherEnd <= end); } @@ -326,7 +328,7 @@ class StoreBuffer // overlap. void merge(const SlotsEdge& other) { MOZ_ASSERT(overlaps(other)); - auto end = Max(start_ + count_, other.start_ + other.count_); + uint32_t end = Max(start_ + count_, other.start_ + other.count_); start_ = Min(start_, other.start_); count_ = end - start_; } @@ -416,7 +418,7 @@ class StoreBuffer void unputValue(JS::Value* vp) { unput(bufferVal, ValueEdge(vp)); } void putCell(Cell** cellp) { put(bufferCell, CellPtrEdge(cellp)); } void unputCell(Cell** cellp) { unput(bufferCell, CellPtrEdge(cellp)); } - void putSlot(NativeObject* obj, int kind, int32_t start, int32_t count) { + void putSlot(NativeObject* obj, int kind, uint32_t start, uint32_t count) { SlotsEdge edge(obj, kind, start, count); if (bufferSlot.last_.overlaps(edge)) bufferSlot.last_.merge(edge); diff --git a/js/src/jit/VMFunctions.cpp b/js/src/jit/VMFunctions.cpp index ecbc3fe258e1..a3ecb2a82e0d 100644 --- a/js/src/jit/VMFunctions.cpp +++ b/js/src/jit/VMFunctions.cpp @@ -721,7 +721,10 @@ PostWriteElementBarrier(JSRuntime* rt, JSObject* obj, int32_t index) if (InBounds == IndexInBounds::Yes) { MOZ_ASSERT(uint32_t(index) < obj->as().getDenseInitializedLength()); } else { - if (MOZ_UNLIKELY(!obj->is() || index < 0)) { + if (MOZ_UNLIKELY(!obj->is() || + index < 0 || + uint32_t(index) >= NativeObject::MAX_DENSE_ELEMENTS_COUNT)) + { rt->gc.storeBuffer().putWholeCell(obj); return; } From be5a4dadac6bf603da8656ff269aa157616be9bc Mon Sep 17 00:00:00 2001 From: Bob Owen Date: Thu, 1 Mar 2018 14:37:25 +0000 Subject: [PATCH 04/67] Bug 1441801 Part 1: Stop using the chromium sandbox DLL blocking mechanism on Nightly. r=jimm --- .../win/src/sandboxbroker/sandboxBroker.cpp | 52 +------------------ 1 file changed, 1 insertion(+), 51 deletions(-) diff --git a/security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp b/security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp index 6624d68a36e7..404a275db957 100644 --- a/security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp +++ b/security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp @@ -7,9 +7,6 @@ #include "sandboxBroker.h" #include -#if defined(NIGHTLY_BUILD) -#include -#endif #include "base/win/windows_version.h" #include "mozilla/Assertions.h" @@ -31,32 +28,6 @@ #include "sandbox/win/src/security_level.h" #include "WinUtils.h" -#if defined(NIGHTLY_BUILD) - -// This list of DLLs have been found to cause instability in sandboxed child -// processes and so they will be unloaded if they attempt to load. -const std::vector kDllsToUnload = { - // Symantec Corporation (bug 1400637) - L"ffm64.dll", - L"ffm.dll", - L"prntm64.dll", - - // HitmanPro - SurfRight now part of Sophos (bug 1400637) - L"hmpalert.dll", - - // Avast Antivirus (bug 1400637) - L"snxhk64.dll", - L"snxhk.dll", - - // Webroot SecureAnywhere (bug 1400637) - L"wrusr.dll", - - // Comodo Internet Security (bug 1400637) - L"guard32.dll", -}; - -#endif - namespace mozilla { @@ -258,30 +229,9 @@ SandboxBroker::LaunchApp(const wchar_t *aPath, sandbox::TargetPolicy::FILES_ALLOW_ANY, logFileName); } - sandbox::ResultCode result; -#if defined(NIGHTLY_BUILD) - - // Add DLLs to the policy that have been found to cause instability with the - // sandbox, so that they will be unloaded when they attempt to load. - for (std::wstring dllToUnload : kDllsToUnload) { - // Similar to Chromium, we only add a DLL if it is loaded in this process. - if (::GetModuleHandleW(dllToUnload.c_str())) { - result = mPolicy->AddDllToUnload(dllToUnload.c_str()); - MOZ_RELEASE_ASSERT(sandbox::SBOX_ALL_OK == result, - "AddDllToUnload should never fail, what happened?"); - } - } - - // Add K7 Computing DLL to be blocked even if not loaded in the parent, as we - // are still getting crash reports for it. - result = mPolicy->AddDllToUnload(L"k7pswsen.dll"); - MOZ_RELEASE_ASSERT(sandbox::SBOX_ALL_OK == result, - "AddDllToUnload should never fail, what happened?"); - -#endif - // Ceate the sandboxed process PROCESS_INFORMATION targetInfo = {0}; + sandbox::ResultCode result; sandbox::ResultCode last_warning = sandbox::SBOX_ALL_OK; DWORD last_error = ERROR_SUCCESS; result = sBrokerService->SpawnTarget(aPath, aArguments, aEnvironment, mPolicy, From 8efbee59480924681687818f18f7e2a3bdcfd39f Mon Sep 17 00:00:00 2001 From: Bob Owen Date: Thu, 1 Mar 2018 14:37:26 +0000 Subject: [PATCH 05/67] Bug 1441801 Part 2: Fix line endings in sandboxBroker.cpp. r=jimm --- .../win/src/sandboxbroker/sandboxBroker.cpp | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp b/security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp index 404a275db957..5135f5f20437 100644 --- a/security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp +++ b/security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp @@ -727,26 +727,26 @@ SandboxBroker::SetSecurityLevelForPluginProcess(int32_t aSandboxLevel) sandbox::MITIGATION_SEHOP | sandbox::MITIGATION_DEP_NO_ATL_THUNK | sandbox::MITIGATION_DEP | - sandbox::MITIGATION_HARDEN_TOKEN_IL_POLICY | - sandbox::MITIGATION_EXTENSION_POINT_DISABLE | - sandbox::MITIGATION_NONSYSTEM_FONT_DISABLE | - sandbox::MITIGATION_IMAGE_LOAD_PREFER_SYS32; - + sandbox::MITIGATION_HARDEN_TOKEN_IL_POLICY | + sandbox::MITIGATION_EXTENSION_POINT_DISABLE | + sandbox::MITIGATION_NONSYSTEM_FONT_DISABLE | + sandbox::MITIGATION_IMAGE_LOAD_PREFER_SYS32; + if (!sRunningFromNetworkDrive) { mitigations |= sandbox::MITIGATION_IMAGE_LOAD_NO_REMOTE | sandbox::MITIGATION_IMAGE_LOAD_NO_LOW_LABEL; } - - result = mPolicy->SetProcessMitigations(mitigations); - SANDBOX_ENSURE_SUCCESS(result, - "Invalid flags for SetProcessMitigations."); - - sandbox::MitigationFlags delayedMitigations = - sandbox::MITIGATION_DLL_SEARCH_ORDER; - - result = mPolicy->SetDelayedProcessMitigations(delayedMitigations); - SANDBOX_ENSURE_SUCCESS(result, - "Invalid flags for SetDelayedProcessMitigations."); + + result = mPolicy->SetProcessMitigations(mitigations); + SANDBOX_ENSURE_SUCCESS(result, + "Invalid flags for SetProcessMitigations."); + + sandbox::MitigationFlags delayedMitigations = + sandbox::MITIGATION_DLL_SEARCH_ORDER; + + result = mPolicy->SetDelayedProcessMitigations(delayedMitigations); + SANDBOX_ENSURE_SUCCESS(result, + "Invalid flags for SetDelayedProcessMitigations."); if (aSandboxLevel >= 2) { // Level 2 and above uses low integrity, so we need to give write access to From 817abcce88b2f5c5f9045aa6482b23c6695f2ec4 Mon Sep 17 00:00:00 2001 From: Bob Owen Date: Thu, 1 Mar 2018 14:37:26 +0000 Subject: [PATCH 06/67] Bug 1423628: Let not processing native events ride the trains on Windows. r=jimm --- modules/libpref/init/all.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 5e4dc426122a..924f8823ab06 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -3390,7 +3390,7 @@ pref("dom.ipc.processCount.file", 1); pref("dom.ipc.processCount.extension", 1); // Whether a native event loop should be used in the content process. -#if defined(XP_WIN) && defined(NIGHTLY_BUILD) +#if defined(XP_WIN) pref("dom.ipc.useNativeEventProcessing.content", false); #else pref("dom.ipc.useNativeEventProcessing.content", true); From babaf38444833a7cd8d20e2c909ce58eced82000 Mon Sep 17 00:00:00 2001 From: Bob Owen Date: Thu, 1 Mar 2018 14:37:26 +0000 Subject: [PATCH 07/67] Bug 1441824: Let level 5 (Alternate Desktop) for the Windows content sandbox ride the trains. r=jimm --- browser/app/profile/firefox.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 673a1f9b07f9..c27144b26994 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -1047,11 +1047,7 @@ pref("dom.ipc.plugins.sandbox-level.flash", 0); // On windows these levels are: // See - security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp // SetSecurityLevelForContentProcess() for what the different settings mean. -#if defined(NIGHTLY_BUILD) pref("security.sandbox.content.level", 5); -#else -pref("security.sandbox.content.level", 4); -#endif // This controls the depth of stack trace that is logged when Windows sandbox // logging is turned on. This is only currently available for the content From 0e5f8a4da749114b20c430e06bb43e73c26c7811 Mon Sep 17 00:00:00 2001 From: Rail Aliiev Date: Tue, 27 Feb 2018 11:16:20 -0500 Subject: [PATCH 08/67] Bug 1398796 - Add push phase to PARTIAL_UPDATES_FLAVORS r=aki --HG-- extra : rebase_source : a071517974cc93c1757cf6f50d6d027ee4f1ef0b --- taskcluster/taskgraph/actions/release_promotion.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/taskcluster/taskgraph/actions/release_promotion.py b/taskcluster/taskgraph/actions/release_promotion.py index 2b4132e49103..c73c75f0aba0 100644 --- a/taskcluster/taskgraph/actions/release_promotion.py +++ b/taskcluster/taskgraph/actions/release_promotion.py @@ -80,6 +80,9 @@ PARTIAL_UPDATES_FLAVORS = ( 'promote_firefox', 'promote_firefox_rc', 'promote_devedition', + 'push_firefox', + 'push_firefox_rc', + 'push_devedition', 'ship_firefox', 'ship_firefox_rc', 'ship_devedition', From 347966abfbb302bdea6fd048684960b66737cb46 Mon Sep 17 00:00:00 2001 From: Dylan Roeh Date: Thu, 1 Mar 2018 08:49:52 -0500 Subject: [PATCH 09/67] Bug 1432487 - Rename all *Listeners to *Delegates and corresponding minor changes. r=snorp,jchen --- .../java/org/mozilla/gecko/BrowserApp.java | 2 +- .../base/java/org/mozilla/gecko/GeckoApp.java | 12 +- .../gecko/customtabs/ActionBarPresenter.java | 2 +- .../gecko/customtabs/CustomTabsActivity.java | 18 +- .../customtabs/CustomTabsSecurityPopup.java | 2 +- .../mozilla/gecko/webapps/WebAppActivity.java | 26 +-- .../geckoview/test/BaseGeckoViewTest.java | 4 +- .../test/GeckoSessionTestRuleTest.kt | 86 +++++---- .../geckoview/test/NavigationListenerTest.kt | 34 ++-- .../geckoview/test/NavigationTests.java | 20 +-- .../geckoview/test/ProgressListenerTest.kt | 38 ++-- .../geckoview/test/TestRunnerActivity.java | 6 +- .../test/rule/GeckoSessionTestRule.java | 8 +- .../mozilla/geckoview/test/util/Callbacks.kt | 38 ++-- .../org/mozilla/geckoview/GeckoSession.java | 170 +++++++++--------- .../geckoview/GeckoSessionHandler.java | 24 +-- .../BasicGeckoViewPrompt.java | 30 ++-- .../geckoview_example/GeckoViewActivity.java | 22 +-- 18 files changed, 270 insertions(+), 272 deletions(-) diff --git a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java index 9d004b39e688..935101ae1414 100644 --- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java +++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java @@ -3596,7 +3596,7 @@ public class BrowserApp extends GeckoApp super.closeOptionsMenu(); } - @Override // GeckoView.ContentListener + @Override // GeckoView.ContentDelegate public void onFullScreen(final GeckoSession session, final boolean fullscreen) { super.onFullScreen(session, fullscreen); diff --git a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java index 0d828ee9443b..1a4f063c7741 100644 --- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java +++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java @@ -115,7 +115,7 @@ public abstract class GeckoApp extends GeckoActivity BundleEventListener, GeckoMenu.Callback, GeckoMenu.MenuPresenter, - GeckoSession.ContentListener, + GeckoSession.ContentDelegate, ScreenOrientationDelegate, Tabs.OnTabsChangedListener, ViewTreeObserver.OnGlobalLayoutListener { @@ -852,19 +852,19 @@ public abstract class GeckoApp extends GeckoActivity return inSampleSize; } - @Override // GeckoSession.ContentListener + @Override // GeckoSession.ContentDelegate public void onTitleChange(final GeckoSession session, final String title) { } - @Override // GeckoSession.ContentListener + @Override // GeckoSession.ContentDelegate public void onFocusRequest(final GeckoSession session) { } - @Override // GeckoSession.ContentListener + @Override // GeckoSession.ContentDelegate public void onCloseRequest(final GeckoSession session) { } - @Override // GeckoSession.ContentListener + @Override // GeckoSession.ContentDelegate public void onFullScreen(final GeckoSession session, final boolean fullScreen) { if (fullScreen) { SnackbarBuilder.builder(this) @@ -1066,7 +1066,7 @@ public abstract class GeckoApp extends GeckoActivity session.getSettings().setString(GeckoSessionSettings.CHROME_URI, "chrome://browser/content/browser.xul"); - session.setContentListener(this); + session.setContentDelegate(this); GeckoAccessibility.setDelegate(mLayerView); diff --git a/mobile/android/base/java/org/mozilla/gecko/customtabs/ActionBarPresenter.java b/mobile/android/base/java/org/mozilla/gecko/customtabs/ActionBarPresenter.java index d410582066a3..cee8fce272d4 100644 --- a/mobile/android/base/java/org/mozilla/gecko/customtabs/ActionBarPresenter.java +++ b/mobile/android/base/java/org/mozilla/gecko/customtabs/ActionBarPresenter.java @@ -34,7 +34,7 @@ import org.mozilla.gecko.SiteIdentity; import org.mozilla.gecko.Tab; import org.mozilla.gecko.toolbar.SecurityModeUtil; import org.mozilla.gecko.util.ColorUtil; -import org.mozilla.geckoview.GeckoSession.ProgressListener.SecurityInformation; +import org.mozilla.geckoview.GeckoSession.ProgressDelegate.SecurityInformation; import org.mozilla.geckoview.GeckoView; /** 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 04c985ca4e6c..660b94661676 100644 --- a/mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsActivity.java +++ b/mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsActivity.java @@ -73,9 +73,9 @@ import java.util.List; public class CustomTabsActivity extends AppCompatActivity implements ActionModePresenter, GeckoMenu.Callback, - GeckoSession.ContentListener, - GeckoSession.NavigationListener, - GeckoSession.ProgressListener { + GeckoSession.ContentDelegate, + GeckoSession.NavigationDelegate, + GeckoSession.ProgressDelegate { private static final String LOGTAG = "CustomTabsActivity"; @@ -134,9 +134,9 @@ public class CustomTabsActivity extends AppCompatActivity mGeckoSession = new GeckoSession(); mGeckoView.setSession(mGeckoSession); - mGeckoSession.setNavigationListener(this); - mGeckoSession.setProgressListener(this); - mGeckoSession.setContentListener(this); + mGeckoSession.setNavigationDelegate(this); + mGeckoSession.setProgressDelegate(this); + mGeckoSession.setContentDelegate(this); mPromptService = new PromptService(this, mGeckoView.getEventDispatcher()); mDoorHangerPopup = new DoorHangerPopup(this, mGeckoView.getEventDispatcher()); @@ -591,7 +591,7 @@ public class CustomTabsActivity extends AppCompatActivity return null; } - /* GeckoSession.NavigationListener */ + /* GeckoSession.NavigationDelegate */ @Override public void onLocationChange(GeckoSession session, String url) { mCurrentUrl = url; @@ -656,7 +656,7 @@ public class CustomTabsActivity extends AppCompatActivity throw new IllegalStateException("Unexpected new session"); } - /* GeckoSession.ProgressListener */ + /* GeckoSession.ProgressDelegate */ @Override public void onPageStart(GeckoSession session, String url) { mCurrentUrl = url; @@ -679,7 +679,7 @@ public class CustomTabsActivity extends AppCompatActivity updateActionBar(); } - /* GeckoSession.ContentListener */ + /* GeckoSession.ContentDelegate */ @Override public void onTitleChange(GeckoSession session, String title) { mCurrentTitle = title; diff --git a/mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsSecurityPopup.java b/mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsSecurityPopup.java index fd0a16d5b1f9..35d06bea9e63 100644 --- a/mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsSecurityPopup.java +++ b/mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsSecurityPopup.java @@ -33,7 +33,7 @@ import org.mozilla.gecko.util.ThreadUtils; import org.mozilla.gecko.widget.AnchoredPopup; import org.mozilla.gecko.widget.DoorHanger; import org.mozilla.gecko.widget.DoorHanger.OnButtonClickListener; -import org.mozilla.geckoview.GeckoSession.ProgressListener.SecurityInformation; +import org.mozilla.geckoview.GeckoSession.ProgressDelegate.SecurityInformation; import org.mozilla.geckoview.GeckoView; import android.app.Activity; diff --git a/mobile/android/base/java/org/mozilla/gecko/webapps/WebAppActivity.java b/mobile/android/base/java/org/mozilla/gecko/webapps/WebAppActivity.java index fdd0caf526ce..140c9ab0ab3d 100644 --- a/mobile/android/base/java/org/mozilla/gecko/webapps/WebAppActivity.java +++ b/mobile/android/base/java/org/mozilla/gecko/webapps/WebAppActivity.java @@ -53,8 +53,8 @@ import org.mozilla.geckoview.GeckoView; public class WebAppActivity extends AppCompatActivity implements ActionModePresenter, - GeckoSession.ContentListener, - GeckoSession.NavigationListener { + GeckoSession.ContentDelegate, + GeckoSession.NavigationDelegate { private static final String LOGTAG = "WebAppActivity"; public static final String MANIFEST_PATH = "MANIFEST_PATH"; @@ -103,9 +103,9 @@ public class WebAppActivity extends AppCompatActivity mGeckoSession = new GeckoSession(); mGeckoView.setSession(mGeckoSession); - mGeckoSession.setNavigationListener(this); - mGeckoSession.setContentListener(this); - mGeckoSession.setProgressListener(new GeckoSession.ProgressListener() { + mGeckoSession.setNavigationDelegate(this); + mGeckoSession.setContentDelegate(this); + mGeckoSession.setProgressDelegate(new GeckoSession.ProgressDelegate() { @Override public void onPageStart(GeckoSession session, String url) { @@ -332,36 +332,36 @@ public class WebAppActivity extends AppCompatActivity mGeckoView.getSettings().setInt(GeckoSessionSettings.DISPLAY_MODE, mode); } - @Override // GeckoSession.NavigationListener + @Override // GeckoSession.NavigationDelegate public void onLocationChange(GeckoSession session, String url) { } - @Override // GeckoSession.NavigationListener + @Override // GeckoSession.NavigationDelegate public void onCanGoBack(GeckoSession session, boolean canGoBack) { mCanGoBack = canGoBack; } - @Override // GeckoSession.NavigationListener + @Override // GeckoSession.NavigationDelegate public void onCanGoForward(GeckoSession session, boolean canGoForward) { } - @Override // GeckoSession.ContentListener + @Override // GeckoSession.ContentDelegate public void onTitleChange(GeckoSession session, String title) { } - @Override // GeckoSession.ContentListener + @Override // GeckoSession.ContentDelegate public void onFocusRequest(GeckoSession session) { Intent intent = new Intent(getIntent()); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent); } - @Override // GeckoSession.ContentListener + @Override // GeckoSession.ContentDelegate public void onCloseRequest(GeckoSession session) { // Ignore } - @Override // GeckoSession.ContentListener + @Override // GeckoSession.ContentDelegate public void onContextMenu(GeckoSession session, int screenX, int screenY, String uri, String elementSrc) { final String content = uri != null ? uri : elementSrc != null ? elementSrc : ""; @@ -373,7 +373,7 @@ public class WebAppActivity extends AppCompatActivity WebApps.openInFennec(validUri, WebAppActivity.this); } - @Override // GeckoSession.ContentListener + @Override // GeckoSession.ContentDelegate public void onFullScreen(GeckoSession session, boolean fullScreen) { updateFullScreenContent(fullScreen); } diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/BaseGeckoViewTest.java b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/BaseGeckoViewTest.java index 513fd1474808..949f507389b6 100644 --- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/BaseGeckoViewTest.java +++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/BaseGeckoViewTest.java @@ -63,7 +63,7 @@ public class BaseGeckoViewTest { protected void loadTestPage(final String url, final Runnable finished) { final String path = Uri.parse(url).getPath(); - mSession.setProgressListener(new GeckoSession.ProgressListener() { + mSession.setProgressDelegate(new GeckoSession.ProgressDelegate() { @Override public void onPageStart(GeckoSession session, String loadingUrl) { assertTrue("Loaded url should end with " + path, loadingUrl.endsWith(path)); @@ -72,7 +72,7 @@ public class BaseGeckoViewTest { @Override public void onPageStop(GeckoSession session, boolean success) { assertTrue("Load should succeed", success); - mSession.setProgressListener(null); + mSession.setProgressDelegate(null); finished.run(); } diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/GeckoSessionTestRuleTest.kt b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/GeckoSessionTestRuleTest.kt index 0591ca16e9f2..878583fcd6e5 100644 --- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/GeckoSessionTestRuleTest.kt +++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/GeckoSessionTestRuleTest.kt @@ -27,7 +27,7 @@ inline fun GeckoSession.loadTestPath(path: String) = /** * Test for the GeckoSessionTestRule class, to ensure it properly sets up a session for - * each test, and to ensure it can properly wait for and assert listener/delegate + * each test, and to ensure it can properly wait for and assert delegate * callbacks. */ @RunWith(AndroidJUnit4::class) @@ -75,9 +75,7 @@ class GeckoSessionTestRuleTest { @Test fun includesAllCallbacks() { for (ifce in GeckoSession::class.java.classes) { - if (!ifce.isInterface || ( - !ifce.simpleName.endsWith("Listener") && - !ifce.simpleName.endsWith("Delegate"))) { + if (!ifce.isInterface || !ifce.simpleName.endsWith("Delegate")) { continue } assertThat("Callbacks.All should include interface " + ifce.simpleName, @@ -91,7 +89,7 @@ class GeckoSessionTestRuleTest { var counter = 0 - sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate { override fun onPageStop(session: GeckoSession, success: Boolean) { counter++ } @@ -102,7 +100,7 @@ class GeckoSessionTestRuleTest { @Test(expected = AssertionError::class) fun waitForPageStop_throwOnChangedCallback() { - sessionRule.session.progressListener = Callbacks.Default + sessionRule.session.progressDelegate = Callbacks.Default sessionRule.session.loadTestPath(HELLO_HTML_PATH) sessionRule.waitForPageStop() } @@ -114,7 +112,7 @@ class GeckoSessionTestRuleTest { var counter = 0 - sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate { override fun onPageStop(session: GeckoSession, success: Boolean) { counter++ } @@ -125,11 +123,11 @@ class GeckoSessionTestRuleTest { @Test fun waitUntilCalled_anyInterfaceMethod() { sessionRule.session.loadTestPath(HELLO_HTML_PATH) - sessionRule.waitUntilCalled(GeckoSession.ProgressListener::class) + sessionRule.waitUntilCalled(GeckoSession.ProgressDelegate::class) var counter = 0 - sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate { override fun onPageStart(session: GeckoSession, url: String) { counter++ } @@ -139,7 +137,7 @@ class GeckoSessionTestRuleTest { } override fun onSecurityChange(session: GeckoSession, - securityInfo: GeckoSession.ProgressListener.SecurityInformation) { + securityInfo: GeckoSession.ProgressDelegate.SecurityInformation) { counter++ } }) @@ -149,12 +147,12 @@ class GeckoSessionTestRuleTest { @Test fun waitUntilCalled_specificInterfaceMethod() { sessionRule.session.loadTestPath(HELLO_HTML_PATH) - sessionRule.waitUntilCalled(GeckoSession.ProgressListener::class, + sessionRule.waitUntilCalled(GeckoSession.ProgressDelegate::class, "onPageStart", "onPageStop") var counter = 0 - sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate { override fun onPageStart(session: GeckoSession, url: String) { counter++ } @@ -178,7 +176,7 @@ class GeckoSessionTestRuleTest { var counter = 0 - sessionRule.waitUntilCalled(object : Callbacks.ProgressListener { + sessionRule.waitUntilCalled(object : Callbacks.ProgressDelegate { override fun onPageStart(session: GeckoSession, url: String) { counter++ } @@ -188,7 +186,7 @@ class GeckoSessionTestRuleTest { } override fun onSecurityChange(session: GeckoSession, - securityInfo: GeckoSession.ProgressListener.SecurityInformation) { + securityInfo: GeckoSession.ProgressDelegate.SecurityInformation) { counter++ } }) @@ -201,7 +199,7 @@ class GeckoSessionTestRuleTest { var counter = 0 - sessionRule.waitUntilCalled(object : Callbacks.ProgressListener { + sessionRule.waitUntilCalled(object : Callbacks.ProgressDelegate { @AssertCalled override fun onPageStart(session: GeckoSession, url: String) { counter++ @@ -222,7 +220,7 @@ class GeckoSessionTestRuleTest { var counter = 0 - sessionRule.waitUntilCalled(object : Callbacks.ProgressListener { + sessionRule.waitUntilCalled(object : Callbacks.ProgressDelegate { @AssertCalled(count = 2) override fun onPageStart(session: GeckoSession, url: String) { counter++ @@ -243,7 +241,7 @@ class GeckoSessionTestRuleTest { var counter = 0 - sessionRule.waitUntilCalled(object : Callbacks.ProgressListener { + sessionRule.waitUntilCalled(object : Callbacks.ProgressDelegate { @AssertCalled(count = 2, order = intArrayOf(1, 2)) override fun onPageStop(session: GeckoSession, success: Boolean) { val info = sessionRule.currentCall @@ -265,7 +263,7 @@ class GeckoSessionTestRuleTest { var counter = 0 - sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate { override fun onPageStop(session: GeckoSession, success: Boolean) { counter++ } @@ -279,7 +277,7 @@ class GeckoSessionTestRuleTest { sessionRule.session.loadTestPath(HELLO_HTML_PATH) sessionRule.waitForPageStop() - sessionRule.forCallbacksDuringWait(GeckoSession.ScrollListener { _, _, _ -> }) + sessionRule.forCallbacksDuringWait(GeckoSession.ScrollDelegate { _, _, _ -> }) } @Test fun forCallbacksDuringWait_specificMethod() { @@ -288,7 +286,7 @@ class GeckoSessionTestRuleTest { var counter = 0 - sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate { @AssertCalled override fun onPageStart(session: GeckoSession, url: String) { counter++ @@ -310,7 +308,7 @@ class GeckoSessionTestRuleTest { var counter = 0 - sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate { @AssertCalled override fun onPageStart(session: GeckoSession, url: String) { counter++ @@ -331,7 +329,7 @@ class GeckoSessionTestRuleTest { sessionRule.waitForPageStop() sessionRule.forCallbacksDuringWait( - GeckoSession.ScrollListener @AssertCalled { _, _, _ -> }) + GeckoSession.ScrollDelegate @AssertCalled { _, _, _ -> }) } @Test fun forCallbacksDuringWait_specificCount() { @@ -341,7 +339,7 @@ class GeckoSessionTestRuleTest { var counter = 0 - sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate { @AssertCalled(count = 2) override fun onPageStart(session: GeckoSession, url: String) { counter++ @@ -362,7 +360,7 @@ class GeckoSessionTestRuleTest { sessionRule.session.reload() sessionRule.waitForPageStops(2) - sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate { @AssertCalled(count = 1) override fun onPageStart(session: GeckoSession, url: String) { } @@ -377,7 +375,7 @@ class GeckoSessionTestRuleTest { sessionRule.session.loadTestPath(HELLO_HTML_PATH) sessionRule.waitForPageStop() - sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate { @AssertCalled(order = intArrayOf(1)) override fun onPageStart(session: GeckoSession, url: String) { } @@ -393,7 +391,7 @@ class GeckoSessionTestRuleTest { sessionRule.session.loadTestPath(HELLO_HTML_PATH) sessionRule.waitForPageStop() - sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate { @AssertCalled(order = intArrayOf(2)) override fun onPageStart(session: GeckoSession, url: String) { } @@ -409,7 +407,7 @@ class GeckoSessionTestRuleTest { sessionRule.session.reload() sessionRule.waitForPageStops(2) - sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate { @AssertCalled(order = intArrayOf(1, 3, 1)) override fun onPageStart(session: GeckoSession, url: String) { } @@ -426,7 +424,7 @@ class GeckoSessionTestRuleTest { sessionRule.session.reload() sessionRule.waitForPageStops(2) - sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate { @AssertCalled(order = intArrayOf(1, 2, 1)) override fun onPageStart(session: GeckoSession, url: String) { } @@ -442,7 +440,7 @@ class GeckoSessionTestRuleTest { sessionRule.waitForPageStop() sessionRule.forCallbacksDuringWait( - GeckoSession.ScrollListener @AssertCalled(false) { _, _, _ -> }) + GeckoSession.ScrollDelegate @AssertCalled(false) { _, _, _ -> }) } @Test(expected = AssertionError::class) @@ -450,7 +448,7 @@ class GeckoSessionTestRuleTest { sessionRule.session.loadTestPath(HELLO_HTML_PATH) sessionRule.waitForPageStop() - sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate { @AssertCalled(false) override fun onPageStop(session: GeckoSession, success: Boolean) { } @@ -472,7 +470,7 @@ class GeckoSessionTestRuleTest { var counter = 0 // assert should only apply to callbacks within range (loadUri, first reload]. - sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate { @AssertCalled(count = 1) override fun onPageStart(session: GeckoSession, url: String) { counter++ @@ -491,7 +489,7 @@ class GeckoSessionTestRuleTest { sessionRule.session.loadTestPath(HELLO_HTML_PATH) sessionRule.waitForPageStop() - sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate { @AssertCalled(count = 1) override fun onPageStop(session: GeckoSession, success: Boolean) { val info = sessionRule.currentCall @@ -512,7 +510,7 @@ class GeckoSessionTestRuleTest { @Test fun delegateUntilTestEnd() { var counter = 0 - sessionRule.delegateUntilTestEnd(object : Callbacks.ProgressListener { + sessionRule.delegateUntilTestEnd(object : Callbacks.ProgressDelegate { @AssertCalled(count = 1, order = intArrayOf(1)) override fun onPageStart(session: GeckoSession, url: String) { counter++ @@ -532,19 +530,19 @@ class GeckoSessionTestRuleTest { @Test fun delegateUntilTestEnd_notCalled() { sessionRule.delegateUntilTestEnd( - GeckoSession.ScrollListener @AssertCalled(false) { _, _, _ -> }) + GeckoSession.ScrollDelegate @AssertCalled(false) { _, _, _ -> }) } @Test(expected = AssertionError::class) fun delegateUntilTestEnd_throwOnNotCalled() { sessionRule.delegateUntilTestEnd( - GeckoSession.ScrollListener @AssertCalled(count = 1) { _, _, _ -> }) + GeckoSession.ScrollDelegate @AssertCalled(count = 1) { _, _, _ -> }) sessionRule.performTestEndCheck() } @Test(expected = AssertionError::class) fun delegateUntilTestEnd_throwOnCallingNoCall() { - sessionRule.delegateUntilTestEnd(object : Callbacks.ProgressListener { + sessionRule.delegateUntilTestEnd(object : Callbacks.ProgressDelegate { @AssertCalled(false) override fun onPageStop(session: GeckoSession, success: Boolean) { } @@ -556,7 +554,7 @@ class GeckoSessionTestRuleTest { @Test(expected = AssertionError::class) fun delegateUntilTestEnd_throwOnWrongOrder() { - sessionRule.delegateUntilTestEnd(object : Callbacks.ProgressListener { + sessionRule.delegateUntilTestEnd(object : Callbacks.ProgressDelegate { @AssertCalled(count = 1, order = intArrayOf(2)) override fun onPageStart(session: GeckoSession, url: String) { } @@ -571,7 +569,7 @@ class GeckoSessionTestRuleTest { } @Test fun delegateUntilTestEnd_currentCall() { - sessionRule.delegateUntilTestEnd(object : Callbacks.ProgressListener { + sessionRule.delegateUntilTestEnd(object : Callbacks.ProgressDelegate { @AssertCalled(count = 1) override fun onPageStop(session: GeckoSession, success: Boolean) { val info = sessionRule.currentCall @@ -590,7 +588,7 @@ class GeckoSessionTestRuleTest { @Test fun delegateDuringNextWait() { var counter = 0 - sessionRule.delegateDuringNextWait(object : Callbacks.ProgressListener { + sessionRule.delegateDuringNextWait(object : Callbacks.ProgressDelegate { @AssertCalled(count = 1, order = intArrayOf(1)) override fun onPageStart(session: GeckoSession, url: String) { counter++ @@ -616,7 +614,7 @@ class GeckoSessionTestRuleTest { @Test(expected = AssertionError::class) fun delegateDuringNextWait_throwOnNotCalled() { sessionRule.delegateDuringNextWait( - GeckoSession.ScrollListener @AssertCalled(count = 1) { _, _, _ -> }) + GeckoSession.ScrollDelegate @AssertCalled(count = 1) { _, _, _ -> }) sessionRule.session.loadTestPath(HELLO_HTML_PATH) sessionRule.waitForPageStop() } @@ -624,7 +622,7 @@ class GeckoSessionTestRuleTest { @Test(expected = AssertionError::class) fun delegateDuringNextWait_throwOnNotCalledAtTestEnd() { sessionRule.delegateDuringNextWait( - GeckoSession.ScrollListener @AssertCalled(count = 1) { _, _, _ -> }) + GeckoSession.ScrollDelegate @AssertCalled(count = 1) { _, _, _ -> }) sessionRule.performTestEndCheck() } @@ -632,8 +630,8 @@ class GeckoSessionTestRuleTest { var testCounter = 0 var waitCounter = 0 - sessionRule.delegateUntilTestEnd(object : Callbacks.ProgressListener, - Callbacks.NavigationListener { + sessionRule.delegateUntilTestEnd(object : Callbacks.ProgressDelegate, + Callbacks.NavigationDelegate { @AssertCalled(count = 1, order = intArrayOf(2)) override fun onPageStart(session: GeckoSession, url: String) { testCounter++ @@ -655,7 +653,7 @@ class GeckoSessionTestRuleTest { } }) - sessionRule.delegateDuringNextWait(object : Callbacks.ProgressListener { + sessionRule.delegateDuringNextWait(object : Callbacks.ProgressDelegate { @AssertCalled(count = 1, order = intArrayOf(1)) override fun onPageStart(session: GeckoSession, url: String) { waitCounter++ diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/NavigationListenerTest.kt b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/NavigationListenerTest.kt index 7ad419735677..5a6775f99f8a 100644 --- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/NavigationListenerTest.kt +++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/NavigationListenerTest.kt @@ -20,7 +20,7 @@ import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) @MediumTest -class NavigationListenerTest { +class NavigationDelegateTest { companion object { const val HELLO_HTML_PATH = "/assets/www/hello.html"; const val HELLO2_HTML_PATH = "/assets/www/hello2.html"; @@ -39,16 +39,16 @@ class NavigationListenerTest { sessionRule.session.loadTestPath(HELLO_HTML_PATH) sessionRule.waitForPageStop() - sessionRule.forCallbacksDuringWait(object : Callbacks.NavigationListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.NavigationDelegate { @AssertCalled(count = 1, order = intArrayOf(1)) override fun onLoadUri(session: GeckoSession, uri: String, - where: GeckoSession.NavigationListener.TargetWindow): Boolean { + where: GeckoSession.NavigationDelegate.TargetWindow): Boolean { assertThat("Session should not be null", session, notNullValue()) assertThat("URI should not be null", uri, notNullValue()) assertThat("URI should match", uri, endsWith(HELLO_HTML_PATH)) assertThat("Where should not be null", where, notNullValue()) assertThat("Where should match", where, - equalTo(GeckoSession.NavigationListener.TargetWindow.CURRENT)) + equalTo(GeckoSession.NavigationDelegate.TargetWindow.CURRENT)) return false } @@ -85,13 +85,13 @@ class NavigationListenerTest { sessionRule.session.reload() sessionRule.waitForPageStop() - sessionRule.forCallbacksDuringWait(object : Callbacks.NavigationListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.NavigationDelegate { @AssertCalled(count = 1, order = intArrayOf(1)) override fun onLoadUri(session: GeckoSession, uri: String, - where: GeckoSession.NavigationListener.TargetWindow): Boolean { + where: GeckoSession.NavigationDelegate.TargetWindow): Boolean { assertThat("URI should match", uri, endsWith(HELLO_HTML_PATH)) assertThat("Where should match", where, - equalTo(GeckoSession.NavigationListener.TargetWindow.CURRENT)) + equalTo(GeckoSession.NavigationDelegate.TargetWindow.CURRENT)) return false } @@ -124,7 +124,7 @@ class NavigationListenerTest { sessionRule.session.loadTestPath(HELLO2_HTML_PATH) sessionRule.waitForPageStop() - sessionRule.forCallbacksDuringWait(object : Callbacks.NavigationListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.NavigationDelegate { @AssertCalled(count = 1) override fun onLocationChange(session: GeckoSession, url: String) { assertThat("URL should match", url, endsWith(HELLO2_HTML_PATH)) @@ -134,13 +134,13 @@ class NavigationListenerTest { sessionRule.session.goBack() sessionRule.waitForPageStop() - sessionRule.forCallbacksDuringWait(object : Callbacks.NavigationListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.NavigationDelegate { @AssertCalled(count = 1, order = intArrayOf(1)) override fun onLoadUri(session: GeckoSession, uri: String, - where: GeckoSession.NavigationListener.TargetWindow): Boolean { + where: GeckoSession.NavigationDelegate.TargetWindow): Boolean { assertThat("URI should match", uri, endsWith(HELLO_HTML_PATH)) assertThat("Where should match", where, - equalTo(GeckoSession.NavigationListener.TargetWindow.CURRENT)) + equalTo(GeckoSession.NavigationDelegate.TargetWindow.CURRENT)) return false } @@ -168,13 +168,13 @@ class NavigationListenerTest { sessionRule.session.goForward() sessionRule.waitForPageStop() - sessionRule.forCallbacksDuringWait(object : Callbacks.NavigationListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.NavigationDelegate { @AssertCalled(count = 1, order = intArrayOf(1)) override fun onLoadUri(session: GeckoSession, uri: String, - where: GeckoSession.NavigationListener.TargetWindow): Boolean { + where: GeckoSession.NavigationDelegate.TargetWindow): Boolean { assertThat("URI should match", uri, endsWith(HELLO2_HTML_PATH)) assertThat("Where should match", where, - equalTo(GeckoSession.NavigationListener.TargetWindow.CURRENT)) + equalTo(GeckoSession.NavigationDelegate.TargetWindow.CURRENT)) return false } @@ -201,10 +201,10 @@ class NavigationListenerTest { } @Test fun onLoadUri_returnTrueCancelsLoad() { - sessionRule.delegateDuringNextWait(object : Callbacks.NavigationListener { + sessionRule.delegateDuringNextWait(object : Callbacks.NavigationDelegate { @AssertCalled(count = 2) override fun onLoadUri(session: GeckoSession, uri: String, - where: GeckoSession.NavigationListener.TargetWindow): Boolean { + where: GeckoSession.NavigationDelegate.TargetWindow): Boolean { return uri.endsWith(HELLO_HTML_PATH) } }) @@ -213,7 +213,7 @@ class NavigationListenerTest { sessionRule.session.loadTestPath(HELLO2_HTML_PATH) sessionRule.waitForPageStop() - sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate { @AssertCalled(count = 1, order = intArrayOf(1)) override fun onPageStart(session: GeckoSession, url: String) { assertThat("URL should match", url, endsWith(HELLO2_HTML_PATH)) diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/NavigationTests.java b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/NavigationTests.java index 3eb695962e01..58ff190892d9 100644 --- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/NavigationTests.java +++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/NavigationTests.java @@ -37,7 +37,7 @@ public class NavigationTests extends BaseGeckoViewTest { @Override public void run() { loadTestPath("hello2.html", new Runnable() { @Override public void run() { - mSession.setNavigationListener(new GeckoSession.NavigationListener() { + mSession.setNavigationDelegate(new GeckoSession.NavigationDelegate() { @Override public void onLocationChange(GeckoSession session, String url) { assertTrue("URL should end with " + startPath + ", got " + url, url.endsWith(startPath)); @@ -78,7 +78,7 @@ public class NavigationTests extends BaseGeckoViewTest { public void testReload() { loadTestPath("hello.html", new Runnable() { @Override public void run() { - mSession.setProgressListener(new GeckoSession.ProgressListener() { + mSession.setProgressDelegate(new GeckoSession.ProgressDelegate() { @Override public void onPageStart(GeckoSession session, String url) { } @@ -104,7 +104,7 @@ public class NavigationTests extends BaseGeckoViewTest { @Test public void testExpiredCert() { - mSession.setProgressListener(new GeckoSession.ProgressListener() { + mSession.setProgressDelegate(new GeckoSession.ProgressDelegate() { private boolean mNotBlank; @Override @@ -133,7 +133,7 @@ public class NavigationTests extends BaseGeckoViewTest { @Test public void testValidTLS() { - mSession.setProgressListener(new GeckoSession.ProgressListener() { + mSession.setProgressDelegate(new GeckoSession.ProgressDelegate() { private boolean mNotBlank; @Override @@ -162,7 +162,7 @@ public class NavigationTests extends BaseGeckoViewTest { @Test public void testOnNewSession() { - mSession.setNavigationListener(new GeckoSession.NavigationListener() { + mSession.setNavigationDelegate(new GeckoSession.NavigationDelegate() { @Override public void onLocationChange(GeckoSession session, String url) { } @@ -185,7 +185,7 @@ public class NavigationTests extends BaseGeckoViewTest { @Override public void onNewSession(GeckoSession session, String uri, GeckoSession.Response response) { final GeckoSession newSession = new GeckoSession(session.getSettings()); - newSession.setContentListener(new GeckoSession.ContentListener() { + newSession.setContentDelegate(new GeckoSession.ContentDelegate() { @Override public void onTitleChange(GeckoSession session, String title) { @@ -218,7 +218,7 @@ public class NavigationTests extends BaseGeckoViewTest { } }); - mSession.setProgressListener(new GeckoSession.ProgressListener() { + mSession.setProgressDelegate(new GeckoSession.ProgressDelegate() { @Override public void onPageStart(GeckoSession session, String url) { @@ -245,10 +245,10 @@ public class NavigationTests extends BaseGeckoViewTest { @Test(expected = IllegalArgumentException.class) public void testOnNewSessionNoExisting() { // This makes sure that we get an exception if you try to return - // an existing GeckoSession instance from the NavigationListener.onNewSession() + // an existing GeckoSession instance from the NavigationDelegate.onNewSession() // implementation. - mSession.setNavigationListener(new GeckoSession.NavigationListener() { + mSession.setNavigationDelegate(new GeckoSession.NavigationDelegate() { @Override public void onLocationChange(GeckoSession session, String url) { } @@ -275,7 +275,7 @@ public class NavigationTests extends BaseGeckoViewTest { } }); - mSession.setProgressListener(new GeckoSession.ProgressListener() { + mSession.setProgressDelegate(new GeckoSession.ProgressDelegate() { @Override public void onPageStart(GeckoSession session, String url) { diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/ProgressListenerTest.kt b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/ProgressListenerTest.kt index b83c6d161d7b..8969e0124ed8 100644 --- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/ProgressListenerTest.kt +++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/ProgressListenerTest.kt @@ -22,7 +22,7 @@ import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) @MediumTest -class ProgressListenerTest { +class ProgressDelegateTest { companion object { const val INVALID_URI = "http://www.test.invalid/" const val HELLO_HTML_PATH = "/assets/www/hello.html"; @@ -42,7 +42,7 @@ class ProgressListenerTest { sessionRule.session.loadTestPath(HELLO_HTML_PATH) sessionRule.waitForPageStop() - sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate { @AssertCalled(count = 1, order = intArrayOf(1)) override fun onPageStart(session: GeckoSession, url: String) { assertThat("Session should not be null", session, notNullValue()) @@ -52,14 +52,14 @@ class ProgressListenerTest { @AssertCalled(count = 1, order = intArrayOf(2)) override fun onSecurityChange(session: GeckoSession, - securityInfo: GeckoSession.ProgressListener.SecurityInformation) { + securityInfo: GeckoSession.ProgressDelegate.SecurityInformation) { assertThat("Session should not be null", session, notNullValue()) assertThat("Security info should not be null", securityInfo, notNullValue()) assertThat("Should not be secure", securityInfo.isSecure, equalTo(false)) assertThat("Tracking mode should match", securityInfo.trackingMode, - equalTo(GeckoSession.ProgressListener.SecurityInformation.CONTENT_UNKNOWN)) + equalTo(GeckoSession.ProgressDelegate.SecurityInformation.CONTENT_UNKNOWN)) } @AssertCalled(count = 1, order = intArrayOf(3)) @@ -75,7 +75,7 @@ class ProgressListenerTest { sessionRule.session.loadTestPath(HELLO_HTML_PATH) sessionRule.waitForPageStops(2) - sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate { @AssertCalled(count = 2, order = intArrayOf(1, 3)) override fun onPageStart(session: GeckoSession, url: String) { assertThat("URL should match", url, @@ -100,7 +100,7 @@ class ProgressListenerTest { sessionRule.session.reload() sessionRule.waitForPageStop() - sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate { @AssertCalled(count = 1, order = intArrayOf(1)) override fun onPageStart(session: GeckoSession, url: String) { assertThat("URL should match", url, endsWith(HELLO_HTML_PATH)) @@ -108,7 +108,7 @@ class ProgressListenerTest { @AssertCalled(count = 1, order = intArrayOf(2)) override fun onSecurityChange(session: GeckoSession, - securityInfo: GeckoSession.ProgressListener.SecurityInformation) { + securityInfo: GeckoSession.ProgressDelegate.SecurityInformation) { } @AssertCalled(count = 1, order = intArrayOf(3)) @@ -127,7 +127,7 @@ class ProgressListenerTest { sessionRule.session.goBack() sessionRule.waitForPageStop() - sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate { @AssertCalled(count = 1, order = intArrayOf(1)) override fun onPageStart(session: GeckoSession, url: String) { assertThat("URL should match", url, endsWith(HELLO_HTML_PATH)) @@ -135,7 +135,7 @@ class ProgressListenerTest { @AssertCalled(count = 1, order = intArrayOf(2)) override fun onSecurityChange(session: GeckoSession, - securityInfo: GeckoSession.ProgressListener.SecurityInformation) { + securityInfo: GeckoSession.ProgressDelegate.SecurityInformation) { } @AssertCalled(count = 1, order = intArrayOf(3)) @@ -147,7 +147,7 @@ class ProgressListenerTest { sessionRule.session.goForward() sessionRule.waitForPageStop() - sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate { @AssertCalled(count = 1, order = intArrayOf(1)) override fun onPageStart(session: GeckoSession, url: String) { assertThat("URL should match", url, endsWith(HELLO2_HTML_PATH)) @@ -155,7 +155,7 @@ class ProgressListenerTest { @AssertCalled(count = 1, order = intArrayOf(2)) override fun onSecurityChange(session: GeckoSession, - securityInfo: GeckoSession.ProgressListener.SecurityInformation) { + securityInfo: GeckoSession.ProgressDelegate.SecurityInformation) { } @AssertCalled(count = 1, order = intArrayOf(3)) @@ -170,10 +170,10 @@ class ProgressListenerTest { sessionRule.session.loadUri("https://mozilla-modern.badssl.com") sessionRule.waitForPageStop() - sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate { @AssertCalled(count = 1) override fun onSecurityChange(session: GeckoSession, - securityInfo: GeckoSession.ProgressListener.SecurityInformation) { + securityInfo: GeckoSession.ProgressDelegate.SecurityInformation) { assertThat("Should be secure", securityInfo.isSecure, equalTo(true)) assertThat("Should not be exception", @@ -198,16 +198,16 @@ class ProgressListenerTest { equalTo("DigiCert Inc")) assertThat("Security mode should match", securityInfo.securityMode, - equalTo(GeckoSession.ProgressListener.SecurityInformation.SECURITY_MODE_IDENTIFIED)) + equalTo(GeckoSession.ProgressDelegate.SecurityInformation.SECURITY_MODE_IDENTIFIED)) assertThat("Active mixed mode should match", securityInfo.mixedModeActive, - equalTo(GeckoSession.ProgressListener.SecurityInformation.CONTENT_UNKNOWN)) + equalTo(GeckoSession.ProgressDelegate.SecurityInformation.CONTENT_UNKNOWN)) assertThat("Passive mixed mode should match", securityInfo.mixedModePassive, - equalTo(GeckoSession.ProgressListener.SecurityInformation.CONTENT_UNKNOWN)) + equalTo(GeckoSession.ProgressDelegate.SecurityInformation.CONTENT_UNKNOWN)) assertThat("Tracking mode should match", securityInfo.trackingMode, - equalTo(GeckoSession.ProgressListener.SecurityInformation.CONTENT_UNKNOWN)) + equalTo(GeckoSession.ProgressDelegate.SecurityInformation.CONTENT_UNKNOWN)) } }) } @@ -217,7 +217,7 @@ class ProgressListenerTest { sessionRule.session.loadUri("https://expired.badssl.com") sessionRule.waitForPageStop() - sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressListener { + sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate { @AssertCalled(count = 1) override fun onPageStop(session: GeckoSession, success: Boolean) { assertThat("Load should fail", success, equalTo(false)) @@ -225,7 +225,7 @@ class ProgressListenerTest { @AssertCalled(false) override fun onSecurityChange(session: GeckoSession, - securityInfo: GeckoSession.ProgressListener.SecurityInformation) { + securityInfo: GeckoSession.ProgressDelegate.SecurityInformation) { } }) } diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/TestRunnerActivity.java b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/TestRunnerActivity.java index c0eb827e75b4..ac0d9c320226 100644 --- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/TestRunnerActivity.java +++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/TestRunnerActivity.java @@ -23,7 +23,7 @@ public class TestRunnerActivity extends Activity { GeckoSession mSession; GeckoView mView; - private GeckoSession.NavigationListener mNavigationListener = new GeckoSession.NavigationListener() { + private GeckoSession.NavigationDelegate mNavigationDelegate = new GeckoSession.NavigationDelegate() { @Override public void onLocationChange(GeckoSession session, String url) { getActionBar().setSubtitle(url); @@ -51,7 +51,7 @@ public class TestRunnerActivity extends Activity { } }; - private GeckoSession.ContentListener mContentListener = new GeckoSession.ContentListener() { + private GeckoSession.ContentDelegate mContentDelegate = new GeckoSession.ContentDelegate() { @Override public void onTitleChange(GeckoSession session, String title) { @@ -92,7 +92,7 @@ public class TestRunnerActivity extends Activity { } final GeckoSession session = new GeckoSession(settings); - session.setNavigationListener(mNavigationListener); + session.setNavigationDelegate(mNavigationDelegate); session.openWindow(this); return session; } diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java index 59b51fc6183f..cddc801d316f 100644 --- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java +++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java @@ -721,7 +721,7 @@ public class GeckoSessionTestRule extends UiThreadTestRule { public void waitForPageStops(final int count) { final Method onPageStop; try { - onPageStop = GeckoSession.ProgressListener.class.getMethod( + onPageStop = GeckoSession.ProgressDelegate.class.getMethod( "onPageStop", GeckoSession.class, boolean.class); } catch (final NoSuchMethodException e) { throw new RuntimeException(e); @@ -731,7 +731,7 @@ public class GeckoSessionTestRule extends UiThreadTestRule { methodCalls.add(new MethodCall(onPageStop, new CallRequirement(/* allowed */ true, count, null))); - waitUntilCalled(GeckoSession.ProgressListener.class, methodCalls); + waitUntilCalled(GeckoSession.ProgressDelegate.class, methodCalls); } /** @@ -815,7 +815,7 @@ public class GeckoSessionTestRule extends UiThreadTestRule { forCallbacksDuringWait(callback); } - protected void waitUntilCalled(final @NonNull Class listener, + protected void waitUntilCalled(final @NonNull Class delegate, final @NonNull List methodCalls) { // Make sure all handlers are set though #delegateUntilTestEnd or #delegateDuringNextWait, // instead of through GeckoSession directly, so that we can still record calls even with @@ -840,7 +840,7 @@ public class GeckoSessionTestRule extends UiThreadTestRule { } final MethodCall recorded = mCallRecords.get(index).methodCall; - calledAny |= recorded.method.getDeclaringClass().isAssignableFrom(listener); + calledAny |= recorded.method.getDeclaringClass().isAssignableFrom(delegate); index++; final int i = methodCalls.indexOf(recorded); diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/util/Callbacks.kt b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/util/Callbacks.kt index 621274889702..136b40ab2fdf 100644 --- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/util/Callbacks.kt +++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/util/Callbacks.kt @@ -9,11 +9,11 @@ class Callbacks private constructor() { object Default : All { } - interface All : ContentListener, NavigationListener, PermissionDelegate, ProgressListener, - PromptDelegate, ScrollListener, TrackingProtectionDelegate { + interface All : ContentDelegate, NavigationDelegate, PermissionDelegate, ProgressDelegate, + PromptDelegate, ScrollDelegate, TrackingProtectionDelegate { } - interface ContentListener : GeckoSession.ContentListener { + interface ContentDelegate : GeckoSession.ContentDelegate { override fun onTitleChange(session: GeckoSession, title: String) { } @@ -30,7 +30,7 @@ class Callbacks private constructor() { } } - interface NavigationListener : GeckoSession.NavigationListener { + interface NavigationDelegate : GeckoSession.NavigationDelegate { override fun onLocationChange(session: GeckoSession, url: String) { } @@ -40,7 +40,7 @@ class Callbacks private constructor() { override fun onCanGoForward(session: GeckoSession, canGoForward: Boolean) { } - override fun onLoadUri(session: GeckoSession, uri: String, where: GeckoSession.NavigationListener.TargetWindow): Boolean { + override fun onLoadUri(session: GeckoSession, uri: String, where: GeckoSession.NavigationDelegate.TargetWindow): Boolean { return false; } @@ -50,65 +50,65 @@ class Callbacks private constructor() { } interface PermissionDelegate : GeckoSession.PermissionDelegate { - override fun requestAndroidPermissions(session: GeckoSession, permissions: Array, callback: GeckoSession.PermissionDelegate.Callback) { + override fun onAndroidPermissionsRequest(session: GeckoSession, permissions: Array, callback: GeckoSession.PermissionDelegate.Callback) { callback.reject() } - override fun requestContentPermission(session: GeckoSession, uri: String, type: String, access: String, callback: GeckoSession.PermissionDelegate.Callback) { + override fun onContentPermissionRequest(session: GeckoSession, uri: String, type: Int, access: String, callback: GeckoSession.PermissionDelegate.Callback) { callback.reject() } - override fun requestMediaPermission(session: GeckoSession, uri: String, video: Array, audio: Array, callback: GeckoSession.PermissionDelegate.MediaCallback) { + override fun onMediaPermissionRequest(session: GeckoSession, uri: String, video: Array, audio: Array, callback: GeckoSession.PermissionDelegate.MediaCallback) { callback.reject() } } - interface ProgressListener : GeckoSession.ProgressListener { + interface ProgressDelegate : GeckoSession.ProgressDelegate { override fun onPageStart(session: GeckoSession, url: String) { } override fun onPageStop(session: GeckoSession, success: Boolean) { } - override fun onSecurityChange(session: GeckoSession, securityInfo: GeckoSession.ProgressListener.SecurityInformation) { + override fun onSecurityChange(session: GeckoSession, securityInfo: GeckoSession.ProgressDelegate.SecurityInformation) { } } interface PromptDelegate : GeckoSession.PromptDelegate { - override fun alert(session: GeckoSession, title: String, msg: String, callback: GeckoSession.PromptDelegate.AlertCallback) { + override fun onAlert(session: GeckoSession, title: String, msg: String, callback: GeckoSession.PromptDelegate.AlertCallback) { callback.dismiss() } - override fun promptForButton(session: GeckoSession, title: String, msg: String, btnMsg: Array, callback: GeckoSession.PromptDelegate.ButtonCallback) { + override fun onButtonPrompt(session: GeckoSession, title: String, msg: String, btnMsg: Array, callback: GeckoSession.PromptDelegate.ButtonCallback) { callback.dismiss() } - override fun promptForText(session: GeckoSession, title: String, msg: String, value: String, callback: GeckoSession.PromptDelegate.TextCallback) { + override fun onTextPrompt(session: GeckoSession, title: String, msg: String, value: String, callback: GeckoSession.PromptDelegate.TextCallback) { callback.dismiss() } - override fun promptForAuth(session: GeckoSession, title: String, msg: String, options: GeckoSession.PromptDelegate.AuthenticationOptions, callback: GeckoSession.PromptDelegate.AuthCallback) { + override fun onAuthPrompt(session: GeckoSession, title: String, msg: String, options: GeckoSession.PromptDelegate.AuthOptions, callback: GeckoSession.PromptDelegate.AuthCallback) { callback.dismiss() } - override fun promptForChoice(session: GeckoSession, title: String, msg: String, type: Int, choices: Array, callback: GeckoSession.PromptDelegate.ChoiceCallback) { + override fun onChoicePrompt(session: GeckoSession, title: String, msg: String, type: Int, choices: Array, callback: GeckoSession.PromptDelegate.ChoiceCallback) { callback.dismiss() } - override fun promptForColor(session: GeckoSession, title: String, value: String, callback: GeckoSession.PromptDelegate.TextCallback) { + override fun onColorPrompt(session: GeckoSession, title: String, value: String, callback: GeckoSession.PromptDelegate.TextCallback) { callback.dismiss() } - override fun promptForDateTime(session: GeckoSession, title: String, type: Int, value: String, min: String, max: String, callback: GeckoSession.PromptDelegate.TextCallback) { + override fun onDateTimePrompt(session: GeckoSession, title: String, type: Int, value: String, min: String, max: String, callback: GeckoSession.PromptDelegate.TextCallback) { callback.dismiss() } - override fun promptForFile(session: GeckoSession, title: String, type: Int, mimeTypes: Array, callback: GeckoSession.PromptDelegate.FileCallback) { + override fun onFilePrompt(session: GeckoSession, title: String, type: Int, mimeTypes: Array, callback: GeckoSession.PromptDelegate.FileCallback) { callback.dismiss() } } - interface ScrollListener : GeckoSession.ScrollListener { + interface ScrollDelegate : GeckoSession.ScrollDelegate { override fun onScrollChanged(session: GeckoSession, scrollX: Int, scrollY: Int) { } } diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java index b1ba195f35a7..3cab86b5328e 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java @@ -77,8 +77,8 @@ public class GeckoSession extends LayerSession private String mId = UUID.randomUUID().toString().replace("-", ""); /* package */ String getId() { return mId; } - private final GeckoSessionHandler mContentHandler = - new GeckoSessionHandler( + private final GeckoSessionHandler mContentHandler = + new GeckoSessionHandler( "GeckoViewContent", this, new String[]{ "GeckoView:ContextMenu", @@ -90,34 +90,34 @@ public class GeckoSession extends LayerSession } ) { @Override - public void handleMessage(final ContentListener listener, + public void handleMessage(final ContentDelegate delegate, final String event, final GeckoBundle message, final EventCallback callback) { if ("GeckoView:ContextMenu".equals(event)) { - listener.onContextMenu(GeckoSession.this, + delegate.onContextMenu(GeckoSession.this, message.getInt("screenX"), message.getInt("screenY"), message.getString("uri"), message.getString("elementSrc")); } else if ("GeckoView:DOMTitleChanged".equals(event)) { - listener.onTitleChange(GeckoSession.this, + delegate.onTitleChange(GeckoSession.this, message.getString("title")); } else if ("GeckoView:DOMWindowFocus".equals(event)) { - listener.onFocusRequest(GeckoSession.this); + delegate.onFocusRequest(GeckoSession.this); } else if ("GeckoView:DOMWindowClose".equals(event)) { - listener.onCloseRequest(GeckoSession.this); + delegate.onCloseRequest(GeckoSession.this); } else if ("GeckoView:FullScreenEnter".equals(event)) { - listener.onFullScreen(GeckoSession.this, true); + delegate.onFullScreen(GeckoSession.this, true); } else if ("GeckoView:FullScreenExit".equals(event)) { - listener.onFullScreen(GeckoSession.this, false); + delegate.onFullScreen(GeckoSession.this, false); } } }; - private final GeckoSessionHandler mNavigationHandler = - new GeckoSessionHandler( + private final GeckoSessionHandler mNavigationHandler = + new GeckoSessionHandler( "GeckoViewNavigation", this, new String[]{ "GeckoView:LocationChange", @@ -126,28 +126,28 @@ public class GeckoSession extends LayerSession } ) { @Override - public void handleMessage(final NavigationListener listener, + public void handleMessage(final NavigationDelegate delegate, final String event, final GeckoBundle message, final EventCallback callback) { if ("GeckoView:LocationChange".equals(event)) { - listener.onLocationChange(GeckoSession.this, + delegate.onLocationChange(GeckoSession.this, message.getString("uri")); - listener.onCanGoBack(GeckoSession.this, + delegate.onCanGoBack(GeckoSession.this, message.getBoolean("canGoBack")); - listener.onCanGoForward(GeckoSession.this, + delegate.onCanGoForward(GeckoSession.this, message.getBoolean("canGoForward")); } else if ("GeckoView:OnLoadUri".equals(event)) { final String uri = message.getString("uri"); - final NavigationListener.TargetWindow where = - NavigationListener.TargetWindow.forGeckoValue( + final NavigationDelegate.TargetWindow where = + NavigationDelegate.TargetWindow.forGeckoValue( message.getInt("where")); final boolean result = - listener.onLoadUri(GeckoSession.this, uri, where); + delegate.onLoadUri(GeckoSession.this, uri, where); callback.sendSuccess(result); } else if ("GeckoView:OnNewSession".equals(event)) { final String uri = message.getString("uri"); - listener.onNewSession(GeckoSession.this, uri, + delegate.onNewSession(GeckoSession.this, uri, new Response() { @Override public void respond(GeckoSession session) { @@ -162,8 +162,8 @@ public class GeckoSession extends LayerSession } }; - private final GeckoSessionHandler mProgressHandler = - new GeckoSessionHandler( + private final GeckoSessionHandler mProgressHandler = + new GeckoSessionHandler( "GeckoViewProgress", this, new String[]{ "GeckoView:PageStart", @@ -172,36 +172,36 @@ public class GeckoSession extends LayerSession } ) { @Override - public void handleMessage(final ProgressListener listener, + public void handleMessage(final ProgressDelegate delegate, final String event, final GeckoBundle message, final EventCallback callback) { if ("GeckoView:PageStart".equals(event)) { - listener.onPageStart(GeckoSession.this, + delegate.onPageStart(GeckoSession.this, message.getString("uri")); } else if ("GeckoView:PageStop".equals(event)) { - listener.onPageStop(GeckoSession.this, + delegate.onPageStop(GeckoSession.this, message.getBoolean("success")); } else if ("GeckoView:SecurityChanged".equals(event)) { final GeckoBundle identity = message.getBundle("identity"); - listener.onSecurityChange(GeckoSession.this, new ProgressListener.SecurityInformation(identity)); + delegate.onSecurityChange(GeckoSession.this, new ProgressDelegate.SecurityInformation(identity)); } } }; - private final GeckoSessionHandler mScrollHandler = - new GeckoSessionHandler( + private final GeckoSessionHandler mScrollHandler = + new GeckoSessionHandler( "GeckoViewScroll", this, new String[]{ "GeckoView:ScrollChanged" } ) { @Override - public void handleMessage(final ScrollListener listener, + public void handleMessage(final ScrollDelegate delegate, final String event, final GeckoBundle message, final EventCallback callback) { if ("GeckoView:ScrollChanged".equals(event)) { - listener.onScrollChanged(GeckoSession.this, + delegate.onScrollChanged(GeckoSession.this, message.getInt("scrollX"), message.getInt("scrollY")); } @@ -238,17 +238,17 @@ public class GeckoSession extends LayerSession }, /* alwaysListen */ true ) { @Override - public void handleMessage(final PermissionDelegate listener, + public void handleMessage(final PermissionDelegate delegate, final String event, final GeckoBundle message, final EventCallback callback) { - if (listener == null) { + if (delegate == null) { callback.sendSuccess(/* granted */ false); return; } if ("GeckoView:AndroidPermission".equals(event)) { - listener.requestAndroidPermissions( + delegate.onAndroidPermissionsRequest( GeckoSession.this, message.getStringArray("perms"), new PermissionCallback("android", callback)); } else if ("GeckoView:ContentPermission".equals(event)) { @@ -261,7 +261,7 @@ public class GeckoSession extends LayerSession } else { throw new IllegalArgumentException("Unknown permission request: " + typeString); } - listener.requestContentPermission( + delegate.onContentPermissionRequest( GeckoSession.this, message.getString("uri"), type, message.getString("access"), new PermissionCallback(typeString, callback)); @@ -285,7 +285,7 @@ public class GeckoSession extends LayerSession } } - listener.requestMediaPermission( + delegate.onMediaPermissionRequest( GeckoSession.this, message.getString("uri"), videos, audios, new PermissionCallback("media", callback)); } @@ -346,7 +346,7 @@ public class GeckoSession extends LayerSession * @return PromptDelegate instance or null if using default delegate. */ public PermissionDelegate getPermissionDelegate() { - return mPermissionHandler.getListener(); + return mPermissionHandler.getDelegate(); } /** @@ -354,7 +354,7 @@ public class GeckoSession extends LayerSession * @param delegate PermissionDelegate instance or null to use the default delegate. */ public void setPermissionDelegate(final PermissionDelegate delegate) { - mPermissionHandler.setListener(delegate, this); + mPermissionHandler.setDelegate(delegate, this); } private PromptDelegate mPromptDelegate; @@ -734,65 +734,65 @@ public class GeckoSession extends LayerSession /** * Set the content callback handler. * This will replace the current handler. - * @param listener An implementation of ContentListener. + * @param delegate An implementation of ContentDelegate. */ - public void setContentListener(ContentListener listener) { - mContentHandler.setListener(listener, this); + public void setContentDelegate(ContentDelegate delegate) { + mContentHandler.setDelegate(delegate, this); } /** * Get the content callback handler. * @return The current content callback handler. */ - public ContentListener getContentListener() { - return mContentHandler.getListener(); + public ContentDelegate getContentDelegate() { + return mContentHandler.getDelegate(); } /** * Set the progress callback handler. * This will replace the current handler. - * @param listener An implementation of ProgressListener. + * @param delegate An implementation of ProgressDelegate. */ - public void setProgressListener(ProgressListener listener) { - mProgressHandler.setListener(listener, this); + public void setProgressDelegate(ProgressDelegate delegate) { + mProgressHandler.setDelegate(delegate, this); } /** * Get the progress callback handler. * @return The current progress callback handler. */ - public ProgressListener getProgressListener() { - return mProgressHandler.getListener(); + public ProgressDelegate getProgressDelegate() { + return mProgressHandler.getDelegate(); } /** * Set the navigation callback handler. * This will replace the current handler. - * @param listener An implementation of NavigationListener. + * @param delegate An implementation of NavigationDelegate. */ - public void setNavigationListener(NavigationListener listener) { - mNavigationHandler.setListener(listener, this); + public void setNavigationDelegate(NavigationDelegate delegate) { + mNavigationHandler.setDelegate(delegate, this); } /** * Get the navigation callback handler. * @return The current navigation callback handler. */ - public NavigationListener getNavigationListener() { - return mNavigationHandler.getListener(); + public NavigationDelegate getNavigationDelegate() { + return mNavigationHandler.getDelegate(); } /** * Set the content scroll callback handler. * This will replace the current handler. - * @param listener An implementation of ScrollListener. + * @param delegate An implementation of ScrollDelegate. */ - public void setScrollListener(ScrollListener listener) { - mScrollHandler.setListener(listener, this); + public void setScrollDelegate(ScrollDelegate delegate) { + mScrollHandler.setDelegate(delegate, this); } - public ScrollListener getScrollListener() { - return mScrollHandler.getListener(); + public ScrollDelegate getScrollDelegate() { + return mScrollHandler.getDelegate(); } /** @@ -801,7 +801,7 @@ public class GeckoSession extends LayerSession * @param delegate An implementation of TrackingProtectionDelegate. */ public void setTrackingProtectionDelegate(TrackingProtectionDelegate delegate) { - mTrackingProtectionHandler.setListener(delegate, this); + mTrackingProtectionHandler.setDelegate(delegate, this); } /** @@ -809,7 +809,7 @@ public class GeckoSession extends LayerSession * @return The current tracking protection callback handler. */ public TrackingProtectionDelegate getTrackingProtectionDelegate() { - return mTrackingProtectionHandler.getListener(); + return mTrackingProtectionHandler.getDelegate(); } /** @@ -1066,7 +1066,7 @@ public class GeckoSession extends LayerSession final String msg = message.getString("msg"); switch (type) { case "alert": { - delegate.alert(session, title, msg, cb); + delegate.onAlert(session, title, msg, cb); break; } case "button": { @@ -1087,15 +1087,15 @@ public class GeckoSession extends LayerSession } btnCustomTitle[i] = Resources.getSystem().getString(resId); } - delegate.promptForButton(session, title, msg, btnCustomTitle, cb); + delegate.onButtonPrompt(session, title, msg, btnCustomTitle, cb); break; } case "text": { - delegate.promptForText(session, title, msg, message.getString("value"), cb); + delegate.onTextPrompt(session, title, msg, message.getString("value"), cb); break; } case "auth": { - delegate.promptForAuth(session, title, msg, new PromptDelegate.AuthenticationOptions(message.getBundle("options")), cb); + delegate.onAuthPrompt(session, title, msg, new PromptDelegate.AuthOptions(message.getBundle("options")), cb); break; } case "choice": { @@ -1121,12 +1121,12 @@ public class GeckoSession extends LayerSession choices[i] = new PromptDelegate.Choice(choiceBundles[i]); } } - delegate.promptForChoice(session, title, msg, intMode, + delegate.onChoicePrompt(session, title, msg, intMode, choices, cb); break; } case "color": { - delegate.promptForColor(session, title, message.getString("value"), cb); + delegate.onColorPrompt(session, title, message.getString("value"), cb); break; } case "datetime": { @@ -1145,7 +1145,7 @@ public class GeckoSession extends LayerSession callback.sendError("Invalid mode"); return; } - delegate.promptForDateTime(session, title, intMode, + delegate.onDateTimePrompt(session, title, intMode, message.getString("value"), message.getString("min"), message.getString("max"), cb); @@ -1176,7 +1176,7 @@ public class GeckoSession extends LayerSession } mimeTypes = combined.toArray(new String[combined.size()]); } - delegate.promptForFile(session, title, intMode, mimeTypes, cb); + delegate.onFilePrompt(session, title, intMode, mimeTypes, cb); break; } default: { @@ -1190,7 +1190,7 @@ public class GeckoSession extends LayerSession return mEventDispatcher; } - public interface ProgressListener { + public interface ProgressDelegate { /** * Class representing security information for a site. */ @@ -1298,7 +1298,7 @@ public class GeckoSession extends LayerSession void onSecurityChange(GeckoSession session, SecurityInformation securityInfo); } - public interface ContentListener { + public interface ContentDelegate { /** * A page title was discovered in the content or updated after the content * loaded. @@ -1358,7 +1358,7 @@ public class GeckoSession extends LayerSession void respond(T val); } - public interface NavigationListener { + public interface NavigationDelegate { /** * A view has started loading content from the network. * @param session The GeckoSession that initiated the callback. @@ -1496,7 +1496,7 @@ public class GeckoSession extends LayerSession * @param msg Message for the prompt dialog. * @param callback Callback interface. */ - void alert(GeckoSession session, String title, String msg, AlertCallback callback); + void onAlert(GeckoSession session, String title, String msg, AlertCallback callback); /** * Callback interface for notifying the result of a button prompt. @@ -1528,7 +1528,7 @@ public class GeckoSession extends LayerSession * The button is hidden if the corresponding label is null. * @param callback Callback interface. */ - void promptForButton(GeckoSession session, String title, String msg, + void onButtonPrompt(GeckoSession session, String title, String msg, String[] btnMsg, ButtonCallback callback); /** @@ -1554,7 +1554,7 @@ public class GeckoSession extends LayerSession * @param value Default input text for the prompt. * @param callback Callback interface. */ - void promptForText(GeckoSession session, String title, String msg, + void onTextPrompt(GeckoSession session, String title, String msg, String value, TextCallback callback); /** @@ -1579,7 +1579,7 @@ public class GeckoSession extends LayerSession void confirm(String username, String password); } - class AuthenticationOptions { + class AuthOptions { /** * The auth prompt is for a network host. */ @@ -1639,7 +1639,7 @@ public class GeckoSession extends LayerSession */ public String password; - /* package */ AuthenticationOptions(GeckoBundle options) { + /* package */ AuthOptions(GeckoBundle options) { flags = options.getInt("flags"); uri = options.getString("uri"); level = options.getInt("level"); @@ -1654,11 +1654,11 @@ public class GeckoSession extends LayerSession * @param session GeckoSession that triggered the prompt * @param title Title for the prompt dialog. * @param msg Message for the prompt dialog. - * @param options AuthenticationOptions containing options for the prompt + * @param options AuthOptions containing options for the prompt * @param callback Callback interface. */ - void promptForAuth(GeckoSession session, String title, String msg, - AuthenticationOptions options, AuthCallback callback); + void onAuthPrompt(GeckoSession session, String title, String msg, + AuthOptions options, AuthCallback callback); class Choice { /** @@ -1785,7 +1785,7 @@ public class GeckoSession extends LayerSession * @param choices Array of Choices each representing an item or group. * @param callback Callback interface. */ - void promptForChoice(GeckoSession session, String title, String msg, int type, + void onChoicePrompt(GeckoSession session, String title, String msg, int type, Choice[] choices, ChoiceCallback callback); /** @@ -1797,7 +1797,7 @@ public class GeckoSession extends LayerSession * @param callback Callback interface; the result passed to confirm() must be in * HTML color format. */ - void promptForColor(GeckoSession session, String title, String value, + void onColorPrompt(GeckoSession session, String title, String value, TextCallback callback); /** @@ -1837,7 +1837,7 @@ public class GeckoSession extends LayerSession * @param callback Callback interface; the result passed to confirm() must be in * HTML date/time format. */ - void promptForDateTime(GeckoSession session, String title, int type, + void onDateTimePrompt(GeckoSession session, String title, int type, String value, String min, String max, TextCallback callback); /** @@ -1877,7 +1877,7 @@ public class GeckoSession extends LayerSession * "*" to indicate any value. * @param callback Callback interface. */ - void promptForFile(GeckoSession session, String title, int type, + void onFilePrompt(GeckoSession session, String title, int type, String[] mimeTypes, FileCallback callback); } @@ -1885,7 +1885,7 @@ public class GeckoSession extends LayerSession * GeckoSession applications implement this interface to handle content scroll * events. **/ - public interface ScrollListener { + public interface ScrollDelegate { /** * The scroll position of the content has changed. * @@ -1987,7 +1987,7 @@ public class GeckoSession extends LayerSession * android.Manifest.permission.RECORD_AUDIO * @param callback Callback interface. */ - void requestAndroidPermissions(GeckoSession session, String[] permissions, + void onAndroidPermissionsRequest(GeckoSession session, String[] permissions, Callback callback); /** @@ -2001,7 +2001,7 @@ public class GeckoSession extends LayerSession * @param access Not used. * @param callback Callback interface. */ - void requestContentPermission(GeckoSession session, String uri, int type, + void onContentPermissionRequest(GeckoSession session, String uri, int type, String access, Callback callback); class MediaSource { @@ -2175,7 +2175,7 @@ public class GeckoSession extends LayerSession * @param audio List of audio sources, or null if not requesting audio. * @param callback Callback interface. */ - void requestMediaPermission(GeckoSession session, String uri, MediaSource[] video, + void onMediaPermissionRequest(GeckoSession session, String uri, MediaSource[] video, MediaSource[] audio, MediaCallback callback); } } diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSessionHandler.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSessionHandler.java index 2970fee1a700..2abb178ef386 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSessionHandler.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSessionHandler.java @@ -14,13 +14,13 @@ import org.mozilla.geckoview.GeckoSession; import android.util.Log; -/* package */ abstract class GeckoSessionHandler +/* package */ abstract class GeckoSessionHandler implements BundleEventListener { private static final String LOGTAG = "GeckoSessionHandler"; private static final boolean DEBUG = false; - private Listener mListener; + private Delegate mDelegate; private final boolean mAlwaysListen; private final String mModuleName; private final String[] mEvents; @@ -45,23 +45,23 @@ import android.util.Log; } } - public Listener getListener() { - return mListener; + public Delegate getDelegate() { + return mDelegate; } - public void setListener(final Listener listener, final GeckoSession session) { + public void setDelegate(final Delegate delegate, final GeckoSession session) { final EventDispatcher eventDispatcher = session.getEventDispatcher(); - if (mListener == listener) { + if (mDelegate == delegate) { return; } - if (!mAlwaysListen && mListener != null) { + if (!mAlwaysListen && mDelegate != null) { unregister(eventDispatcher); } - mListener = listener; + mDelegate = delegate; - if (!mAlwaysListen && mListener != null) { + if (!mAlwaysListen && mDelegate != null) { register(eventDispatcher); } } @@ -87,14 +87,14 @@ import android.util.Log; Log.d(LOGTAG, mModuleName + " handleMessage: event = " + event); } - if (mListener != null) { - handleMessage(mListener, event, message, callback); + if (mDelegate != null) { + handleMessage(mDelegate, event, message, callback); } else { callback.sendError("No listener registered"); } } - protected abstract void handleMessage(final Listener listener, + protected abstract void handleMessage(final Delegate delegate, final String event, final GeckoBundle message, final EventCallback callback); diff --git a/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/BasicGeckoViewPrompt.java b/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/BasicGeckoViewPrompt.java index c0fb5647a761..d53e9bbad208 100644 --- a/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/BasicGeckoViewPrompt.java +++ b/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/BasicGeckoViewPrompt.java @@ -92,7 +92,7 @@ final class BasicGeckoViewPrompt implements GeckoSession.PromptDelegate { return builder; } - public void alert(final GeckoSession session, final String title, final String msg, + public void onAlert(final GeckoSession session, final String title, final String msg, final AlertCallback callback) { final Activity activity = mActivity; if (activity == null) { @@ -107,7 +107,7 @@ final class BasicGeckoViewPrompt implements GeckoSession.PromptDelegate { callback).show(); } - public void promptForButton(final GeckoSession session, final String title, + public void onButtonPrompt(final GeckoSession session, final String title, final String msg, final String[] btnMsg, final ButtonCallback callback) { final Activity activity = mActivity; @@ -182,7 +182,7 @@ final class BasicGeckoViewPrompt implements GeckoSession.PromptDelegate { return dialog; } - public void promptForText(final GeckoSession session, final String title, + public void onTextPrompt(final GeckoSession session, final String title, final String msg, final String value, final TextCallback callback) { final Activity activity = mActivity; @@ -208,8 +208,8 @@ final class BasicGeckoViewPrompt implements GeckoSession.PromptDelegate { createStandardDialog(addCheckbox(builder, container, callback), callback).show(); } - public void promptForAuth(final GeckoSession session, final String title, - final String msg, final AuthenticationOptions options, + public void onAuthPrompt(final GeckoSession session, final String title, + final String msg, final AuthOptions options, final AuthCallback callback) { final Activity activity = mActivity; if (activity == null) { @@ -222,7 +222,7 @@ final class BasicGeckoViewPrompt implements GeckoSession.PromptDelegate { final int flags = options.flags; final int level = options.level; final EditText username; - if ((flags & AuthenticationOptions.AUTH_FLAG_ONLY_PASSWORD) == 0) { + if ((flags & AuthOptions.AUTH_FLAG_ONLY_PASSWORD) == 0) { username = new EditText(builder.getContext()); username.setHint(R.string.username); username.setText(options.username); @@ -238,7 +238,7 @@ final class BasicGeckoViewPrompt implements GeckoSession.PromptDelegate { InputType.TYPE_TEXT_VARIATION_PASSWORD); container.addView(password); - if (level != AuthenticationOptions.AUTH_LEVEL_NONE) { + if (level != AuthOptions.AUTH_LEVEL_NONE) { final ImageView secure = new ImageView(builder.getContext()); secure.setImageResource(android.R.drawable.ic_lock_lock); container.addView(secure); @@ -249,7 +249,7 @@ final class BasicGeckoViewPrompt implements GeckoSession.PromptDelegate { new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { - if ((flags & AuthenticationOptions.AUTH_FLAG_ONLY_PASSWORD) == 0) { + if ((flags & AuthOptions.AUTH_FLAG_ONLY_PASSWORD) == 0) { callback.confirm(username.getText().toString(), password.getText().toString()); } else { @@ -286,7 +286,7 @@ final class BasicGeckoViewPrompt implements GeckoSession.PromptDelegate { } } - public void promptForChoice(final GeckoSession session, final String title, + public void onChoicePrompt(final GeckoSession session, final String title, final String msg, final int type, final Choice[] choices, final ChoiceCallback callback) { final Activity activity = mActivity; @@ -417,7 +417,7 @@ final class BasicGeckoViewPrompt implements GeckoSession.PromptDelegate { // Show sub-menu. dialog.setOnDismissListener(null); dialog.dismiss(); - promptForChoice(session, item.label, /* msg */ null, + onChoicePrompt(session, item.label, /* msg */ null, type, children, callback); return; } @@ -467,7 +467,7 @@ final class BasicGeckoViewPrompt implements GeckoSession.PromptDelegate { } } - public void promptForColor(final GeckoSession session, final String title, + public void onColorPrompt(final GeckoSession session, final String title, final String value, final TextCallback callback) { final Activity activity = mActivity; @@ -575,7 +575,7 @@ final class BasicGeckoViewPrompt implements GeckoSession.PromptDelegate { } } - public void promptForDateTime(final GeckoSession session, final String title, + public void onDateTimePrompt(final GeckoSession session, final String title, final int type, final String value, final String min, final String max, final TextCallback callback) { final Activity activity = mActivity; @@ -691,7 +691,7 @@ final class BasicGeckoViewPrompt implements GeckoSession.PromptDelegate { } @TargetApi(19) - public void promptForFile(GeckoSession session, String title, int type, + public void onFilePrompt(GeckoSession session, String title, int type, String[] mimeTypes, FileCallback callback) { final Activity activity = mActivity; @@ -781,7 +781,7 @@ final class BasicGeckoViewPrompt implements GeckoSession.PromptDelegate { } } - public void promptForPermission(final GeckoSession session, final String title, + public void onPermissionPrompt(final GeckoSession session, final String title, final GeckoSession.PermissionDelegate.Callback callback) { final Activity activity = mActivity; if (activity == null) { @@ -842,7 +842,7 @@ final class BasicGeckoViewPrompt implements GeckoSession.PromptDelegate { return spinner; } - public void promptForMedia(final GeckoSession session, final String title, + public void onMediaPrompt(final GeckoSession session, final String title, final MediaSource[] video, final MediaSource[] audio, final GeckoSession.PermissionDelegate.MediaCallback callback) { final Activity activity = mActivity; diff --git a/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/GeckoViewActivity.java b/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/GeckoViewActivity.java index 54d7c75c767d..186e5fb2d411 100644 --- a/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/GeckoViewActivity.java +++ b/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/GeckoViewActivity.java @@ -74,11 +74,11 @@ public class GeckoViewActivity extends Activity { mGeckoSession = new GeckoSession(); mGeckoView.setSession(mGeckoSession); - mGeckoSession.setContentListener(new MyGeckoViewContent()); + mGeckoSession.setContentDelegate(new MyGeckoViewContent()); final MyTrackingProtection tp = new MyTrackingProtection(); mGeckoSession.setTrackingProtectionDelegate(tp); - mGeckoSession.setProgressListener(new MyGeckoViewProgress(tp)); - mGeckoSession.setNavigationListener(new Navigation()); + mGeckoSession.setProgressDelegate(new MyGeckoViewProgress(tp)); + mGeckoSession.setNavigationDelegate(new Navigation()); final BasicGeckoViewPrompt prompt = new BasicGeckoViewPrompt(this); prompt.filePickerRequestCode = REQUEST_FILE_PICKER; @@ -168,7 +168,7 @@ public class GeckoViewActivity extends Activity { } } - private class MyGeckoViewContent implements GeckoSession.ContentListener { + private class MyGeckoViewContent implements GeckoSession.ContentDelegate { @Override public void onTitleChange(GeckoSession session, String title) { Log.i(LOGTAG, "Content title changed to " + title); @@ -206,7 +206,7 @@ public class GeckoViewActivity extends Activity { } } - private class MyGeckoViewProgress implements GeckoSession.ProgressListener { + private class MyGeckoViewProgress implements GeckoSession.ProgressDelegate { private MyTrackingProtection mTp; private MyGeckoViewProgress(final MyTrackingProtection tp) { @@ -259,7 +259,7 @@ public class GeckoViewActivity extends Activity { } @Override - public void requestAndroidPermissions(final GeckoSession session, final String[] permissions, + public void onAndroidPermissionsRequest(final GeckoSession session, final String[] permissions, final Callback callback) { if (Build.VERSION.SDK_INT < 23) { // requestPermissions was introduced in API 23. @@ -271,7 +271,7 @@ public class GeckoViewActivity extends Activity { } @Override - public void requestContentPermission(final GeckoSession session, final String uri, + public void onContentPermissionRequest(final GeckoSession session, final String uri, final int type, final String access, final Callback callback) { final int resId; @@ -288,7 +288,7 @@ public class GeckoViewActivity extends Activity { final String title = getString(resId, Uri.parse(uri).getAuthority()); final BasicGeckoViewPrompt prompt = (BasicGeckoViewPrompt) mGeckoSession.getPromptDelegate(); - prompt.promptForPermission(session, title, callback); + prompt.onPermissionPrompt(session, title, callback); } private void normalizeMediaName(final MediaSource[] sources) { @@ -316,7 +316,7 @@ public class GeckoViewActivity extends Activity { } @Override - public void requestMediaPermission(final GeckoSession session, final String uri, + public void onMediaPermissionRequest(final GeckoSession session, final String uri, final MediaSource[] video, final MediaSource[] audio, final MediaCallback callback) { final String host = Uri.parse(uri).getAuthority(); @@ -334,11 +334,11 @@ public class GeckoViewActivity extends Activity { final BasicGeckoViewPrompt prompt = (BasicGeckoViewPrompt) mGeckoSession.getPromptDelegate(); - prompt.promptForMedia(session, title, video, audio, callback); + prompt.onMediaPrompt(session, title, video, audio, callback); } } - private class Navigation implements GeckoSession.NavigationListener { + private class Navigation implements GeckoSession.NavigationDelegate { @Override public void onLocationChange(GeckoSession session, final String url) { } From 8b9f1c68b962a850367018ebcec8413020f2f1cc Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Thu, 1 Mar 2018 14:47:29 +0000 Subject: [PATCH 10/67] Bug 1441783 - Remove unused AutoVectorRooter class and refactor r=sfink --- js/public/RootingAPI.h | 7 --- js/src/gc/RootMarking.cpp | 4 +- js/src/jsapi.h | 104 -------------------------------------- js/src/vm/JSCompartment.h | 8 ++- 4 files changed, 8 insertions(+), 115 deletions(-) diff --git a/js/public/RootingAPI.h b/js/public/RootingAPI.h index 7baca5f78ee8..3f0886648265 100644 --- a/js/public/RootingAPI.h +++ b/js/public/RootingAPI.h @@ -895,19 +895,12 @@ class JS_PUBLIC_API(AutoGCRooter) #if defined(JS_BUILD_BINAST) BINPARSER = -4, /* js::frontend::BinSource */ #endif // defined(JS_BUILD_BINAST) - VALVECTOR = -10, /* js::AutoValueVector */ - IDVECTOR = -11, /* js::AutoIdVector */ - OBJVECTOR = -14, /* js::AutoObjectVector */ IONMASM = -19, /* js::jit::MacroAssembler */ WRAPVECTOR = -20, /* js::AutoWrapperVector */ WRAPPER = -21, /* js::AutoWrapperRooter */ CUSTOM = -26 /* js::CustomAutoRooter */ }; - static ptrdiff_t GetTag(const Value& value) { return VALVECTOR; } - static ptrdiff_t GetTag(const jsid& id) { return IDVECTOR; } - static ptrdiff_t GetTag(JSObject* obj) { return OBJVECTOR; } - private: AutoGCRooter ** const stackTop; diff --git a/js/src/gc/RootMarking.cpp b/js/src/gc/RootMarking.cpp index ef3fb55c50da..384edb9fdd2a 100644 --- a/js/src/gc/RootMarking.cpp +++ b/js/src/gc/RootMarking.cpp @@ -179,13 +179,13 @@ AutoGCRooter::trace(JSTracer* trc) } case WRAPVECTOR: { - AutoWrapperVector::VectorImpl& vector = static_cast(this)->vector; + auto vector = static_cast(this); /* * We need to use TraceManuallyBarrieredEdge here because we trace * wrapper roots in every slice. This is because of some rule-breaking * in RemapAllWrappersForObject; see comment there. */ - for (WrapperValue* p = vector.begin(); p < vector.end(); p++) + for (WrapperValue* p = vector->begin(); p < vector->end(); p++) TraceManuallyBarrieredEdge(trc, &p->get(), "js::AutoWrapperVector.vector"); return; } diff --git a/js/src/jsapi.h b/js/src/jsapi.h index d7b8a5b3ab51..5d2f05f59ec6 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -102,110 +102,6 @@ class MOZ_RAII AutoValueArray : public AutoGCRooter MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER }; -template -class MOZ_RAII AutoVectorRooterBase : protected AutoGCRooter -{ - typedef js::Vector VectorImpl; - VectorImpl vector; - - public: - explicit AutoVectorRooterBase(JSContext* cx, ptrdiff_t tag - MOZ_GUARD_OBJECT_NOTIFIER_PARAM) - : AutoGCRooter(cx, tag), vector(cx) - { - MOZ_GUARD_OBJECT_NOTIFIER_INIT; - } - - typedef T ElementType; - typedef typename VectorImpl::Range Range; - - size_t length() const { return vector.length(); } - bool empty() const { return vector.empty(); } - - MOZ_MUST_USE bool append(const T& v) { return vector.append(v); } - MOZ_MUST_USE bool appendN(const T& v, size_t len) { return vector.appendN(v, len); } - MOZ_MUST_USE bool append(const T* ptr, size_t len) { return vector.append(ptr, len); } - MOZ_MUST_USE bool appendAll(const AutoVectorRooterBase& other) { - return vector.appendAll(other.vector); - } - - MOZ_MUST_USE bool insert(T* p, const T& val) { return vector.insert(p, val); } - - /* For use when space has already been reserved. */ - void infallibleAppend(const T& v) { vector.infallibleAppend(v); } - - void popBack() { vector.popBack(); } - T popCopy() { return vector.popCopy(); } - - MOZ_MUST_USE bool growBy(size_t inc) { - size_t oldLength = vector.length(); - if (!vector.growByUninitialized(inc)) - return false; - makeRangeGCSafe(oldLength); - return true; - } - - MOZ_MUST_USE bool resize(size_t newLength) { - size_t oldLength = vector.length(); - if (newLength <= oldLength) { - vector.shrinkBy(oldLength - newLength); - return true; - } - if (!vector.growByUninitialized(newLength - oldLength)) - return false; - makeRangeGCSafe(oldLength); - return true; - } - - void clear() { vector.clear(); } - - MOZ_MUST_USE bool reserve(size_t newLength) { - return vector.reserve(newLength); - } - - JS::MutableHandle operator[](size_t i) { - return JS::MutableHandle::fromMarkedLocation(&vector[i]); - } - JS::Handle operator[](size_t i) const { - return JS::Handle::fromMarkedLocation(&vector[i]); - } - - const T* begin() const { return vector.begin(); } - T* begin() { return vector.begin(); } - - const T* end() const { return vector.end(); } - T* end() { return vector.end(); } - - Range all() { return vector.all(); } - - const T& back() const { return vector.back(); } - - friend void AutoGCRooter::trace(JSTracer* trc); - - private: - void makeRangeGCSafe(size_t oldLength) { - T* t = vector.begin() + oldLength; - for (size_t i = oldLength; i < vector.length(); ++i, ++t) - memset(t, 0, sizeof(T)); - } - - MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER -}; - -template -class MOZ_RAII AutoVectorRooter : public AutoVectorRooterBase -{ - public: - explicit AutoVectorRooter(JSContext* cx - MOZ_GUARD_OBJECT_NOTIFIER_PARAM) - : AutoVectorRooterBase(cx, this->GetTag(T())) - { - MOZ_GUARD_OBJECT_NOTIFIER_INIT; - } - - MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER -}; - class AutoValueVector : public Rooted> { using Vec = GCVector; using Base = Rooted; diff --git a/js/src/vm/JSCompartment.h b/js/src/vm/JSCompartment.h index dddf921261c9..a5194edd61ff 100644 --- a/js/src/vm/JSCompartment.h +++ b/js/src/vm/JSCompartment.h @@ -1384,16 +1384,20 @@ struct WrapperValue Value value; }; -class MOZ_RAII AutoWrapperVector : public JS::AutoVectorRooterBase +class MOZ_RAII AutoWrapperVector : public JS::GCVector, + private JS::AutoGCRooter { public: explicit AutoWrapperVector(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) - : AutoVectorRooterBase(cx, WRAPVECTOR) + : JS::GCVector(cx), + JS::AutoGCRooter(cx, WRAPVECTOR) { MOZ_GUARD_OBJECT_NOTIFIER_INIT; } + friend void AutoGCRooter::trace(JSTracer* trc); + MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER }; From a9547048d90e04fc1fdf354b110b5df836b047e1 Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Thu, 1 Mar 2018 14:47:29 +0000 Subject: [PATCH 11/67] Bug 1441988 - Simplify AutoVector definitions by making this a template r=sfink --- dom/base/nsJSEnvironment.h | 4 --- js/public/Class.h | 2 -- js/public/GCVector.h | 31 ++++++++++++++++-------- js/src/NamespaceImports.h | 6 ++--- js/src/jsapi.h | 23 ------------------ js/src/jspubtd.h | 6 ++++- js/xpconnect/wrappers/FilteringWrapper.h | 4 --- 7 files changed, 29 insertions(+), 47 deletions(-) diff --git a/dom/base/nsJSEnvironment.h b/dom/base/nsJSEnvironment.h index 1d7bf2e60ed9..5f71983edb7f 100644 --- a/dom/base/nsJSEnvironment.h +++ b/dom/base/nsJSEnvironment.h @@ -23,10 +23,6 @@ class nsICycleCollectorListener; class nsScriptNameSpaceManager; class nsIDocShell; -namespace JS { -class AutoValueVector; -} // namespace JS - namespace mozilla { template class Maybe; struct CycleCollectorResults; diff --git a/js/public/Class.h b/js/public/Class.h index 8091a12d1718..19324440f54f 100644 --- a/js/public/Class.h +++ b/js/public/Class.h @@ -40,8 +40,6 @@ extern JS_FRIEND_DATA(const js::Class* const) FunctionClassPtr; namespace JS { -class AutoIdVector; - /** * The answer to a successful query as to whether an object is an Array per * ES6's internal |IsArray| operation (as exposed by |Array.isArray|). diff --git a/js/public/GCVector.h b/js/public/GCVector.h index 67ffc51ee93d..a48935d55977 100644 --- a/js/public/GCVector.h +++ b/js/public/GCVector.h @@ -99,14 +99,14 @@ class GCVector return vector.infallibleAppend(aBegin, aLength); } - template - MOZ_MUST_USE bool appendAll(const mozilla::Vector& aU) { return vector.appendAll(aU); } - template - MOZ_MUST_USE bool appendAll(const GCVector& aU) { - return vector.append(aU.begin(), aU.length()); + template + MOZ_MUST_USE bool appendAll(const U& aU) { + return vector.append(aU.begin(), aU.end()); } - MOZ_MUST_USE bool appendN(const T& val, size_t count) { return vector.appendN(val, count); } + MOZ_MUST_USE bool appendN(const T& val, size_t count) { + return vector.appendN(val, count); + } template MOZ_MUST_USE bool append(const U* aBegin, const U* aEnd) { @@ -219,10 +219,8 @@ class MutableWrappedPtrOperations, Wrappe MOZ_MUST_USE bool emplaceBack(Args&&... aArgs) { return vec().emplaceBack(mozilla::Forward(aArgs...)); } - template - MOZ_MUST_USE bool appendAll(const mozilla::Vector& aU) { return vec().appendAll(aU); } - template - MOZ_MUST_USE bool appendAll(const JS::GCVector& aU) { return vec().appendAll(aU); } + template + MOZ_MUST_USE bool appendAll(const U& aU) { return vec().appendAll(aU); } MOZ_MUST_USE bool appendN(const T& aT, size_t aN) { return vec().appendN(aT, aN); } template MOZ_MUST_USE bool append(const U* aBegin, const U* aEnd) { @@ -253,4 +251,17 @@ class MutableWrappedPtrOperations, Wrappe } // namespace js +namespace JS { + +// An automatically rooted vector for stack use. +template +class AutoVector : public Rooted> { + using Vec = GCVector; + using Base = Rooted; + public: + explicit AutoVector(JSContext* cx) : Base(cx, Vec(cx)) {} +}; + +} // namespace JS + #endif // js_GCVector_h diff --git a/js/src/NamespaceImports.h b/js/src/NamespaceImports.h index 8c7b4f74df4b..7b9c58ceb80f 100644 --- a/js/src/NamespaceImports.h +++ b/js/src/NamespaceImports.h @@ -30,9 +30,9 @@ class TwoByteCharsZ; class UTF8Chars; class UTF8CharsZ; -class AutoValueVector; -class AutoIdVector; -class AutoObjectVector; +using AutoValueVector = AutoVector; +using AutoIdVector = AutoVector; +using AutoObjectVector = AutoVector; using ValueVector = JS::GCVector; using IdVector = JS::GCVector; diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 5d2f05f59ec6..8c71d3922b7d 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -102,29 +102,6 @@ class MOZ_RAII AutoValueArray : public AutoGCRooter MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER }; -class AutoValueVector : public Rooted> { - using Vec = GCVector; - using Base = Rooted; - public: - explicit AutoValueVector(JSContext* cx) : Base(cx, Vec(cx)) {} -}; - -class AutoIdVector : public Rooted> { - using Vec = GCVector; - using Base = Rooted; - public: - explicit AutoIdVector(JSContext* cx) : Base(cx, Vec(cx)) {} - - bool appendAll(const AutoIdVector& other) { return this->Base::appendAll(other.get()); } -}; - -class AutoObjectVector : public Rooted> { - using Vec = GCVector; - using Base = Rooted; - public: - explicit AutoObjectVector(JSContext* cx) : Base(cx, Vec(cx)) {} -}; - using ValueVector = JS::GCVector; using IdVector = JS::GCVector; using ScriptVector = JS::GCVector; diff --git a/js/src/jspubtd.h b/js/src/jspubtd.h index 9c73bf3d0cb0..1fa2cc8d67e8 100644 --- a/js/src/jspubtd.h +++ b/js/src/jspubtd.h @@ -29,7 +29,11 @@ namespace JS { -class AutoIdVector; +template class AutoVector; +using AutoIdVector = AutoVector; +using AutoValueVector = AutoVector; +using AutoObjectVector = AutoVector; + class CallArgs; class JS_FRIEND_API(CompileOptions); diff --git a/js/xpconnect/wrappers/FilteringWrapper.h b/js/xpconnect/wrappers/FilteringWrapper.h index 32f3a83870f8..5d4390891c78 100644 --- a/js/xpconnect/wrappers/FilteringWrapper.h +++ b/js/xpconnect/wrappers/FilteringWrapper.h @@ -12,10 +12,6 @@ #include "js/CallNonGenericMethod.h" #include "js/Wrapper.h" -namespace JS { -class AutoIdVector; -} // namespace JS - namespace xpc { template From a3cd8aad3606dada2342acff1ac41ac77665fe5f Mon Sep 17 00:00:00 2001 From: Olli Pettay Date: Thu, 1 Mar 2018 12:19:35 +0200 Subject: [PATCH 12/67] bug 1440809, ensure we don't try to treat non-DOM-Node event targets as such, r=masayuki --HG-- extra : rebase_source : da4dd83deca1d4eddc101c2dcc992701369f1df6 --- dom/base/FragmentOrElement.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dom/base/FragmentOrElement.cpp b/dom/base/FragmentOrElement.cpp index 40c2cea988f0..8c23d2de91f0 100644 --- a/dom/base/FragmentOrElement.cpp +++ b/dom/base/FragmentOrElement.cpp @@ -1102,7 +1102,12 @@ nsIContent::GetEventTargetParent(EventChainPreVisitor& aVisitor) nsContentUtils::Retarget(relatedTargetAsNode, this); nsCOMPtr targetInKnownToBeHandledScope = FindChromeAccessOnlySubtreeOwner(aVisitor.mTargetInKnownToBeHandledScope); - if (nsContentUtils::ContentIsShadowIncludingDescendantOf( + // If aVisitor.mTargetInKnownToBeHandledScope wasn't nsINode, + // targetInKnownToBeHandledScope will be null. This may happen when + // dispatching event to Window object in a content page and + // propagating the event to a chrome Element. + if (targetInKnownToBeHandledScope && + nsContentUtils::ContentIsShadowIncludingDescendantOf( this, targetInKnownToBeHandledScope->SubtreeRoot())) { // Part of step 11.4. // "If target's root is a shadow-including inclusive ancestor of From e8f515046724496fbdd1975de8bb2785940419a8 Mon Sep 17 00:00:00 2001 From: Christoph Kerschbaumer Date: Thu, 1 Mar 2018 13:45:04 +0100 Subject: [PATCH 13/67] Bug 1439444: resource and chrome images and styles should not be subject to CSP. r=gijs --- dom/security/nsCSPService.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/dom/security/nsCSPService.cpp b/dom/security/nsCSPService.cpp index 6e6f02c585fb..f0d733454fc2 100644 --- a/dom/security/nsCSPService.cpp +++ b/dom/security/nsCSPService.cpp @@ -43,13 +43,17 @@ NS_IMPL_ISUPPORTS(CSPService, nsIContentPolicy, nsIChannelEventSink) // Helper function to identify protocols and content types not subject to CSP. bool subjectToCSP(nsIURI* aURI, nsContentPolicyType aContentType) { + + nsContentPolicyType contentType = + nsContentUtils::InternalContentPolicyTypeToExternal(aContentType); + // These content types are not subject to CSP content policy checks: // TYPE_CSP_REPORT -- csp can't block csp reports // TYPE_REFRESH -- never passed to ShouldLoad (see nsIContentPolicy.idl) // TYPE_DOCUMENT -- used for frame-ancestors - if (aContentType == nsIContentPolicy::TYPE_CSP_REPORT || - aContentType == nsIContentPolicy::TYPE_REFRESH || - aContentType == nsIContentPolicy::TYPE_DOCUMENT) { + if (contentType == nsIContentPolicy::TYPE_CSP_REPORT || + contentType == nsIContentPolicy::TYPE_REFRESH || + contentType == nsIContentPolicy::TYPE_DOCUMENT) { return false; } @@ -90,12 +94,16 @@ subjectToCSP(nsIURI* aURI, nsContentPolicyType aContentType) { // hence we use protocol flags to accomplish that, but we also // want resource:, chrome: and moz-icon to be subject to CSP // (which also use URI_IS_LOCAL_RESOURCE). + // Exception to the rule are images and styles using a scheme + // of resource: or chrome: + bool isImgOrStyle = contentType == nsIContentPolicy::TYPE_IMAGE || + contentType == nsIContentPolicy::TYPE_STYLESHEET; rv = aURI->SchemeIs("resource", &match); - if (NS_SUCCEEDED(rv) && match) { + if (NS_SUCCEEDED(rv) && match && !isImgOrStyle) { return true; } rv = aURI->SchemeIs("chrome", &match); - if (NS_SUCCEEDED(rv) && match) { + if (NS_SUCCEEDED(rv) && match && !isImgOrStyle) { return true; } rv = aURI->SchemeIs("moz-icon", &match); From 8dccbf98a344fe99e8aa9872ec3dd902b9b29cf2 Mon Sep 17 00:00:00 2001 From: Yura Zenevich Date: Thu, 1 Mar 2018 09:48:41 -0500 Subject: [PATCH 14/67] Bug 1428430 - added enable, disable, highlighter, picker a11y functionality. r=pbro, ochameau MozReview-Commit-ID: 7QsY75oJCtW --- .../server/actors/accessibility-parent.js | 232 +++++ devtools/server/actors/accessibility.js | 824 +++++++++++++++--- devtools/server/actors/moz.build | 1 + devtools/server/tests/browser/browser.ini | 2 +- .../browser/browser_accessibility_node.js | 57 +- .../browser_accessibility_node_events.js | 87 +- .../browser/browser_accessibility_simple.js | 49 +- .../browser/browser_accessibility_walker.js | 67 +- devtools/server/tests/browser/head.js | 47 +- devtools/shared/fronts/accessibility.js | 163 ++-- devtools/shared/specs/accessibility.js | 132 ++- 11 files changed, 1388 insertions(+), 273 deletions(-) create mode 100644 devtools/server/actors/accessibility-parent.js diff --git a/devtools/server/actors/accessibility-parent.js b/devtools/server/actors/accessibility-parent.js new file mode 100644 index 000000000000..deddedb698cd --- /dev/null +++ b/devtools/server/actors/accessibility-parent.js @@ -0,0 +1,232 @@ +/* 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 strict"; + +const { Cc, Ci } = require("chrome"); +const Services = require("Services"); +const PREF_ACCESSIBILITY_FORCE_DISABLED = "accessibility.force_disabled"; + +/** + * A helper class that does all the work related to accessibility service + * lifecycle (initialization, shutdown, consumer changes, etc) in parent + * parent process. It is not guaranteed that the AccessibilityActor starts in + * parent process and thus triggering these lifecycle functions directly is + * extremely unreliable. + */ +class AccessibilityParent { + constructor(mm, prefix) { + this._msgName = `debug:${prefix}accessibility`; + this.onAccessibilityMessage = this.onAccessibilityMessage.bind(this); + this.setMessageManager(mm); + + this.userPref = Services.prefs.getIntPref(PREF_ACCESSIBILITY_FORCE_DISABLED); + Services.obs.addObserver(this, "a11y-consumers-changed"); + Services.prefs.addObserver(PREF_ACCESSIBILITY_FORCE_DISABLED, this); + + if (this.enabled && !this.accService) { + // Set a local reference to an accessibility service if accessibility was + // started elsewhere to ensure that parent process a11y service does not + // get GC'ed away. + this.accService = Cc["@mozilla.org/accessibilityService;1"].getService( + Ci.nsIAccessibilityService); + } + + this.messageManager.sendAsyncMessage(`${this._msgName}:event`, { + topic: "initialized", + data: { + canBeDisabled: this.canBeDisabled, + canBeEnabled: this.canBeEnabled + } + }); + } + + /** + * Set up message manager listener to listen for messages coming from the + * AccessibilityActor when it is instantiated in the child process. + * + * @param {Object} mm + * Message manager that corresponds to the current content tab. + */ + setMessageManager(mm) { + if (this.messageManager === mm) { + return; + } + + if (this.messageManager) { + // If the browser was swapped we need to reset the message manager. + let oldMM = this.messageManager; + oldMM.removeMessageListener(this._msgName, this.onAccessibilityMessage); + } + + this.messageManager = mm; + if (mm) { + mm.addMessageListener(this._msgName, this.onAccessibilityMessage); + } + } + + /** + * Content AccessibilityActor message listener. + * + * @param {String} msg + * Name of the action to perform. + */ + onAccessibilityMessage(msg) { + let { action } = msg.json; + switch (action) { + case "enable": + this.enable(); + break; + + case "disable": + this.disable(); + break; + + case "disconnect": + this.destroy(); + break; + + default: + break; + } + } + + observe(subject, topic, data) { + if (topic === "a11y-consumers-changed") { + // This event is fired when accessibility service consumers change. Since + // this observer lives in parent process there are 2 possible consumers of + // a11y service: XPCOM and PlatformAPI (e.g. screen readers). We only care + // about PlatformAPI consumer changes because when set, we can no longer + // disable accessibility service. + let { PlatformAPI } = JSON.parse(data); + this.messageManager.sendAsyncMessage(`${this._msgName}:event`, { + topic: "can-be-disabled-change", + data: !PlatformAPI + }); + } else if (!this.disabling && topic === "nsPref:changed" && + data === PREF_ACCESSIBILITY_FORCE_DISABLED) { + // PREF_ACCESSIBILITY_FORCE_DISABLED preference change event. When set to + // >=1, it means that the user wants to disable accessibility service and + // prevent it from starting in the future. Note: we also check + // this.disabling state when handling this pref change because this is how + // we disable the accessibility inspector itself. + this.messageManager.sendAsyncMessage(`${this._msgName}:event`, { + topic: "can-be-enabled-change", + data: Services.prefs.getIntPref(PREF_ACCESSIBILITY_FORCE_DISABLED) < 1 + }); + } + } + + /** + * A getter that indicates if accessibility service is enabled. + * + * @return {Boolean} + * True if accessibility service is on. + */ + get enabled() { + return Services.appinfo.accessibilityEnabled; + } + + /** + * A getter that indicates if the accessibility service can be disabled. + * + * @return {Boolean} + * True if accessibility service can be disabled. + */ + get canBeDisabled() { + if (this.enabled) { + let a11yService = Cc["@mozilla.org/accessibilityService;1"].getService( + Ci.nsIAccessibilityService); + let { PlatformAPI } = JSON.parse(a11yService.getConsumers()); + return !PlatformAPI; + } + + return true; + } + + /** + * A getter that indicates if the accessibility service can be enabled. + * + * @return {Boolean} + * True if accessibility service can be enabled. + */ + get canBeEnabled() { + return Services.prefs.getIntPref(PREF_ACCESSIBILITY_FORCE_DISABLED) < 1; + } + + /** + * Enable accessibility service (via XPCOM service). + */ + enable() { + if (this.enabled || !this.canBeEnabled) { + return; + } + + this.accService = Cc["@mozilla.org/accessibilityService;1"].getService( + Ci.nsIAccessibilityService); + } + + /** + * Force disable accessibility service. This method removes the reference to + * the XPCOM a11y service object and flips the + * PREF_ACCESSIBILITY_FORCE_DISABLED preference on and off to shutdown a11y + * service. + */ + disable() { + if (!this.enabled || !this.canBeDisabled) { + return; + } + + this.disabling = true; + this.accService = null; + // Set PREF_ACCESSIBILITY_FORCE_DISABLED to 1 to force disable + // accessibility service. This is the only way to guarantee an immediate + // accessibility service shutdown in all processes. This also prevents + // accessibility service from starting up in the future. + Services.prefs.setIntPref(PREF_ACCESSIBILITY_FORCE_DISABLED, 1); + // Set PREF_ACCESSIBILITY_FORCE_DISABLED back to previous default or user + // set value. This will not start accessibility service until the user + // activates it again. It simply ensures that accessibility service can + // start again (when value is below 1). + Services.prefs.setIntPref(PREF_ACCESSIBILITY_FORCE_DISABLED, this.userPref); + delete this.disabling; + } + + /** + * Destroy thie helper class, remove all listeners and if possible disable + * accessibility service in the parent process. + */ + destroy() { + Services.obs.removeObserver(this, "a11y-consumers-changed"); + Services.prefs.removeObserver(PREF_ACCESSIBILITY_FORCE_DISABLED, this); + this.setMessageManager(null); + this.accService = null; + } +} + +/** + * Setup function that runs in parent process and setups AccessibleActor bits + * that must always run in parent process. + * + * @param {Object} options.mm + * Message manager that corresponds to the current content tab. + * @param {String} options.prefix + * Unique prefix for message manager messages. + * @return {Object} + * Defines event listeners for when client disconnects or browser gets + * swapped. + */ +function setupParentProcess({ mm, prefix }) { + let accessibility = new AccessibilityParent(mm, prefix); + + return { + onBrowserSwap: newMM => accessibility.setMessageManager(newMM), + onDisconnected: () => { + accessibility.destroy(); + accessibility = null; + } + }; +} + +exports.setupParentProcess = setupParentProcess; diff --git a/devtools/server/actors/accessibility.js b/devtools/server/actors/accessibility.js index 45e5ddbf4cf6..91e92421d7c3 100644 --- a/devtools/server/actors/accessibility.js +++ b/devtools/server/actors/accessibility.js @@ -6,6 +6,7 @@ const { Cc, Ci, Cu } = require("chrome"); const DevToolsUtils = require("devtools/shared/DevToolsUtils"); +const { DebuggerServer } = require("devtools/server/main"); const Services = require("Services"); const { Actor, ActorClassWithSpec } = require("devtools/shared/protocol"); const defer = require("devtools/shared/defer"); @@ -16,9 +17,16 @@ const { accessibilitySpec } = require("devtools/shared/specs/accessibility"); +const { isXUL } = require("devtools/server/actors/highlighters/utils/markup"); +const { isWindowIncluded } = require("devtools/shared/layout/utils"); +const { CustomHighlighterActor, register } = + require("devtools/server/actors/highlighters"); +const PREF_ACCESSIBILITY_FORCE_DISABLED = "accessibility.force_disabled"; + const nsIAccessibleEvent = Ci.nsIAccessibleEvent; const nsIAccessibleStateChangeEvent = Ci.nsIAccessibleStateChangeEvent; const nsIPropertyElement = Ci.nsIPropertyElement; +const nsIAccessibleRole = Ci.nsIAccessibleRole; const { EVENT_TEXT_CHANGED, @@ -39,7 +47,84 @@ const { EVENT_VALUE_CHANGE } = nsIAccessibleEvent; -const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; +// TODO: We do not need this once bug 1422913 is fixed. We also would not need +// to fire a name change event for an accessible that has an updated subtree and +// that has its name calculated from the said subtree. +const NAME_FROM_SUBTREE_RULE_ROLES = new Set([ + nsIAccessibleRole.ROLE_BUTTONDROPDOWN, + nsIAccessibleRole.ROLE_BUTTONDROPDOWNGRID, + nsIAccessibleRole.ROLE_BUTTONMENU, + nsIAccessibleRole.ROLE_CELL, + nsIAccessibleRole.ROLE_CHECKBUTTON, + nsIAccessibleRole.ROLE_CHECK_MENU_ITEM, + nsIAccessibleRole.ROLE_CHECK_RICH_OPTION, + nsIAccessibleRole.ROLE_COLUMN, + nsIAccessibleRole.ROLE_COLUMNHEADER, + nsIAccessibleRole.ROLE_COMBOBOX_OPTION, + nsIAccessibleRole.ROLE_DEFINITION, + nsIAccessibleRole.ROLE_GRID_CELL, + nsIAccessibleRole.ROLE_HEADING, + nsIAccessibleRole.ROLE_HELPBALLOON, + nsIAccessibleRole.ROLE_HTML_CONTAINER, + nsIAccessibleRole.ROLE_KEY, + nsIAccessibleRole.ROLE_LABEL, + nsIAccessibleRole.ROLE_LINK, + nsIAccessibleRole.ROLE_LISTITEM, + nsIAccessibleRole.ROLE_MATHML_IDENTIFIER, + nsIAccessibleRole.ROLE_MATHML_NUMBER, + nsIAccessibleRole.ROLE_MATHML_OPERATOR, + nsIAccessibleRole.ROLE_MATHML_TEXT, + nsIAccessibleRole.ROLE_MATHML_STRING_LITERAL, + nsIAccessibleRole.ROLE_MATHML_GLYPH, + nsIAccessibleRole.ROLE_MENUITEM, + nsIAccessibleRole.ROLE_OPTION, + nsIAccessibleRole.ROLE_OUTLINEITEM, + nsIAccessibleRole.ROLE_PAGETAB, + nsIAccessibleRole.ROLE_PARENT_MENUITEM, + nsIAccessibleRole.ROLE_PUSHBUTTON, + nsIAccessibleRole.ROLE_RADIOBUTTON, + nsIAccessibleRole.ROLE_RADIO_MENU_ITEM, + nsIAccessibleRole.ROLE_RICH_OPTION, + nsIAccessibleRole.ROLE_ROW, + nsIAccessibleRole.ROLE_ROWHEADER, + nsIAccessibleRole.ROLE_SUMMARY, + nsIAccessibleRole.ROLE_SWITCH, + nsIAccessibleRole.ROLE_TABLE_COLUMN_HEADER, + nsIAccessibleRole.ROLE_TABLE_ROW_HEADER, + nsIAccessibleRole.ROLE_TEAR_OFF_MENU_ITEM, + nsIAccessibleRole.ROLE_TERM, + nsIAccessibleRole.ROLE_TOGGLE_BUTTON, + nsIAccessibleRole.ROLE_TOOLTIP +]); + +const IS_OSX = Services.appinfo.OS === "Darwin"; + +register("AccessibleHighlighter", "accessible"); +register("XULWindowAccessibleHighlighter", "xul-accessible"); + +/** + * Helper function that determines if nsIAccessible object is in defunct state. + * + * @param {nsIAccessible} accessible + * object to be tested. + * @return {Boolean} + * True if accessible object is defunct, false otherwise. + */ +function isDefunct(accessible) { + let defunct = false; + + try { + let extState = {}; + accessible.getState({}, extState); + // extState.value is a bitmask. We are applying bitwise AND to mask out + // irrelevant states. + defunct = !!(extState.value & Ci.nsIAccessibleStates.EXT_STATE_DEFUNCT); + } catch (e) { + defunct = true; + } + + return defunct; +} /** * Set of actors that expose accessibility tree information to the @@ -49,7 +134,7 @@ const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; * an AccessibleWalker actor that caches the tree of Accessible actors. * * The |AccessibleWalker| actor is used to cache all seen Accessible actors as - * well as observe all relevant accesible events. + * well as observe all relevant accessible events. * * The |Accessible| actor provides information about a particular accessible * object, its properties, , attributes, states, relations, etc. @@ -72,18 +157,7 @@ const AccessibleActor = ActorClassWithSpec(accessibleSpec, { */ Object.defineProperty(this, "isDefunct", { get() { - let defunct = false; - - try { - let extState = {}; - this.rawAccessible.getState({}, extState); - // extState.value is a bitmask. We are applying bitwise AND to mask out - // irrelelvant states. - defunct = !!(extState.value & Ci.nsIAccessibleStates.EXT_STATE_DEFUNCT); - } catch (e) { - defunct = true; - } - + let defunct = isDefunct(this.rawAccessible); if (defunct) { delete this.isDefunct; this.isDefunct = true; @@ -165,6 +239,13 @@ const AccessibleActor = ActorClassWithSpec(accessibleSpec, { return this.rawAccessible.DOMNode ? this.rawAccessible.DOMNode.nodeType : 0; }, + get parentAcc() { + if (this.isDefunct) { + return null; + } + return this.walker.addRef(this.rawAccessible.parent); + }, + children() { let children = []; if (this.isDefunct) { @@ -177,14 +258,20 @@ const AccessibleActor = ActorClassWithSpec(accessibleSpec, { return children; }, - getIndexInParent() { + get indexInParent() { if (this.isDefunct) { return -1; } - return this.rawAccessible.indexInParent; + + try { + return this.rawAccessible.indexInParent; + } catch (e) { + // Accessible is dead. + return -1; + } }, - getActions() { + get actions() { let actions = []; if (this.isDefunct) { return actions; @@ -196,7 +283,7 @@ const AccessibleActor = ActorClassWithSpec(accessibleSpec, { return actions; }, - getState() { + get states() { if (this.isDefunct) { return []; } @@ -209,7 +296,7 @@ const AccessibleActor = ActorClassWithSpec(accessibleSpec, { ]; }, - getAttributes() { + get attributes() { if (this.isDefunct || !this.rawAccessible.attributes) { return {}; } @@ -225,6 +312,25 @@ const AccessibleActor = ActorClassWithSpec(accessibleSpec, { return attributes; }, + get bounds() { + if (this.isDefunct) { + return null; + } + + let x = {}, y = {}, w = {}, h = {}; + try { + this.rawAccessible.getBounds(x, y, w, h); + x = x.value; + y = y.value; + w = w.value; + h = h.value; + } catch (e) { + return null; + } + + return { x, y, w, h }; + }, + form() { return { actor: this.actorID, @@ -236,7 +342,10 @@ const AccessibleActor = ActorClassWithSpec(accessibleSpec, { keyboardShortcut: this.keyboardShortcut, childCount: this.childCount, domNodeType: this.domNodeType, - walker: this.walker.form() + indexInParent: this.indexInParent, + states: this.states, + actions: this.actions, + attributes: this.attributes }; } }); @@ -253,67 +362,33 @@ const AccessibleWalkerActor = ActorClassWithSpec(accessibleWalkerSpec, { initialize(conn, tabActor) { Actor.prototype.initialize.call(this, conn); this.tabActor = tabActor; - this.rootWin = tabActor.window; - this.rootDoc = tabActor.window.document; this.refMap = new Map(); - // Accessibility Walker should only be considered ready, when raw accessible - // object for root document is fully initialized (e.g. does not have a - // 'busy' state) - this.readyDeferred = defer(); + this.setA11yServiceGetter(); + this.onPick = this.onPick.bind(this); + this.onHovered = this.onHovered.bind(this); + this.onKey = this.onKey.bind(this); + this.highlighter = CustomHighlighterActor(this, isXUL(this.rootWin) ? + "XULWindowAccessibleHighlighter" : "AccessibleHighlighter"); + }, + + setA11yServiceGetter() { DevToolsUtils.defineLazyGetter(this, "a11yService", () => { Services.obs.addObserver(this, "accessible-event"); return Cc["@mozilla.org/accessibilityService;1"].getService( Ci.nsIAccessibilityService); }); - - this.onLoad = this.onLoad.bind(this); - this.onUnload = this.onUnload.bind(this); - - events.on(tabActor, "will-navigate", this.onUnload); - events.on(tabActor, "window-ready", this.onLoad); }, - onUnload({ window }) { - let doc = window.document; - let actor = this.getRef(doc); - - // If an accessible actor was never created for document, then there's - // nothing to clean up. - if (!actor) { - return; - } - - // Purge document's subtree from accessible actors cache. - this.purgeSubtree(this.a11yService.getAccessibleFor(this.doc)); - // If document is a root document, clear it's reference and cache. - if (this.rootDoc === doc) { - this.rootDoc = null; - this.refMap.clear(); - this.readyDeferred = defer(); - } + get rootWin() { + return this.tabActor && this.tabActor.window; }, - onLoad({ window, isTopLevel }) { - if (isTopLevel) { - // If root document is dead, unload it and clean up. - if (this.rootDoc && !Cu.isDeadWrapper(this.rootDoc) && - this.rootDoc.defaultView) { - this.onUnload({ window: this.rootDoc.defaultView }); - } - - this.rootWin = window; - this.rootDoc = window.document; - } + get rootDoc() { + return this.tabActor && this.tabActor.window.document; }, - destroy() { - if (this._destroyed) { - return; - } - - this._destroyed = true; - + reset() { try { Services.obs.removeObserver(this, "accessible-event"); } catch (e) { @@ -321,23 +396,34 @@ const AccessibleWalkerActor = ActorClassWithSpec(accessibleWalkerSpec, { // service was never used. } + this.cancelPick(); + // Clean up accessible actors cache. if (this.refMap.size > 0) { - this.purgeSubtree(this.a11yService.getAccessibleFor(this.rootDoc)); - this.refMap.clear(); + try { + if (this.rootDoc) { + this.purgeSubtree(this.a11yService.getAccessibleFor(this.rootDoc), + this.rootDoc); + } + } catch (e) { + // Accessibility service might be already destroyed. + } } - events.off(this.tabActor, "will-navigate", this.onUnload); - events.off(this.tabActor, "window-ready", this.onLoad); - - this.onLoad = null; - this.onUnload = null; delete this.a11yService; - this.tabActor = null; - this.rootDoc = null; - this.refMap = null; + this.setA11yServiceGetter(); + }, + destroy() { Actor.prototype.destroy.call(this); + + this.reset(); + + this.highlighter.destroy(); + this.highlighter = null; + + this.tabActor = null; + this.refMap = null; }, getRef(rawAccessible) { @@ -361,8 +447,9 @@ const AccessibleWalkerActor = ActorClassWithSpec(accessibleWalkerSpec, { * Clean up accessible actors cache for a given accessible's subtree. * * @param {nsIAccessible} rawAccessible + * @param {null|Object} rawNode */ - purgeSubtree(rawAccessible) { + purgeSubtree(rawAccessible, rawNode) { let actor = this.getRef(rawAccessible); if (actor && rawAccessible && !actor.isDefunct) { for (let child = rawAccessible.firstChild; child; child = child.nextSibling) { @@ -376,6 +463,11 @@ const AccessibleWalkerActor = ActorClassWithSpec(accessibleWalkerSpec, { events.emit(this, "accessible-destroy", actor); actor.destroy(); } + + // If corresponding DOMNode is a top level document, clear entire cache. + if (rawNode && rawNode === this.rootDoc) { + this.refMap.clear(); + } }, /** @@ -393,15 +485,23 @@ const AccessibleWalkerActor = ActorClassWithSpec(accessibleWalkerSpec, { * @return {Promise} */ getDocument() { - let doc = this.addRef(this.a11yService.getAccessibleFor(this.rootDoc)); - let states = doc.getState(); - - if (states.includes("busy")) { - return this.readyDeferred.promise.then(() => doc); + if (!this.rootDoc || !this.rootDoc.documentElement) { + return this.once("document-ready").then(docAcc => this.addRef(docAcc)); } - this.readyDeferred.resolve(); - return Promise.resolve(doc); + if (isXUL(this.rootWin)) { + let doc = this.addRef(this.a11yService.getAccessibleFor(this.rootDoc)); + return Promise.resolve(doc); + } + + let doc = this.a11yService.getAccessibleFor(this.rootDoc); + let state = {}; + doc.getState(state, {}); + if (state.value & Ci.nsIAccessibleStates.STATE_BUSY) { + return this.once("document-ready").then(docAcc => this.addRef(docAcc)); + } + + return Promise.resolve(this.addRef(doc)); }, getAccessibleFor(domNode) { @@ -410,6 +510,26 @@ const AccessibleWalkerActor = ActorClassWithSpec(accessibleWalkerSpec, { this.addRef(this.a11yService.getAccessibleFor(domNode.rawNode))); }, + async getAncestry(accessible) { + if (accessible.indexInParent === -1) { + return []; + } + const doc = await this.getDocument(); + let ancestry = []; + try { + let parent = accessible; + while (parent && (parent = parent.parentAcc) && parent != doc) { + ancestry.push(parent); + } + ancestry.push(doc); + } catch (error) { + throw new Error(`Failed to get ancestor for ${accessible}: ${error}`); + } + + return ancestry.map(parent => ( + { accessible: parent, children: parent.children() })); + }, + /** * Accessible event observer function. * @@ -424,25 +544,28 @@ const AccessibleWalkerActor = ActorClassWithSpec(accessibleWalkerSpec, { switch (event.eventType) { case EVENT_STATE_CHANGE: let { state, isEnabled } = event.QueryInterface(nsIAccessibleStateChangeEvent); - let states = [...this.a11yService.getStringStates(state, 0)]; - - if (states.includes("busy") && !isEnabled) { - let { DOMNode } = event; - // If debugging chrome, wait for top level content document loaded, - // otherwise wait for root document loaded. - if (DOMNode == this.rootDoc || ( - this.rootDoc.documentElement.namespaceURI === XUL_NS && - this.rootWin.gBrowser.selectedBrowser.contentDocument == DOMNode)) { - this.readyDeferred.resolve(); + let isBusy = state & Ci.nsIAccessibleStates.STATE_BUSY; + // Accessible document is recreated. + if (isBusy && !isEnabled && rawAccessible instanceof Ci.nsIAccessibleDocument) { + // Remove its existing cache from tree. + this.purgeSubtree(rawAccessible, event.DOMNode); + // If it's a top level document notify listeners about the document + // being ready. + if (event.DOMNode == this.rootDoc) { + events.emit(this, "document-ready", rawAccessible); } } if (accessible) { // Only propagate state change events for active accessibles. - if (states.includes("busy") && isEnabled) { + if (isBusy && isEnabled) { + if (rawAccessible instanceof Ci.nsIAccessibleDocument) { + // Remove its existing cache from tree. + this.purgeSubtree(rawAccessible, event.DOMNode); + } return; } - events.emit(accessible, "state-change", accessible.getState()); + events.emit(accessible, "states-change", accessible.states); } break; @@ -450,7 +573,7 @@ const AccessibleWalkerActor = ActorClassWithSpec(accessibleWalkerSpec, { if (accessible) { events.emit(accessible, "name-change", rawAccessible.name, event.DOMNode == this.rootDoc ? - undefined : this.getRef(rawAccessible.parent)); + undefined : this.getRef(rawAccessible.parent), this); } break; case EVENT_VALUE_CHANGE: @@ -470,7 +593,9 @@ const AccessibleWalkerActor = ActorClassWithSpec(accessibleWalkerSpec, { break; case EVENT_REORDER: if (accessible) { - events.emit(accessible, "reorder", rawAccessible.childCount); + accessible.children().forEach(child => + events.emit(child, "index-in-parent-change", child.indexInParent)); + events.emit(accessible, "reorder", rawAccessible.childCount, this); } break; case EVENT_HIDE: @@ -479,21 +604,26 @@ const AccessibleWalkerActor = ActorClassWithSpec(accessibleWalkerSpec, { case EVENT_DEFACTION_CHANGE: case EVENT_ACTION_CHANGE: if (accessible) { - events.emit(accessible, "actions-change", accessible.getActions()); + events.emit(accessible, "actions-change", accessible.actions); } break; case EVENT_TEXT_CHANGED: case EVENT_TEXT_INSERTED: case EVENT_TEXT_REMOVED: if (accessible) { - events.emit(accessible, "text-change"); + events.emit(accessible, "text-change", this); + if (NAME_FROM_SUBTREE_RULE_ROLES.has(rawAccessible.role)) { + events.emit(accessible, "name-change", rawAccessible.name, + event.DOMNode == this.rootDoc ? + undefined : this.getRef(rawAccessible.parent), this); + } } break; case EVENT_DOCUMENT_ATTRIBUTES_CHANGED: case EVENT_OBJECT_ATTRIBUTE_CHANGED: case EVENT_TEXT_ATTRIBUTE_CHANGED: if (accessible) { - events.emit(accessible, "attributes-change", accessible.getAttributes()); + events.emit(accessible, "attributes-change", accessible.attributes); } break; case EVENT_ACCELERATOR_CHANGE: @@ -504,6 +634,265 @@ const AccessibleWalkerActor = ActorClassWithSpec(accessibleWalkerSpec, { default: break; } + }, + + /** + * Public method used to show an accessible object highlighter on the client + * side. + * + * @param {Object} accessible + * AccessibleActor to be highlighted. + * @param {Object} options + * Object used for passing options. Available options: + * - duration {Number} + * Duration of time that the highlighter should be shown. + * @return {Boolean} + * True if highlighter shows the accessible object. + */ + highlightAccessible(accessible, options = {}) { + let bounds = accessible.bounds; + if (!bounds) { + return false; + } + + return this.highlighter.show({ rawNode: accessible.rawAccessible.DOMNode }, + { ...options, ...bounds }); + }, + + /** + * Public method used to hide an accessible object highlighter on the client + * side. + */ + unhighlight() { + this.highlighter.hide(); + }, + + /** + * Picking state that indicates if picking is currently enabled and, if so, + * what the current and hovered accessible objects are. + */ + _isPicking: false, + _currentAccessible: null, + + /** + * Check is event handling is allowed. + */ + _isEventAllowed: function ({ view }) { + return this.rootWin instanceof Ci.nsIDOMChromeWindow || + isWindowIncluded(this.rootWin, view); + }, + + _preventContentEvent(event) { + event.stopPropagation(); + event.preventDefault(); + }, + + /** + * Click event handler for when picking is enabled. + * + * @param {Object} event + * Current click event. + */ + async onPick(event) { + if (!this._isPicking) { + return; + } + + this._preventContentEvent(event); + if (!this._isEventAllowed(event)) { + return; + } + + // If shift is pressed, this is only a preview click, send the event to + // the client, but don't stop picking. + if (event.shiftKey) { + if (!this._currentAccessible) { + this._currentAccessible = await this._findAndAttachAccessible(event); + } + events.emit(this, "picker-accessible-previewed", this._currentAccessible); + return; + } + + this._stopPickerListeners(); + this._isPicking = false; + if (!this._currentAccessible) { + this._currentAccessible = await this._findAndAttachAccessible(event); + } + events.emit(this, "picker-accessible-picked", this._currentAccessible); + }, + + /** + * Hover event handler for when picking is enabled. + * + * @param {Object} event + * Current hover event. + */ + async onHovered(event) { + if (!this._isPicking) { + return; + } + + this._preventContentEvent(event); + if (!this._isEventAllowed(event)) { + return; + } + + let accessible = await this._findAndAttachAccessible(event); + if (!accessible) { + return; + } + + if (this._currentAccessible !== accessible) { + let { bounds } = accessible; + if (bounds) { + this.highlighter.show({ rawNode: event.originalTarget || event.target }, bounds); + } + + events.emit(this, "picker-accessible-hovered", accessible); + this._currentAccessible = accessible; + } + }, + + /** + * Keyboard event handler for when picking is enabled. + * + * @param {Object} event + * Current keyboard event. + */ + onKey(event) { + if (!this._currentAccessible || !this._isPicking) { + return; + } + + this._preventContentEvent(event); + if (!this._isEventAllowed(event)) { + return; + } + + /** + * KEY: Action/scope + * ENTER/CARRIAGE_RETURN: Picks current accessible + * ESC/CTRL+SHIFT+C: Cancels picker + */ + switch (event.keyCode) { + // Select the element. + case event.DOM_VK_RETURN: + this._onPick(event); + break; + // Cancel pick mode. + case event.DOM_VK_ESCAPE: + this.cancelPick(); + events.emit(this, "picker-accessible-canceled"); + break; + case event.DOM_VK_C: + if ((IS_OSX && event.metaKey && event.altKey) || + (!IS_OSX && event.ctrlKey && event.shiftKey)) { + this.cancelPick(); + events.emit(this, "picker-accessible-canceled"); + } + break; + default: + break; + } + }, + + /** + * Picker method that starts picker content listeners. + */ + pick: function () { + if (!this._isPicking) { + this._isPicking = true; + this._startPickerListeners(); + } + }, + + /** + * This pick method also focuses the highlighter's target window. + */ + pickAndFocus: function () { + this.pick(); + this.rootWin.focus(); + }, + + /** + * Find accessible object that corresponds to a DOMNode and attach (lookup its + * ancestry to the root doc) to the AccessibilityWalker tree. + * + * @param {Object} event + * Correspoinding content event. + * @return {null|Object} + * Accessible object, if available, that corresponds to a DOM node. + */ + async _findAndAttachAccessible(event) { + let target = event.originalTarget || event.target; + let rawAccessible = this.a11yService.getAccessibleFor(target); + // If raw accessible object is defunct or detached, no need to cache it and + // its ancestry. + if (!rawAccessible || isDefunct(rawAccessible) || rawAccessible.indexInParent < 0) { + return {}; + } + + const doc = await this.getDocument(); + let accessible = this.addRef(rawAccessible); + // There is a chance that ancestry lookup can fail if the accessible is in + // the detached subtree. At that point the root accessible object would be + // defunct and accessing it via parent property will throw. + try { + let parent = accessible; + while (parent && parent != doc) { + parent = parent.parentAcc; + } + } catch (error) { + throw new Error(`Failed to get ancestor for ${accessible}: ${error}`); + } + + return accessible; + }, + + /** + * Start picker content listeners. + */ + _startPickerListeners: function () { + let target = this.tabActor.chromeEventHandler; + target.addEventListener("mousemove", this.onHovered, true); + target.addEventListener("click", this.onPick, true); + target.addEventListener("mousedown", this._preventContentEvent, true); + target.addEventListener("mouseup", this._preventContentEvent, true); + target.addEventListener("dblclick", this._preventContentEvent, true); + target.addEventListener("keydown", this.onKey, true); + target.addEventListener("keyup", this._preventContentEvent, true); + }, + + /** + * If content is still alive, stop picker content listeners. + */ + _stopPickerListeners: function () { + let target = this.tabActor.chromeEventHandler; + + if (!target) { + return; + } + + target.removeEventListener("mousemove", this.onHovered, true); + target.removeEventListener("click", this.onPick, true); + target.removeEventListener("mousedown", this._preventContentEvent, true); + target.removeEventListener("mouseup", this._preventContentEvent, true); + target.removeEventListener("dblclick", this._preventContentEvent, true); + target.removeEventListener("keydown", this.onKey, true); + target.removeEventListener("keyup", this._preventContentEvent, true); + }, + + /** + * Cacncel picker pick. Remvoe all content listeners and hide the highlighter. + */ + cancelPick: function () { + this.highlighter.hide(); + + if (this._isPicking) { + this._stopPickerListeners(); + this._isPicking = false; + this._currentAccessible = null; + } } }); @@ -515,9 +904,207 @@ const AccessibleWalkerActor = ActorClassWithSpec(accessibleWalkerSpec, { const AccessibilityActor = ActorClassWithSpec(accessibilitySpec, { initialize(conn, tabActor) { Actor.prototype.initialize.call(this, conn); + + this.initializedDeferred = defer(); + + if (DebuggerServer.isInChildProcess) { + this._msgName = `debug:${this.conn.prefix}accessibility`; + this.conn.setupInParent({ + module: "devtools/server/actors/accessibility-parent", + setupParent: "setupParentProcess" + }); + + this.onMessage = this.onMessage.bind(this); + this.messageManager.addMessageListener(`${this._msgName}:event`, this.onMessage); + } else { + this.userPref = Services.prefs.getIntPref(PREF_ACCESSIBILITY_FORCE_DISABLED); + Services.obs.addObserver(this, "a11y-consumers-changed"); + Services.prefs.addObserver(PREF_ACCESSIBILITY_FORCE_DISABLED, this); + this.initializedDeferred.resolve(); + } + + Services.obs.addObserver(this, "a11y-init-or-shutdown"); this.tabActor = tabActor; }, + bootstrap() { + return this.initializedDeferred.promise.then(() => ({ + enabled: this.enabled, + canBeEnabled: this.canBeEnabled, + canBeDisabled: this.canBeDisabled + })); + }, + + get enabled() { + return Services.appinfo.accessibilityEnabled; + }, + + get canBeEnabled() { + if (DebuggerServer.isInChildProcess) { + return this._canBeEnabled; + } + + return Services.prefs.getIntPref(PREF_ACCESSIBILITY_FORCE_DISABLED) < 1; + }, + + get canBeDisabled() { + if (DebuggerServer.isInChildProcess) { + return this._canBeDisabled; + } else if (!this.enabled) { + return true; + } + + let { PlatformAPI } = JSON.parse(this.walker.a11yService.getConsumers()); + return !PlatformAPI; + }, + + /** + * Getter for a message manager that corresponds to a current tab. It is onyl + * used if the AccessibilityActor runs in the child process. + * + * @return {Object} + * Message manager that corresponds to the current content tab. + */ + get messageManager() { + if (!DebuggerServer.isInChildProcess) { + throw new Error( + "Message manager should only be used when actor is in child process."); + } + + return this.conn.parentMessageManager; + }, + + onMessage(msg) { + let { topic, data } = msg.data; + + switch (topic) { + case "initialized": + this._canBeEnabled = data.canBeEnabled; + this._canBeDisabled = data.canBeDisabled; + this.initializedDeferred.resolve(); + break; + case "can-be-disabled-change": + this._canBeDisabled = data; + events.emit(this, "can-be-disabled-change", this.canBeDisabled); + break; + + case "can-be-enabled-change": + this._canBeEnabled = data; + events.emit(this, "can-be-enabled-change", this.canBeEnabled); + break; + + default: + break; + } + }, + + /** + * Enable acessibility service in the given process. + */ + async enable() { + if (this.enabled || !this.canBeEnabled) { + return; + } + + let initPromise = this.once("init"); + + if (DebuggerServer.isInChildProcess) { + this.messageManager.sendAsyncMessage(this._msgName, { action: "enable" }); + } else { + // This executes accessibility service lazy getter and adds accessible + // events observer. + this.walker.a11yService; + } + + await initPromise; + }, + + /** + * Disable acessibility service in the given process. + */ + async disable() { + if (!this.enabled || !this.canBeDisabled) { + return; + } + + this.disabling = true; + let shutdownPromise = this.once("shutdown"); + if (DebuggerServer.isInChildProcess) { + this.messageManager.sendAsyncMessage(this._msgName, { action: "disable" }); + } else { + // Set PREF_ACCESSIBILITY_FORCE_DISABLED to 1 to force disable + // accessibility service. This is the only way to guarantee an immediate + // accessibility service shutdown in all processes. This also prevents + // accessibility service from starting up in the future. + // + // TODO: Introduce a shutdown method that is exposed via XPCOM on + // accessibility service. + Services.prefs.setIntPref(PREF_ACCESSIBILITY_FORCE_DISABLED, 1); + // Set PREF_ACCESSIBILITY_FORCE_DISABLED back to previous default or user + // set value. This will not start accessibility service until the user + // activates it again. It simply ensures that accessibility service can + // start again (when value is below 1). + Services.prefs.setIntPref(PREF_ACCESSIBILITY_FORCE_DISABLED, this.userPref); + } + + await shutdownPromise; + delete this.disabling; + }, + + /** + * Observe Accessibility service init and shutdown events. It relays these + * events to AccessibilityFront iff the event is fired for the a11y service + * that lives in the same process. + * + * @param {null} subject + * Not used. + * @param {String} topic + * Name of the a11y service event: "a11y-init-or-shutdown". + * @param {String} data + * "0" corresponds to shutdown and "1" to init. + */ + observe(subject, topic, data) { + if (topic === "a11y-init-or-shutdown") { + // This event is fired when accessibility service is initialized or shut + // down. "init" and "shutdown" events are only relayed when the enabled + // state matches the event (e.g. the event came from the same process as + // the actor). + const enabled = data === "1"; + if (enabled && this.enabled) { + events.emit(this, "init"); + } else if (!enabled && !this.enabled) { + if (this.walker) { + this.walker.reset(); + } + + events.emit(this, "shutdown"); + } + } else if (topic === "a11y-consumers-changed") { + // This event is fired when accessibility service consumers change. There + // are 3 possible consumers of a11y service: XPCOM, PlatformAPI (e.g. + // screen readers) and MainProcess. PlatformAPI consumer can only be set + // in parent process, and MainProcess consumer can only be set in child + // process. We only care about PlatformAPI consumer changes because when + // set, we can no longer disable accessibility service. + let { PlatformAPI } = JSON.parse(data); + events.emit(this, "can-be-disabled-change", !PlatformAPI); + } else if (!this.disabling && topic === "nsPref:changed" && + data === PREF_ACCESSIBILITY_FORCE_DISABLED) { + // PREF_ACCESSIBILITY_FORCE_DISABLED preference change event. When set to + // >=1, it means that the user wants to disable accessibility service and + // prevent it from starting in the future. Note: we also check + // this.disabling state when handling this pref change because this is how + // we disable the accessibility inspector itself. + events.emit(this, "can-be-enabled-change", this.canBeEnabled); + } + }, + + /** + * Get or create AccessibilityWalker actor, similar to WalkerActor. + * + * @return {Object} + * AccessibleWalkerActor for the current tab. + */ getWalker() { if (!this.walker) { this.walker = new AccessibleWalkerActor(this.conn, this.tabActor); @@ -525,11 +1112,38 @@ const AccessibilityActor = ActorClassWithSpec(accessibilitySpec, { return this.walker; }, - destroy() { + /** + * Destroy accessibility service actor. This method also shutsdown + * accessibility service if possible. + */ + async destroy() { + if (this.destroyed) { + await this.destroyed; + return; + } + + let resolver; + this.destroyed = new Promise(resolve => { + resolver = resolve; + }); + + if (this.walker) { + this.walker.reset(); + } + + Services.obs.removeObserver(this, "a11y-init-or-shutdown"); + if (DebuggerServer.isInChildProcess) { + this.messageManager.removeMessageListener(`${this._msgName}:event`, + this.onMessage); + } else { + Services.obs.removeObserver(this, "a11y-consumers-changed"); + Services.prefs.removeObserver(PREF_ACCESSIBILITY_FORCE_DISABLED, this); + } + Actor.prototype.destroy.call(this); - this.walker.destroy(); this.walker = null; this.tabActor = null; + resolver(); } }); diff --git a/devtools/server/actors/moz.build b/devtools/server/actors/moz.build index 33873e8370dd..1200b2870071 100644 --- a/devtools/server/actors/moz.build +++ b/devtools/server/actors/moz.build @@ -13,6 +13,7 @@ DIRS += [ ] DevToolsModules( + 'accessibility-parent.js', 'accessibility.js', 'actor-registry.js', 'addon.js', diff --git a/devtools/server/tests/browser/browser.ini b/devtools/server/tests/browser/browser.ini index 03c68eee699d..03e1daecdd3e 100644 --- a/devtools/server/tests/browser/browser.ini +++ b/devtools/server/tests/browser/browser.ini @@ -27,8 +27,8 @@ support-files = !/devtools/server/tests/mochitest/hello-actor.js !/devtools/client/framework/test/shared-head.js -[browser_accessibility_node_events.js] [browser_accessibility_node.js] +[browser_accessibility_node_events.js] [browser_accessibility_simple.js] [browser_accessibility_walker.js] [browser_animation_emitMutations.js] diff --git a/devtools/server/tests/browser/browser_accessibility_node.js b/devtools/server/tests/browser/browser_accessibility_node.js index 33b8c7a18850..b180a2de4732 100644 --- a/devtools/server/tests/browser/browser_accessibility_node.js +++ b/devtools/server/tests/browser/browser_accessibility_node.js @@ -10,7 +10,8 @@ add_task(async function () { let {client, walker, accessibility} = await initAccessibilityFrontForUrl(MAIN_DOMAIN + "doc_accessibility.html"); - let a11yWalker = await accessibility.getWalker(walker); + let a11yWalker = await accessibility.getWalker(); + await accessibility.enable(); let buttonNode = await walker.querySelector(walker.rootNode, "#button"); let accessibleFront = await a11yWalker.getAccessibleFor(buttonNode); @@ -22,38 +23,23 @@ add_task(async function () { help: "", keyboardShortcut: "", childCount: 1, - domNodeType: 1 + domNodeType: 1, + indexInParent: 1, + states: ["focusable", "selectable text", "opaque", "enabled", "sensitive"], + actions: [ "Press" ], + attributes: { + "margin-top": "0px", + display: "inline-block", + "text-align": "center", + "text-indent": "0px", + "margin-left": "0px", + tag: "button", + "margin-right": "0px", + id: "button", + "margin-bottom": "0px" + } }); - info("Actions"); - let actions = await accessibleFront.getActions(); - is(actions.length, 1, "Accessible Front has correct number of actions"); - is(actions[0], "Press", "Accessible Front default action is correct"); - - info("Index in parent"); - let index = await accessibleFront.getIndexInParent(); - is(index, 1, "Accessible Front has correct index in parent"); - - info("State"); - let state = await accessibleFront.getState(); - SimpleTest.isDeeply(state, - ["focusable", "selectable text", "opaque", "enabled", "sensitive"], - "Accessible Front has correct states"); - - info("Attributes"); - let attributes = await accessibleFront.getAttributes(); - SimpleTest.isDeeply(attributes, { - "margin-top": "0px", - display: "inline-block", - "text-align": "center", - "text-indent": "0px", - "margin-left": "0px", - tag: "button", - "margin-right": "0px", - id: "button", - "margin-bottom": "0px" - }, "Accessible Front has correct attributes"); - info("Children"); let children = await accessibleFront.children(); is(children.length, 1, "Accessible Front has correct number of children"); @@ -62,13 +48,8 @@ add_task(async function () { role: "text leaf" }); - info("DOM Node"); - let node = await accessibleFront.getDOMNode(walker); - is(node, buttonNode, "Accessible Front has correct DOM node"); - - let a11yShutdown = waitForA11yShutdown(); + await accessibility.disable(); + await waitForA11yShutdown(); await client.close(); - forceCollections(); - await a11yShutdown; gBrowser.removeCurrentTab(); }); diff --git a/devtools/server/tests/browser/browser_accessibility_node_events.js b/devtools/server/tests/browser/browser_accessibility_node_events.js index 23774bd00aca..cd1e13b96654 100644 --- a/devtools/server/tests/browser/browser_accessibility_node_events.js +++ b/devtools/server/tests/browser/browser_accessibility_node_events.js @@ -10,8 +10,10 @@ add_task(async function () { let {client, walker, accessibility} = await initAccessibilityFrontForUrl(MAIN_DOMAIN + "doc_accessibility.html"); - let a11yWalker = await accessibility.getWalker(walker); - let a11yDoc = await a11yWalker.getDocument(); + let a11yWalker = await accessibility.getWalker(); + await accessibility.enable(); + let rootNode = await walker.getRootNode(); + let a11yDoc = await a11yWalker.getAccessibleFor(rootNode); let buttonNode = await walker.querySelector(walker.rootNode, "#button"); let accessibleFront = await a11yWalker.getAccessibleFor(buttonNode); let sliderNode = await walker.querySelector(walker.rootNode, "#slider"); @@ -26,7 +28,21 @@ add_task(async function () { help: "", keyboardShortcut: "", childCount: 1, - domNodeType: 1 + domNodeType: 1, + indexInParent: 1, + states: ["focusable", "selectable text", "opaque", "enabled", "sensitive"], + actions: [ "Press" ], + attributes: { + "margin-top": "0px", + display: "inline-block", + "text-align": "center", + "text-indent": "0px", + "margin-left": "0px", + tag: "button", + "margin-right": "0px", + id: "button", + "margin-bottom": "0px" + } }); info("Name change event"); @@ -45,27 +61,35 @@ add_task(async function () { content.document.getElementById("button").removeAttribute("aria-describedby"))); info("State change event"); - let states = await accessibleFront.getState(); let expectedStates = ["unavailable", "selectable text", "opaque"]; - SimpleTest.isDeeply(states, ["focusable", "selectable text", "opaque", - "enabled", "sensitive"], "States are correct"); - await emitA11yEvent(accessibleFront, "state-change", - newStates => SimpleTest.isDeeply(newStates, expectedStates, - "States are updated"), - () => ContentTask.spawn(browser, null, () => + await emitA11yEvent(accessibleFront, "states-change", + newStates => { + checkA11yFront(accessibleFront, { states: expectedStates }); + SimpleTest.isDeeply(newStates, expectedStates, "States are updated"); + }, () => ContentTask.spawn(browser, null, () => content.document.getElementById("button").setAttribute("disabled", true))); - states = await accessibleFront.getState(); - SimpleTest.isDeeply(states, expectedStates, "States are updated"); info("Attributes change event"); - let attrs = await accessibleFront.getAttributes(); - ok(!attrs.live, "Attribute is not present"); await emitA11yEvent(accessibleFront, "attributes-change", - newAttrs => is(newAttrs.live, "polite", "Attributes are updated"), - () => ContentTask.spawn(browser, null, () => + newAttrs => { + checkA11yFront(accessibleFront, { attributes: { + "container-live": "polite", + display: "inline-block", + "event-from-input": "false", + "explicit-name": "true", + id: "button", + live: "polite", + "margin-bottom": "0px", + "margin-left": "0px", + "margin-right": "0px", + "margin-top": "0px", + tag: "button", + "text-align": "center", + "text-indent": "0px" + }}); + is(newAttrs.live, "polite", "Attributes are updated"); + }, () => ContentTask.spawn(browser, null, () => content.document.getElementById("button").setAttribute("aria-live", "polite"))); - attrs = await accessibleFront.getAttributes(); - is(attrs.live, "polite", "Attributes are updated"); info("Value change event"); checkA11yFront(accessibleSliderFront, { value: "5" }); @@ -76,18 +100,29 @@ add_task(async function () { info("Reorder event"); is(accessibleSliderFront.childCount, 1, "Slider has only 1 child"); + let [firstChild, ] = await accessibleSliderFront.children(); + is(firstChild.indexInParent, 0, "Slider's first child has correct index in parent"); await emitA11yEvent(accessibleSliderFront, "reorder", - childCount => is(childCount, 2, "Child count is updated"), - () => ContentTask.spawn(browser, null, () => { - let button = content.document.createElement("button"); + childCount => { + is(childCount, 2, "Child count is updated"); + is(accessibleSliderFront.childCount, 2, "Child count is updated"); + is(firstChild.indexInParent, 1, + "Slider's first child has an updated index in parent"); + }, () => ContentTask.spawn(browser, null, () => { + let doc = content.document; + let slider = doc.getElementById("slider"); + let button = doc.createElement("button"); button.innerText = "Slider button"; - content.document.getElementById("slider").appendChild(button); + content.document.getElementById("slider").insertBefore(button, slider.firstChild); })); - is(accessibleSliderFront.childCount, 2, "Child count is updated"); - let a11yShutdown = waitForA11yShutdown(); + await emitA11yEvent(firstChild, "index-in-parent-change", indexInParent => + is(indexInParent, 0, "Slider's first child has an updated index in parent"), () => + ContentTask.spawn(browser, null, () => + content.document.getElementById("slider").firstChild.remove())); + + await accessibility.disable(); + await waitForA11yShutdown(); await client.close(); - forceCollections(); - await a11yShutdown; gBrowser.removeCurrentTab(); }); diff --git a/devtools/server/tests/browser/browser_accessibility_simple.js b/devtools/server/tests/browser/browser_accessibility_simple.js index 3f28331bb220..04434e261bae 100644 --- a/devtools/server/tests/browser/browser_accessibility_simple.js +++ b/devtools/server/tests/browser/browser_accessibility_simple.js @@ -4,10 +4,19 @@ "use strict"; +const PREF_ACCESSIBILITY_FORCE_DISABLED = "accessibility.force_disabled"; + +function checkAccessibilityState(accessibility, expected) { + let { enabled, canBeDisabled, canBeEnabled } = accessibility; + is(enabled, expected.enabled, "Enabled state is correct."); + is(canBeDisabled, expected.canBeDisabled, "canBeDisabled state is correct."); + is(canBeEnabled, expected.canBeEnabled, "canBeEnabled state is correct."); +} + // Simple checks for the AccessibilityActor and AccessibleWalkerActor add_task(async function () { - let {client, accessibility} = await initAccessibilityFrontForUrl( + let { walker: domWalker, client, accessibility} = await initAccessibilityFrontForUrl( "data:text/html;charset=utf-8,test
"); ok(accessibility, "The AccessibilityFront was created"); @@ -16,6 +25,44 @@ add_task(async function () { let a11yWalker = await accessibility.getWalker(); ok(a11yWalker, "The AccessibleWalkerFront was returned"); + checkAccessibilityState(accessibility, + { enabled: false, canBeDisabled: true, canBeEnabled: true }); + + info("Force disable accessibility service: updates canBeEnabled flag"); + let onEvent = accessibility.once("can-be-enabled-change"); + Services.prefs.setIntPref(PREF_ACCESSIBILITY_FORCE_DISABLED, 1); + await onEvent; + checkAccessibilityState(accessibility, + { enabled: false, canBeDisabled: true, canBeEnabled: false }); + + info("Clear force disable accessibility service: updates canBeEnabled flag"); + onEvent = accessibility.once("can-be-enabled-change"); + Services.prefs.clearUserPref(PREF_ACCESSIBILITY_FORCE_DISABLED); + await onEvent; + checkAccessibilityState(accessibility, + { enabled: false, canBeDisabled: true, canBeEnabled: true }); + + info("Initialize accessibility service"); + let initEvent = accessibility.once("init"); + await accessibility.enable(); + await waitForA11yInit(); + await initEvent; + checkAccessibilityState(accessibility, + { enabled: true, canBeDisabled: true, canBeEnabled: true }); + + a11yWalker = await accessibility.getWalker(); + let rootNode = await domWalker.getRootNode(); + let a11yDoc = await a11yWalker.getAccessibleFor(rootNode); + ok(a11yDoc, "Accessible document actor is created"); + + info("Shutdown accessibility service"); + let shutdownEvent = accessibility.once("shutdown"); + await accessibility.disable(); + await waitForA11yShutdown(); + await shutdownEvent; + checkAccessibilityState(accessibility, + { enabled: false, canBeDisabled: true, canBeEnabled: true }); + await client.close(); gBrowser.removeCurrentTab(); }); diff --git a/devtools/server/tests/browser/browser_accessibility_walker.js b/devtools/server/tests/browser/browser_accessibility_walker.js index 06094b0ee87e..084985b6cc2b 100644 --- a/devtools/server/tests/browser/browser_accessibility_walker.js +++ b/devtools/server/tests/browser/browser_accessibility_walker.js @@ -10,10 +10,12 @@ add_task(async function () { let {client, walker, accessibility} = await initAccessibilityFrontForUrl(MAIN_DOMAIN + "doc_accessibility.html"); - let a11yWalker = await accessibility.getWalker(walker); + let a11yWalker = await accessibility.getWalker(); ok(a11yWalker, "The AccessibleWalkerFront was returned"); - let a11yDoc = await a11yWalker.getDocument(); + await accessibility.enable(); + let rootNode = await walker.getRootNode(); + let a11yDoc = await a11yWalker.getAccessibleFor(rootNode); ok(a11yDoc, "The AccessibleFront for root doc is created"); let children = await a11yWalker.children(); @@ -30,6 +32,15 @@ add_task(async function () { role: "pushbutton" }); + let ancestry = await a11yWalker.getAncestry(accessibleFront); + is(ancestry.length, 1, "Button is a direct child of a root document."); + is(ancestry[0].accessible, a11yDoc, + "Button's only ancestor is a root document"); + is(ancestry[0].children.length, 3, + "Root doc should have correct number of children"); + ok(ancestry[0].children.includes(accessibleFront), + "Button accessible front is in root doc's children"); + let browser = gBrowser.selectedBrowser; // Ensure name-change event is emitted by walker when cached accessible's name @@ -67,9 +78,55 @@ add_task(async function () { () => ContentTask.spawn(browser, null, () => content.document.getElementById("button").remove())); - let a11yShutdown = waitForA11yShutdown(); + let shown = await a11yWalker.highlightAccessible(docChildren[0]); + ok(shown, "AccessibleHighlighter highlighted the node"); + + shown = await a11yWalker.highlightAccessible(a11yDoc); + ok(!shown, "AccessibleHighlighter does not highlight an accessible with no bounds"); + await a11yWalker.unhighlight(); + + info("Checking AccessibleWalker picker functionality"); + ok(a11yWalker.pick, "AccessibleWalker pick method exists"); + ok(a11yWalker.pickAndFocus, "AccessibleWalker pickAndFocus method exists"); + ok(a11yWalker.cancelPick, "AccessibleWalker cancelPick method exists"); + + let onPickerEvent = a11yWalker.once("picker-accessible-hovered"); + await a11yWalker.pick(); + await BrowserTestUtils.synthesizeMouseAtCenter("#h1", { type: "mousemove" }, browser); + let acc = await onPickerEvent; + checkA11yFront(acc, { name: "Accessibility Test" }, docChildren[0]); + + onPickerEvent = a11yWalker.once("picker-accessible-previewed"); + await BrowserTestUtils.synthesizeMouseAtCenter("#h1", { shiftKey: true }, browser); + acc = await onPickerEvent; + checkA11yFront(acc, { name: "Accessibility Test" }, docChildren[0]); + + onPickerEvent = a11yWalker.once("picker-accessible-canceled"); + await BrowserTestUtils.synthesizeKey("VK_ESCAPE", { type: "keydown" }, browser); + await onPickerEvent; + + onPickerEvent = a11yWalker.once("picker-accessible-hovered"); + await a11yWalker.pick(); + await BrowserTestUtils.synthesizeMouseAtCenter("#h1", { type: "mousemove" }, browser); + await onPickerEvent; + + onPickerEvent = a11yWalker.once("picker-accessible-picked"); + await BrowserTestUtils.synthesizeMouseAtCenter("#h1", { }, browser); + acc = await onPickerEvent; + checkA11yFront(acc, { name: "Accessibility Test" }, docChildren[0]); + + await a11yWalker.cancelPick(); + + info("Checking document-ready event fired by walker when top level accessible " + + "document is recreated."); + let reloaded = BrowserTestUtils.browserLoaded(browser); + let documentReady = a11yWalker.once("document-ready"); + browser.reload(); + await reloaded; + await documentReady; + + await accessibility.disable(); + await waitForA11yShutdown(); await client.close(); - forceCollections(); - await a11yShutdown; gBrowser.removeCurrentTab(); }); diff --git a/devtools/server/tests/browser/head.js b/devtools/server/tests/browser/head.js index 51e0ffa4d9fb..f312dc6b431c 100644 --- a/devtools/server/tests/browser/head.js +++ b/devtools/server/tests/browser/head.js @@ -89,6 +89,8 @@ async function initAccessibilityFrontForUrl(url) { let walker = await inspector.getWalker(); let accessibility = AccessibilityFront(client, form); + await accessibility.bootstrap(); + return {inspector, walker, accessibility, client}; } @@ -308,24 +310,47 @@ function checkA11yFront(front, expected, expectedFront) { } for (let key in expected) { - is(front[key], expected[key], `accessibility front has correct ${key}`); + if (["actions", "states", "attributes"].includes(key)) { + SimpleTest.isDeeply(front[key], expected[key], + `Accessible Front has correct ${key}`); + } else { + is(front[key], expected[key], `accessibility front has correct ${key}`); + } } } +function getA11yInitOrShutdownPromise() { + return new Promise(resolve => { + let observe = (subject, topic, data) => { + Services.obs.removeObserver(observe, "a11y-init-or-shutdown"); + resolve(data); + }; + Services.obs.addObserver(observe, "a11y-init-or-shutdown"); + }); +} + /** * Wait for accessibility service to shut down. We consider it shut down when * an "a11y-init-or-shutdown" event is received with a value of "0". */ async function waitForA11yShutdown() { - await ContentTask.spawn(gBrowser.selectedBrowser, {}, () => - new Promise(resolve => { - let observe = (subject, topic, data) => { - Services.obs.removeObserver(observe, "a11y-init-or-shutdown"); + if (!Services.appinfo.accessibilityEnabled) { + return; + } - if (data === "0") { - resolve(); - } - }; - Services.obs.addObserver(observe, "a11y-init-or-shutdown"); - })); + await getA11yInitOrShutdownPromise().then(data => + data === "0" ? Promise.resolve() : Promise.reject()); +} + +/** + * Wait for accessibility service to initialize. We consider it initialized when + * an "a11y-init-or-shutdown" event is received with a value of "1". + */ +async function waitForA11yInit() { + if (Services.appinfo.accessibilityEnabled) { + return; + } + + await getA11yInitOrShutdownPromise().then(data => + data === "1" ? Promise.resolve() : Promise.reject()); } diff --git a/devtools/shared/fronts/accessibility.js b/devtools/shared/fronts/accessibility.js index 8497ea11af6c..f951c09a5a90 100644 --- a/devtools/shared/fronts/accessibility.js +++ b/devtools/shared/fronts/accessibility.js @@ -3,50 +3,74 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; -const DevToolsUtils = require("devtools/shared/DevToolsUtils"); const { + custom, Front, FrontClassWithSpec, - preEvent, - types + preEvent } = require("devtools/shared/protocol.js"); const { accessibleSpec, accessibleWalkerSpec, accessibilitySpec } = require("devtools/shared/specs/accessibility"); - const events = require("devtools/shared/event-emitter"); -const ACCESSIBLE_PROPERTIES = [ - "role", - "name", - "value", - "description", - "help", - "keyboardShortcut", - "childCount", - "domNodeType" -]; const AccessibleFront = FrontClassWithSpec(accessibleSpec, { initialize(client, form) { Front.prototype.initialize.call(this, client, form); - - // Define getters for accesible properties that are received from the actor. - // Note: we would like accessible properties to be iterable for a11y - // clients. - for (let key of ACCESSIBLE_PROPERTIES) { - Object.defineProperty(this, key, { - get() { - return this._form[key]; - }, - enumerable: true - }); - } }, marshallPool() { - return this.walker; + return this.parent(); + }, + + get role() { + return this._form.role; + }, + + get name() { + return this._form.name; + }, + + get value() { + return this._form.value; + }, + + get description() { + return this._form.description; + }, + + get help() { + return this._form.help; + }, + + get keyboardShortcut() { + return this._form.keyboardShortcut; + }, + + get childCount() { + return this._form.childCount; + }, + + get domNodeType() { + return this._form.domNodeType; + }, + + get indexInParent() { + return this._form.indexInParent; + }, + + get states() { + return this._form.states; + }, + + get actions() { + return this._form.actions; + }, + + get attributes() { + return this._form.attributes; }, form(form, detail) { @@ -57,25 +81,14 @@ const AccessibleFront = FrontClassWithSpec(accessibleSpec, { this.actorID = form.actor; this._form = form; - DevToolsUtils.defineLazyGetter(this, "walker", () => - types.getType("accessiblewalker").read(this._form.walker, this)); }, - /** - * Get a dom node front from accessible actor's raw accessible object's - * DONNode property. - */ - getDOMNode(domWalker) { - return domWalker.getNodeFromActor(this.actorID, - ["rawAccessible", "DOMNode"]); - }, - - nameChange: preEvent("name-change", function (name, parent) { + nameChange: preEvent("name-change", function (name, parent, walker) { this._form.name = name; // Name change event affects the tree rendering, we fire this event on // accessibility walker as the point of interaction for UI. - if (this.walker) { - events.emit(this.walker, "name-change", this, parent); + if (walker) { + events.emit(walker, "name-change", this, parent); } }), @@ -95,21 +108,37 @@ const AccessibleFront = FrontClassWithSpec(accessibleSpec, { this._form.keyboardShortcut = keyboardShortcut; }), - reorder: preEvent("reorder", function (childCount) { + reorder: preEvent("reorder", function (childCount, walker) { this._form.childCount = childCount; // Reorder event affects the tree rendering, we fire this event on // accessibility walker as the point of interaction for UI. - if (this.walker) { - events.emit(this.walker, "reorder", this); + if (walker) { + events.emit(walker, "reorder", this); } }), - textChange: preEvent("text-change", function () { + textChange: preEvent("text-change", function (walker) { // Text event affects the tree rendering, we fire this event on // accessibility walker as the point of interaction for UI. - if (this.walker) { - events.emit(this.walker, "text-change", this); + if (walker) { + events.emit(walker, "text-change", this); } + }), + + indexInParentChange: preEvent("index-in-parent-change", function (indexInParent) { + this._form.indexInParent = indexInParent; + }), + + statesChange: preEvent("states-change", function (states) { + this._form.states = states; + }), + + actionsChange: preEvent("actions-change", function (actions) { + this._form.actions = actions; + }), + + attributesChange: preEvent("attributes-change", function (attributes) { + this._form.attributes = attributes; }) }); @@ -120,7 +149,17 @@ const AccessibleWalkerFront = FrontClassWithSpec(accessibleWalkerSpec, { form(json) { this.actorID = json.actor; - } + }, + + pick: custom(function (doFocus) { + if (doFocus) { + return this.pickAndFocus(); + } + + return this._pick(); + }, { + impl: "_pick" + }) }); const AccessibilityFront = FrontClassWithSpec(accessibilitySpec, { @@ -128,7 +167,33 @@ const AccessibilityFront = FrontClassWithSpec(accessibilitySpec, { Front.prototype.initialize.call(this, client, form); this.actorID = form.accessibilityActor; this.manage(this); - } + }, + + bootstrap: custom(function () { + return this._bootstrap().then(state => { + this.enabled = state.enabled; + this.canBeEnabled = state.canBeEnabled; + this.canBeDisabled = state.canBeDisabled; + }); + }, { + impl: "_bootstrap" + }), + + init: preEvent("init", function () { + this.enabled = true; + }), + + shutdown: preEvent("shutdown", function () { + this.enabled = false; + }), + + canBeEnabled: preEvent("can-be-enabled-change", function (canBeEnabled) { + this.canBeEnabled = canBeEnabled; + }), + + canBeDisabled: preEvent("can-be-disabled-change", function (canBeDisabled) { + this.canBeDisabled = canBeDisabled; + }) }); exports.AccessibleFront = AccessibleFront; diff --git a/devtools/shared/specs/accessibility.js b/devtools/shared/specs/accessibility.js index 0d66af83aee3..f65240f746e1 100644 --- a/devtools/shared/specs/accessibility.js +++ b/devtools/shared/specs/accessibility.js @@ -9,6 +9,17 @@ const { Arg, generateActorSpec, RetVal, types } = protocol; types.addActorType("accessible"); +/** + * Accessible with children listed in the ancestry structure calculated by the + * walker. + */ +types.addDictType("accessibleWithChildren", { + // Accessible + accessible: "accessible", + // Accessible's children + children: "array:accessible" +}); + const accessibleSpec = generateActorSpec({ typeName: "accessible", @@ -20,7 +31,8 @@ const accessibleSpec = generateActorSpec({ "name-change": { type: "nameChange", name: Arg(0, "string"), - parent: Arg(1, "nullable:accessible") + parent: Arg(1, "nullable:accessible"), + walker: Arg(2, "nullable:accessiblewalker") }, "value-change": { type: "valueChange", @@ -30,13 +42,13 @@ const accessibleSpec = generateActorSpec({ type: "descriptionChange", description: Arg(0, "string") }, - "state-change": { - type: "stateChange", + "states-change": { + type: "statesChange", states: Arg(0, "array:string") }, "attributes-change": { type: "attributesChange", - states: Arg(0, "json") + attributes: Arg(0, "json") }, "help-change": { type: "helpChange", @@ -48,38 +60,20 @@ const accessibleSpec = generateActorSpec({ }, "reorder": { type: "reorder", - childCount: Arg(0, "number") + childCount: Arg(0, "number"), + walker: Arg(1, "nullable:accessiblewalker") }, "text-change": { - type: "textChange" + type: "textChange", + walker: Arg(0, "nullable:accessiblewalker") + }, + "index-in-parent-change": { + type: "indexInParentChange", + indexInParent: Arg(0, "number") } }, methods: { - getActions: { - request: {}, - response: { - actions: RetVal("array:string") - } - }, - getIndexInParent: { - request: {}, - response: { - indexInParent: RetVal("number") - } - }, - getState: { - request: {}, - response: { - states: RetVal("array:string") - } - }, - getAttributes: { - request: {}, - response: { - attributes: RetVal("json") - } - }, children: { request: {}, response: { @@ -96,6 +90,24 @@ const accessibleWalkerSpec = generateActorSpec({ "accessible-destroy": { type: "accessibleDestroy", accessible: Arg(0, "accessible") + }, + "document-ready": { + type: "documentReady", + }, + "picker-accessible-picked": { + type: "pickerAccessiblePicked", + accessible: Arg(0, "nullable:accessible") + }, + "picker-accessible-previewed": { + type: "pickerAccessiblePreviewed", + accessible: Arg(0, "nullable:accessible") + }, + "picker-accessible-hovered": { + type: "pickerAccessibleHovered", + accessible: Arg(0, "nullable:accessible") + }, + "picker-accessible-canceled": { + type: "pickerAccessibleCanceled" } }, @@ -106,30 +118,76 @@ const accessibleWalkerSpec = generateActorSpec({ children: RetVal("array:accessible") } }, - getDocument: { - request: {}, - response: { - document: RetVal("accessible") - } - }, getAccessibleFor: { request: { node: Arg(0, "domnode") }, response: { accessible: RetVal("accessible") } - } + }, + getAncestry: { + request: { accessible: Arg(0, "accessible") }, + response: { + ancestry: RetVal("array:accessibleWithChildren") + } + }, + highlightAccessible: { + request: { + accessible: Arg(0, "accessible"), + options: Arg(1, "nullable:json") + }, + response: { + value: RetVal("nullable:boolean") + } + }, + unhighlight: { + request: {} + }, + pick: {}, + pickAndFocus: {}, + cancelPick: {} } }); const accessibilitySpec = generateActorSpec({ typeName: "accessibility", + events: { + "init": { + type: "init" + }, + "shutdown": { + type: "shutdown" + }, + "can-be-disabled-change": { + type: "canBeDisabledChange", + canBeDisabled: Arg(0, "boolean") + }, + "can-be-enabled-change": { + type: "canBeEnabledChange", + canBeEnabled: Arg(0, "boolean") + } + }, + methods: { + bootstrap: { + request: {}, + response: { + state: RetVal("json") + } + }, getWalker: { request: {}, response: { walker: RetVal("accessiblewalker") } + }, + enable: { + request: {}, + response: {} + }, + disable: { + request: {}, + response: {} } } }); From 084a9fc1fe91b7823247114c263bc404f0cc142a Mon Sep 17 00:00:00 2001 From: Johan Lorenzo Date: Mon, 26 Feb 2018 15:14:46 +0100 Subject: [PATCH 15/67] Bug 1433459 - part 1: Move bouncer submission tasks to scriptworker r=mtabara,rail MozReview-Commit-ID: 6SKhjf1ywoH --HG-- extra : rebase_source : dc2206f232f3552f3871972abc8c1f2db3beb56a --- taskcluster/ci/release-bouncer-sub/kind.yml | 55 ++-- .../transforms/bouncer_submission.py | 253 ++++++++++++++++++ taskcluster/taskgraph/transforms/l10n.py | 8 +- taskcluster/taskgraph/transforms/task.py | 15 +- 4 files changed, 307 insertions(+), 24 deletions(-) create mode 100644 taskcluster/taskgraph/transforms/bouncer_submission.py diff --git a/taskcluster/ci/release-bouncer-sub/kind.yml b/taskcluster/ci/release-bouncer-sub/kind.yml index 26e0f6b8d93c..90bece37a12c 100644 --- a/taskcluster/ci/release-bouncer-sub/kind.yml +++ b/taskcluster/ci/release-bouncer-sub/kind.yml @@ -5,37 +5,54 @@ loader: taskgraph.loader.transform:loader transforms: - - taskgraph.transforms.job:transforms + - taskgraph.transforms.bouncer_submission:transforms - taskgraph.transforms.release_notifications:transforms - taskgraph.transforms.task:transforms job-defaults: description: release bouncer submission job - worker-type: buildbot-bridge/buildbot-bridge + worker-type: + by-project: + mozilla-central: scriptworker-prov-v1/bouncer-v1 + mozilla-beta: scriptworker-prov-v1/bouncer-v1 + mozilla-release: scriptworker-prov-v1/bouncer-v1 + default: scriptworker-prov-v1/bouncer-dev + worker: + implementation: bouncer-submission + scopes: + by-project: + mozilla-beta: + - project:releng:bouncer:action:submission + - project:releng:bouncer:server:production + mozilla-release: + - project:releng:bouncer:action:submission + - project:releng:bouncer:server:production + default: + - project:releng:bouncer:action:submission + - project:releng:bouncer:server:staging run-on-projects: [] shipping-phase: promote - run: - using: buildbot - release-promotion: true + shipping-product: firefox + locales-file: browser/locales/l10n-changesets.json jobs: + devedition: + bouncer-platforms: ['linux', 'linux64', 'osx', 'win', 'win64'] + bouncer-products: ['complete-mar', 'installer', 'installer-ssl', 'partial-mar', 'stub-installer'] + shipping-product: devedition + fennec: - name: fennec_release_bouncer_sub + bouncer-platforms: ['android', 'android-x86'] + bouncer-products: ['apk'] shipping-product: fennec - run: - product: fennec - buildername: release-{branch}-fennec_bncr_sub + locales-file: mobile/locales/l10n-changesets.json firefox: - name: firefox_release_bouncer_sub + bouncer-platforms: ['linux', 'linux64', 'osx', 'win', 'win64'] + bouncer-products: ['complete-mar', 'installer', 'installer-ssl', 'partial-mar', 'stub-installer'] shipping-product: firefox - run: - product: firefox - buildername: release-{branch}_firefox_bncr_sub - devedition: - name: devedition_release_bouncer_sub - shipping-product: devedition - run: - product: devedition - buildername: release-{branch}_devedition_bncr_sub + firefox-rc: + bouncer-platforms: ['linux', 'linux64', 'osx', 'win', 'win64'] + bouncer-products: ['partial-mar-candidates'] + shipping-product: firefox diff --git a/taskcluster/taskgraph/transforms/bouncer_submission.py b/taskcluster/taskgraph/transforms/bouncer_submission.py new file mode 100644 index 000000000000..bd37a87c0af2 --- /dev/null +++ b/taskcluster/taskgraph/transforms/bouncer_submission.py @@ -0,0 +1,253 @@ +# 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/. +""" +Add from parameters.yml into bouncer submission tasks. +""" + +from __future__ import absolute_import, print_function, unicode_literals + +import logging + +from taskgraph.transforms.base import TransformSequence +from taskgraph.transforms.l10n import parse_locales_file +from taskgraph.util.schema import resolve_keyed_by +from taskgraph.util.scriptworker import get_release_config + +logger = logging.getLogger(__name__) + + +FTP_PLATFORMS_PER_BOUNCER_PLATFORM = { + 'android': 'android-api-16', + 'android-x86': 'android-x86', + 'linux': 'linux-i686', + 'linux64': 'linux-x86_64', + 'osx': 'mac', + 'win': 'win32', + 'win64': 'win64', +} + +# :lang is interpolated by bouncer at runtime +CANDIDATES_PATH_TEMPLATE = '/{product}/candidates/{version}-candidates/build{build_number}/\ +{update_folder}{ftp_platform}/:lang/{file}' +RELEASES_PATH_TEMPLATE = '/{product}/releases/{version}/{update_folder}{ftp_platform}/:lang/{file}' + + +CONFIG_PER_BOUNCER_PRODUCT = { + 'apk': { + 'path_template': RELEASES_PATH_TEMPLATE, + 'file_names': { + 'android': 'fennec-{version}.:lang.android-arm.apk', + 'android-x86': 'fennec-{version}.:lang.android-i386.apk', + }, + }, + 'complete-mar': { + 'path_template': RELEASES_PATH_TEMPLATE, + 'file_names': { + 'default': 'firefox-{version}.complete.mar', + }, + }, + 'installer': { + 'path_template': RELEASES_PATH_TEMPLATE, + 'file_names': { + 'linux': 'firefox-{version}.tar.bz2', + 'linux64': 'firefox-{version}.tar.bz2', + 'osx': 'Firefox%20{version}.dmg', + 'win': 'Firefox%20Setup%20{version}.exe', + 'win64': 'Firefox%20Setup%20{version}.exe', + }, + }, + 'partial-mar': { + 'path_template': RELEASES_PATH_TEMPLATE, + 'file_names': { + 'default': 'firefox-{previous_version}-{version}.partial.mar', + }, + }, + 'partial-mar-candidates': { + 'path_template': CANDIDATES_PATH_TEMPLATE, + 'file_names': { + 'default': 'firefox-{previous_version}-{version}.partial.mar', + }, + }, + 'stub-installer': { + 'path_template': RELEASES_PATH_TEMPLATE, + 'file_names': { + 'win': 'Firefox%20Installer.exe', + 'win64': 'Firefox%20Installer.exe', + }, + }, +} +CONFIG_PER_BOUNCER_PRODUCT['installer-ssl'] = CONFIG_PER_BOUNCER_PRODUCT['installer'] + +transforms = TransformSequence() + + +@transforms.add +def make_task_worker(config, jobs): + for job in jobs: + resolve_keyed_by( + job, 'worker-type', item_name=job['name'], project=config.params['project'] + ) + resolve_keyed_by( + job, 'scopes', item_name=job['name'], project=config.params['project'] + ) + + # No need to filter out ja-JP-mac, we need to upload both + all_locales = list(sorted(parse_locales_file(job['locales-file']).keys())) + job['worker']['locales'] = all_locales + job['worker']['entries'] = craft_bouncer_entries(config, job) + + del job['locales-file'] + del job['bouncer-platforms'] + del job['bouncer-products'] + + if job['worker']['entries']: + # XXX Because rc jobs are defined within the same kind, we need to delete the + # firefox-rc job at this stage, if we're not building an RC. Otherwise, even if + # target_tasks.py filters out the rc job, it gets resurected by any kind that depends + # on the release-bouncer-sub one (release-notify-promote as of time of this writing). + if config.params['release_type'] == 'rc' or job['name'] != 'firefox-rc': + yield job + else: + logger.warn('No bouncer entries defined in bouncer submission task for "{}". \ +Job deleted.'.format(job['name'])) + + +def craft_bouncer_entries(config, job): + release_config = get_release_config(config) + + product = job['shipping-product'] + bouncer_platforms = job['bouncer-platforms'] + + current_version = release_config['version'] + current_build_number = release_config['build_number'] + + bouncer_products = job['bouncer-products'] + previous_versions_string = release_config.get('partial_versions', None) + if previous_versions_string: + previous_versions = previous_versions_string.split(', ') + else: + logger.warn('No partials defined! Bouncer submission task won\'t send any \ +partial-related entry for "{}"'.format(job['name'])) + bouncer_products = [ + bouncer_product + for bouncer_product in bouncer_products + if 'partial' not in bouncer_product + ] + previous_versions = [None] + + project = config.params['project'] + + return { + craft_bouncer_product_name( + product, bouncer_product, current_version, current_build_number, previous_version + ): { + 'options': { + 'add_locales': craft_add_locales(product), + 'check_uptake': craft_check_uptake(bouncer_product), + 'ssl_only': craft_ssl_only(bouncer_product, project), + }, + 'paths_per_bouncer_platform': craft_paths_per_bouncer_platform( + product, bouncer_product, bouncer_platforms, current_version, + current_build_number, previous_version + ), + } + for bouncer_product in bouncer_products + for previous_version in previous_versions + } + + +def craft_paths_per_bouncer_platform(product, bouncer_product, bouncer_platforms, current_version, + current_build_number, previous_version=None): + paths_per_bouncer_platform = {} + for bouncer_platform in bouncer_platforms: + ftp_platform = FTP_PLATFORMS_PER_BOUNCER_PLATFORM[bouncer_platform] + + file_names_per_platform = CONFIG_PER_BOUNCER_PRODUCT[bouncer_product]['file_names'] + file_name_template = file_names_per_platform.get( + bouncer_platform, file_names_per_platform.get('default', None) + ) + if not file_name_template: + # Some bouncer product like stub-installer are only meant to be on Windows. + # Thus no default value is defined there + continue + + file_name = file_name_template.format( + version=current_version, previous_version=strip_build_data(previous_version) + ) + + path_template = CONFIG_PER_BOUNCER_PRODUCT[bouncer_product]['path_template'] + file_relative_location = path_template.format( + product=product.lower(), + version=current_version, + build_number=current_build_number, + update_folder='updates/' if '-mar' in bouncer_product else '', + ftp_platform=ftp_platform, + file=file_name, + ) + + paths_per_bouncer_platform[bouncer_platform] = file_relative_location + + return paths_per_bouncer_platform + + +def craft_bouncer_product_name(product, bouncer_product, current_version, + current_build_number=None, previous_version=None): + if '-ssl' in bouncer_product: + postfix = '-SSL' + elif 'stub-' in bouncer_product: + postfix = '-stub' + elif 'complete-' in bouncer_product: + postfix = '-Complete' + elif 'partial-' in bouncer_product: + if not previous_version: + raise Exception('Partial is being processed, but no previous version defined.') + + if '-candidates' in bouncer_product: + if not current_build_number: + raise Exception('Partial in candidates directory is being processed, \ +but no current build number defined.') + + postfix = 'build{build_number}-Partial-{previous_version_with_build_number}'.format( + build_number=current_build_number, + previous_version_with_build_number=previous_version, + ) + else: + postfix = '-Partial-{previous_version}'.format( + previous_version=strip_build_data(previous_version) + ) + + elif 'sha1-' in bouncer_product: + postfix = '-sha1' + else: + postfix = '' + + return '{product}-{version}{postfix}'.format( + product=product.capitalize(), version=current_version, postfix=postfix + ) + + +def craft_check_uptake(bouncer_product): + return bouncer_product != 'complete-mar-candidates' + + +def craft_ssl_only(bouncer_product, project): + # XXX ESR is the only channel where we force serve the installer over SSL + if '-esr' in project and bouncer_product == 'installer': + return True + + return bouncer_product not in ( + 'complete-mar', + 'installer', + 'partial-mar', + 'partial-mar-candidates', + ) + + +def craft_add_locales(product): + # Do not add locales on Fennec in order to let "multi" work + return product != 'fennec' + + +def strip_build_data(version): + return version.split('build')[0] if version and 'build' in version else version diff --git a/taskcluster/taskgraph/transforms/l10n.py b/taskcluster/taskgraph/transforms/l10n.py index 8661e6c3d0e9..7e5f8318cf2c 100644 --- a/taskcluster/taskgraph/transforms/l10n.py +++ b/taskcluster/taskgraph/transforms/l10n.py @@ -163,7 +163,7 @@ l10n_description_schema = Schema({ transforms = TransformSequence() -def _parse_locales_file(locales_file, platform): +def parse_locales_file(locales_file, platform=None): """ Parse the passed locales file for a list of locales. """ locales = [] @@ -175,7 +175,7 @@ def _parse_locales_file(locales_file, platform): locales = { locale: data['revision'] for locale, data in all_locales.items() - if platform in data['platforms'] + if platform is None or platform in data['platforms'] } else: all_locales = f.read().split() @@ -299,8 +299,8 @@ def handle_keyed_by(config, jobs): def all_locales_attribute(config, jobs): for job in jobs: locales_platform = job['attributes']['build_platform'].replace("-nightly", "") - locales_with_changesets = _parse_locales_file(job["locales-file"], - platform=locales_platform) + locales_with_changesets = parse_locales_file(job["locales-file"], + platform=locales_platform) locales_with_changesets = _remove_locales(locales_with_changesets, to_remove=job['ignore-locales']) diff --git a/taskcluster/taskgraph/transforms/task.py b/taskcluster/taskgraph/transforms/task.py index 7636efecaecb..3a8e02e43f3a 100644 --- a/taskcluster/taskgraph/transforms/task.py +++ b/taskcluster/taskgraph/transforms/task.py @@ -558,10 +558,13 @@ task_description_schema = Schema({ # Paths to the artifacts to sign Required('paths'): [basestring], }], + }, { + Required('implementation'): 'bouncer-submission', + Required('locales'): [basestring], + Required('entries'): object, }, { Required('implementation'): 'push-apk-breakpoint', Required('payload'): object, - }, { Required('implementation'): 'invalid', # an invalid task is one which should never actually be created; this is used in @@ -1112,6 +1115,16 @@ def build_balrog_payload(config, task, task_def): }) +@payload_builder('bouncer-submission') +def build_bouncer_submission_payload(config, task, task_def): + worker = task['worker'] + + task_def['payload'] = { + 'locales': worker['locales'], + 'submission_entries': worker['entries'] + } + + @payload_builder('push-apk') def build_push_apk_payload(config, task, task_def): worker = task['worker'] From 03c8a9b27c44d92eb62d2bad01a5419b47b95fba Mon Sep 17 00:00:00 2001 From: Johan Lorenzo Date: Mon, 26 Feb 2018 15:21:54 +0100 Subject: [PATCH 16/67] Bug 1433459 - part 2: Move aliases tasks to scriptworker r=mtabara,rail MozReview-Commit-ID: Ld6ZQPBZYjX --HG-- extra : rebase_source : 83ce7b0d783bf90b362711958f5963c46f5bedf2 --- .../ci/release-bouncer-aliases/kind.yml | 53 +++++----- taskcluster/ci/release-bouncer-sub/kind.yml | 2 - .../taskgraph/transforms/bouncer_aliases.py | 97 +++++++++++++++++++ taskcluster/taskgraph/transforms/task.py | 12 +++ 4 files changed, 134 insertions(+), 30 deletions(-) create mode 100644 taskcluster/taskgraph/transforms/bouncer_aliases.py diff --git a/taskcluster/ci/release-bouncer-aliases/kind.yml b/taskcluster/ci/release-bouncer-aliases/kind.yml index f020e9549b9d..bab2daa737ee 100644 --- a/taskcluster/ci/release-bouncer-aliases/kind.yml +++ b/taskcluster/ci/release-bouncer-aliases/kind.yml @@ -6,7 +6,7 @@ loader: taskgraph.loader.transform:loader transforms: - taskgraph.transforms.release_deps:transforms - - taskgraph.transforms.job:transforms + - taskgraph.transforms.bouncer_aliases:transforms - taskgraph.transforms.release_notifications:transforms - taskgraph.transforms.task:transforms @@ -15,39 +15,36 @@ kind-dependencies: job-defaults: description: Update bouncer aliases job - worker-type: buildbot-bridge/buildbot-bridge + worker-type: + by-project: + mozilla-beta: scriptworker-prov-v1/bouncer-v1 + mozilla-release: scriptworker-prov-v1/bouncer-v1 + default: scriptworker-prov-v1/bouncer-dev + worker: + implementation: bouncer-aliases + scopes: + by-project: + mozilla-beta: + - project:releng:bouncer:action:submission + - project:releng:bouncer:server:production + mozilla-release: + - project:releng:bouncer:action:submission + - project:releng:bouncer:server:production + default: + - project:releng:bouncer:action:submission + - project:releng:bouncer:server:staging run-on-projects: [] shipping-phase: ship - run: - using: buildbot - release-promotion: true - worker: - properties: - tuxedo_server_url: - by-project: - mozilla-beta: https://bounceradmin.mozilla.com/api - mozilla-release: https://bounceradmin.mozilla.com/api - maple: https://admin-bouncer-releng.stage.mozaws.net/api - default: http://localhost/api jobs: + devedition: + bouncer-products: ['installer', 'installer-ssl', 'stub-installer'] + shipping-product: devedition + fennec: - name: fennec_release_bouncer_aliases + bouncer-products: ['apk'] shipping-product: fennec - run: - product: fennec - buildername: release-{branch}-fennec_bouncer_aliases firefox: - name: firefox_release_bouncer_aliases + bouncer-products: ['installer', 'installer-ssl', 'stub-installer'] shipping-product: firefox - run: - product: firefox - buildername: release-{branch}-firefox_bouncer_aliases - - devedition: - name: devedition_release_bouncer_aliases - shipping-product: devedition - run: - product: devedition - buildername: release-{branch}-devedition_bouncer_aliases diff --git a/taskcluster/ci/release-bouncer-sub/kind.yml b/taskcluster/ci/release-bouncer-sub/kind.yml index 90bece37a12c..5271ca217b8a 100644 --- a/taskcluster/ci/release-bouncer-sub/kind.yml +++ b/taskcluster/ci/release-bouncer-sub/kind.yml @@ -13,7 +13,6 @@ job-defaults: description: release bouncer submission job worker-type: by-project: - mozilla-central: scriptworker-prov-v1/bouncer-v1 mozilla-beta: scriptworker-prov-v1/bouncer-v1 mozilla-release: scriptworker-prov-v1/bouncer-v1 default: scriptworker-prov-v1/bouncer-dev @@ -32,7 +31,6 @@ job-defaults: - project:releng:bouncer:server:staging run-on-projects: [] shipping-phase: promote - shipping-product: firefox locales-file: browser/locales/l10n-changesets.json jobs: diff --git a/taskcluster/taskgraph/transforms/bouncer_aliases.py b/taskcluster/taskgraph/transforms/bouncer_aliases.py new file mode 100644 index 000000000000..286e39fc995a --- /dev/null +++ b/taskcluster/taskgraph/transforms/bouncer_aliases.py @@ -0,0 +1,97 @@ +# 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/. +""" +Add from parameters.yml into bouncer submission tasks. +""" + +from __future__ import absolute_import, print_function, unicode_literals + +import logging + +from taskgraph.transforms.base import TransformSequence +from taskgraph.transforms.bouncer_submission import craft_bouncer_product_name +from taskgraph.util.schema import resolve_keyed_by +from taskgraph.util.scriptworker import get_release_config + +logger = logging.getLogger(__name__) + +transforms = TransformSequence() + + +@transforms.add +def make_task_worker(config, jobs): + for job in jobs: + resolve_keyed_by( + job, 'worker-type', item_name=job['name'], project=config.params['project'] + ) + resolve_keyed_by( + job, 'scopes', item_name=job['name'], project=config.params['project'] + ) + + job['scopes'].append('project:releng:bouncer:action:aliases') + job['worker']['entries'] = craft_bouncer_entries(config, job) + + del job['bouncer-products'] + + if job['worker']['entries']: + yield job + else: + logger.warn('No bouncer entries defined in bouncer submission task for "{}". \ +Job deleted.'.format(job['name'])) + + +def craft_bouncer_entries(config, job): + release_config = get_release_config(config) + + product = job['shipping-product'] + release_type = config.params['release_type'] + # The release_type is defined but may point to None. + if not release_type: + release_type = '' + current_version = release_config['version'] + bouncer_products = job['bouncer-products'] + + return { + craft_bouncer_alias(product, bouncer_product, release_type): craft_bouncer_product_name( + product, bouncer_product, current_version, + ) + for bouncer_product in bouncer_products + } + + +def craft_bouncer_alias(product, bouncer_product, release_type): + return '{product}{channel}{postfix}'.format( + product=_craft_product(product), + channel=_craft_channel_string_of_alias(product, release_type), + postfix=_craft_alias_postfix(bouncer_product) + ) + + +def _craft_product(product): + # XXX devedition is provided in the channel function + return 'firefox' if product == 'devedition' else product + + +def _craft_channel_string_of_alias(product, release_type): + if product == 'devedition': + return '-devedition' + elif release_type == 'beta': + return '-beta' + elif 'esr' in release_type: + return '-esr' + + return '' + + +def _craft_alias_postfix(bouncer_product): + if 'stub' in bouncer_product: + postfix = '-stub' + elif 'installer' in bouncer_product or bouncer_product == 'apk': + postfix = '-latest' + if 'ssl' in bouncer_product: + postfix = '{}-ssl'.format(postfix) + else: + raise Exception('Unknown bouncer product "{}"'.format(bouncer_product)) + + return postfix diff --git a/taskcluster/taskgraph/transforms/task.py b/taskcluster/taskgraph/transforms/task.py index 3a8e02e43f3a..871d17960f4e 100644 --- a/taskcluster/taskgraph/transforms/task.py +++ b/taskcluster/taskgraph/transforms/task.py @@ -558,6 +558,9 @@ task_description_schema = Schema({ # Paths to the artifacts to sign Required('paths'): [basestring], }], + }, { + Required('implementation'): 'bouncer-aliases', + Required('entries'): object, }, { Required('implementation'): 'bouncer-submission', Required('locales'): [basestring], @@ -1115,6 +1118,15 @@ def build_balrog_payload(config, task, task_def): }) +@payload_builder('bouncer-aliases') +def build_bouncer_aliases_payload(config, task, task_def): + worker = task['worker'] + + task_def['payload'] = { + 'aliases_entries': worker['entries'] + } + + @payload_builder('bouncer-submission') def build_bouncer_submission_payload(config, task, task_def): worker = task['worker'] From 6a92d27239f7bd6c1b5e908f564c3b9e93816d32 Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Thu, 1 Mar 2018 07:37:31 -0800 Subject: [PATCH 17/67] Bug 1440775 Make fetch API force-cache and only-if-cached use VALIDATE_NEVER instead of LOAD_FROM_CACHE. r=mayhemer --- netwerk/protocol/http/HttpBaseChannel.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/netwerk/protocol/http/HttpBaseChannel.cpp b/netwerk/protocol/http/HttpBaseChannel.cpp index 3675394934ec..946f3f00b925 100644 --- a/netwerk/protocol/http/HttpBaseChannel.cpp +++ b/netwerk/protocol/http/HttpBaseChannel.cpp @@ -2855,10 +2855,10 @@ HttpBaseChannel::GetFetchCacheMode(uint32_t* aFetchCacheMode) *aFetchCacheMode = nsIHttpChannelInternal::FETCH_CACHE_MODE_RELOAD; } else if (ContainsAllFlags(mLoadFlags, VALIDATE_ALWAYS)) { *aFetchCacheMode = nsIHttpChannelInternal::FETCH_CACHE_MODE_NO_CACHE; - } else if (ContainsAllFlags(mLoadFlags, LOAD_FROM_CACHE | + } else if (ContainsAllFlags(mLoadFlags, VALIDATE_NEVER | nsICachingChannel::LOAD_ONLY_FROM_CACHE)) { *aFetchCacheMode = nsIHttpChannelInternal::FETCH_CACHE_MODE_ONLY_IF_CACHED; - } else if (ContainsAllFlags(mLoadFlags, LOAD_FROM_CACHE)) { + } else if (ContainsAllFlags(mLoadFlags, VALIDATE_NEVER)) { *aFetchCacheMode = nsIHttpChannelInternal::FETCH_CACHE_MODE_FORCE_CACHE; } else { *aFetchCacheMode = nsIHttpChannelInternal::FETCH_CACHE_MODE_DEFAULT; @@ -2915,7 +2915,7 @@ HttpBaseChannel::SetFetchCacheMode(uint32_t aFetchCacheMode) break; case nsIHttpChannelInternal::FETCH_CACHE_MODE_FORCE_CACHE: // force-cache means don't validate unless if the response would vary. - SetCacheFlags(mLoadFlags, LOAD_FROM_CACHE); + SetCacheFlags(mLoadFlags, VALIDATE_NEVER); break; case nsIHttpChannelInternal::FETCH_CACHE_MODE_ONLY_IF_CACHED: // only-if-cached means only from cache, no network, no validation, generate @@ -2924,7 +2924,7 @@ HttpBaseChannel::SetFetchCacheMode(uint32_t aFetchCacheMode) // the user has things in their cache without any network traffic side // effects) are addressed in the Request constructor which enforces/requires // same-origin request mode. - SetCacheFlags(mLoadFlags, LOAD_FROM_CACHE | + SetCacheFlags(mLoadFlags, VALIDATE_NEVER | nsICachingChannel::LOAD_ONLY_FROM_CACHE); break; } From e35979f1902ef435fd33e60143a1f093dcce75b6 Mon Sep 17 00:00:00 2001 From: Yura Zenevich Date: Thu, 1 Mar 2018 10:33:33 -0500 Subject: [PATCH 18/67] Bug 1428430 - Fix for ESLint faiure in devtools/server/actors/accessibility.js. MozReview-Commit-ID: 3PPmOMsQAr0 --- devtools/server/actors/accessibility.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devtools/server/actors/accessibility.js b/devtools/server/actors/accessibility.js index 91e92421d7c3..6a7a13676093 100644 --- a/devtools/server/actors/accessibility.js +++ b/devtools/server/actors/accessibility.js @@ -4,7 +4,7 @@ "use strict"; -const { Cc, Ci, Cu } = require("chrome"); +const { Cc, Ci } = require("chrome"); const DevToolsUtils = require("devtools/shared/DevToolsUtils"); const { DebuggerServer } = require("devtools/server/main"); const Services = require("Services"); From b6d8b1c81a4172a5cd4a28ce48b6929dc057dc3a Mon Sep 17 00:00:00 2001 From: Yura Zenevich Date: Fri, 23 Feb 2018 14:41:19 -0500 Subject: [PATCH 19/67] Bug 1438837 - fix VirtualizedTree node aria-level attribute to start with 1 not 0. r=nchevobbe MozReview-Commit-ID: KLb964Irdkd --- devtools/client/shared/components/VirtualizedTree.js | 2 +- devtools/client/shared/components/test/mochitest/head.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/devtools/client/shared/components/VirtualizedTree.js b/devtools/client/shared/components/VirtualizedTree.js index 14468ea3f167..f12a877d75b1 100644 --- a/devtools/client/shared/components/VirtualizedTree.js +++ b/devtools/client/shared/components/VirtualizedTree.js @@ -811,7 +811,7 @@ class TreeNodeClass extends Component { id: this.props.id, className: classList.join(" "), role: "treeitem", - "aria-level": this.props.depth, + "aria-level": this.props.depth + 1, onClick: this.props.onClick, "aria-expanded": ariaExpanded, "data-expanded": this.props.expanded ? "" : undefined, diff --git a/devtools/client/shared/components/test/mochitest/head.js b/devtools/client/shared/components/test/mochitest/head.js index f9d5e244930f..c756a65e615a 100644 --- a/devtools/client/shared/components/test/mochitest/head.js +++ b/devtools/client/shared/components/test/mochitest/head.js @@ -96,7 +96,9 @@ function isAccessibleTree(tree, options = {}) { for (let node of treeNodes) { ok(node.id, "TreeNode has an id"); is(node.getAttribute("role"), "treeitem", "Tree item semantics is present"); - ok(node.hasAttribute("aria-level"), "Aria level attribute is set"); + is(parseInt(node.getAttribute("aria-level"), 10), + parseInt(node.getAttribute("data-depth"), 10) + 1, + "Aria level attribute is set correctly"); } } From 464c469099fa5ee0db080a06bab6653e9ccc6f78 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Wed, 28 Feb 2018 22:02:25 +0000 Subject: [PATCH 20/67] Bug 1440938 - Fall back to cairo's glyph metrics API if FreeType fails in some way, or if we're not using a variation font. r=lsalzman --- gfx/thebes/gfxFT2FontBase.cpp | 53 +++++++++++++++++++++++------------ gfx/thebes/gfxFT2FontBase.h | 7 ++++- 2 files changed, 41 insertions(+), 19 deletions(-) diff --git a/gfx/thebes/gfxFT2FontBase.cpp b/gfx/thebes/gfxFT2FontBase.cpp index 65e43eba18f3..c226e64cdf2a 100644 --- a/gfx/thebes/gfxFT2FontBase.cpp +++ b/gfx/thebes/gfxFT2FontBase.cpp @@ -174,7 +174,13 @@ gfxFT2FontBase::GetCharWidth(char aChar, gfxFloat* aWidth) { FT_UInt gid = GetGlyph(aChar); if (gid) { - *aWidth = FLOAT_FROM_16_16(GetFTGlyphAdvance(gid)); + int32_t width; + if (!GetFTGlyphAdvance(gid, &width)) { + cairo_text_extents_t extents; + GetGlyphExtents(gid, &extents); + width = NS_lround(0x10000 * extents.x_advance); + } + *aWidth = FLOAT_FROM_16_16(width); } return gid; } @@ -526,35 +532,42 @@ gfxFT2FontBase::GetGlyph(uint32_t unicode, uint32_t variation_selector) return GetGlyph(unicode); } -FT_Fixed -gfxFT2FontBase::GetFTGlyphAdvance(uint16_t aGID) +bool +gfxFT2FontBase::GetFTGlyphAdvance(uint16_t aGID, int32_t* aAdvance) { gfxFT2LockedFace face(this); MOZ_ASSERT(face.get()); if (!face.get()) { // Failed to get the FT_Face? Give up already. - return 0; + NS_WARNING("failed to get FT_Face!"); + return false; } + + // Due to bugs like 1435234 and 1440938, we currently prefer to fall back + // to reading the advance from cairo extents, unless we're dealing with + // a variation font (for which cairo metrics may be wrong, due to FreeType + // bug 52683). + if (!(face.get()->face_flags & FT_FACE_FLAG_SCALABLE) || + !(face.get()->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS)) { + return false; + } + bool hinting = gfxPlatform::GetPlatform()->FontHintingEnabled(); int32_t flags = hinting ? FT_LOAD_ADVANCE_ONLY : FT_LOAD_ADVANCE_ONLY | FT_LOAD_NO_AUTOHINT | FT_LOAD_NO_HINTING; FT_Error ftError = FT_Load_Glyph(face.get(), aGID, flags); - MOZ_ASSERT(!ftError); if (ftError != FT_Err_Ok) { // FT_Face was somehow broken/invalid? Don't try to access glyph slot. - return 0; + // This probably shouldn't happen, but does: see bug 1440938. + NS_WARNING("failed to load glyph!"); + return false; } - FT_Fixed advance = 0; + // Due to freetype bug 52683 we MUST use the linearHoriAdvance field when - // dealing with a variation font; also use it for scalable fonts when not - // applying hinting. Otherwise, prefer hinted width from glyph->advance.x. - if ((face.get()->face_flags & FT_FACE_FLAG_SCALABLE) && - (!hinting || (face.get()->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS))) { - advance = face.get()->glyph->linearHoriAdvance; - } else { - advance = face.get()->glyph->advance.x << 10; // convert 26.6 to 16.16 - } + // dealing with a variation font. (And other fonts would have returned + // earlier, so only variation fonts currently reach here.) + FT_Fixed advance = face.get()->glyph->linearHoriAdvance; // If freetype emboldening is being used, and it's not a zero-width glyph, // adjust the advance to account for the increased width. @@ -569,9 +582,9 @@ gfxFT2FontBase::GetFTGlyphAdvance(uint16_t aGID) // Round the 16.16 fixed-point value to whole pixels for better consistency // with how cairo renders the glyphs. - advance = (advance + 0x8000) & 0xffff0000u; + *aAdvance = (advance + 0x8000) & 0xffff0000u; - return advance; + return true; } int32_t @@ -587,7 +600,11 @@ gfxFT2FontBase::GetGlyphWidth(DrawTarget& aDrawTarget, uint16_t aGID) return width; } - width = GetFTGlyphAdvance(aGID); + if (!GetFTGlyphAdvance(aGID, &width)) { + cairo_text_extents_t extents; + GetGlyphExtents(aGID, &extents); + width = NS_lround(0x10000 * extents.x_advance); + } mGlyphWidths->Put(aGID, width); return width; diff --git a/gfx/thebes/gfxFT2FontBase.h b/gfx/thebes/gfxFT2FontBase.h index 1808fb1d303d..28ba1504ed84 100644 --- a/gfx/thebes/gfxFT2FontBase.h +++ b/gfx/thebes/gfxFT2FontBase.h @@ -45,7 +45,12 @@ public: private: uint32_t GetCharExtents(char aChar, cairo_text_extents_t* aExtents); uint32_t GetCharWidth(char aChar, gfxFloat* aWidth); - FT_Fixed GetFTGlyphAdvance(uint16_t aGID); + + // Get advance of a single glyph from FreeType, and return true; + // or return false if we should fall back to getting the glyph + // extents from cairo instead. + bool GetFTGlyphAdvance(uint16_t aGID, int32_t* aWidth); + void InitMetrics(); protected: From 417ff1171068775a90162cbf06898fcb7c198c9a Mon Sep 17 00:00:00 2001 From: Hwanseung Lee Date: Tue, 27 Feb 2018 15:38:36 +0000 Subject: [PATCH 21/67] Bug 1441488 [wpt PR 9377] - [css-typed-om] ay which is 0 should omit when serialize a CSSSkew, a=testonly Automatic update from web-platform-tests when ay value is 0, second value should omit when serialized. https://drafts.css-houdini.org/css-typed-om-1/#serialize-a-cssskew Bug: 808321 Change-Id: I933a42d46b12578acf66ca2065c4761319cb086b Reviewed-on: https://chromium-review.googlesource.com/899703 Commit-Queue: Hwanseung Lee Reviewed-by: Darren Shen Cr-Commit-Position: refs/heads/master@{#534313} wpt-commits: 00b3aac863af58f655e98a5c9b26bc6790afed2b wpt-pr: 9377 reapplied-commits: 370e267e160568862f1fd9ec246ab5bb840f586e, fe4514c84e7ad28e46bad5da93381deb99b177f3, 7806af854343c043a2645a4034fdc7812f65daad, 9ddfd21554293dec5a4bf2e5375ae4f3c9f2ded0, 75f63c4d1ebc949647184fd60972fc7b9fd4affb, 1f3a5b496acd2288cc8cf0c32af86cb35157ea4e, 88b42bd5847abac58a62c4d6b33c1509bfce5f3d, 15c2e4c690700c6c115f8afe5e44ded10d943538, c8d461ef1437641ae7d4ea1d21e1e60cd62910b0, a6088a5f48ee299386a84d2f771902267d7355b1, 0634cd8f08ebe0905a9188fb1398c7b5f889c5dc, c8ee4a012dae506ae06bb5b2ad50942b04c1aaaa, c2c352456a4cf62dcc12f851138b04397675a445, b93a8879555d2fa7e7d4e00a275513a3a6338b35, b86e1331cb36634fd33677043b61fc0c1d8485bc, 44ddf14fd3346658c3223f13652073fafbfa48fa, a1a5840a6bb53e305ba02bcbeb215659342d0edb, 7465cb110ae5ec2e2ca73182caf5293f0efc8fd5, aad5349b3458bc3414e274b33fa86a1123901ff2, eca0907980d2769c449894a6277c60c1a306792f, 38626987c0cfd6e715cfcc6f4f1a1209191a03c5, e4a67f7ddcde6cd99348e9104bd7ed07074da44a, bb3c9990840a0fae2afc840b5952d7874785b112, 042d7adef0bdb9dc80e825c3997ace7519477c42, 99f1ea44fc7915b8b7b33bce4732fa8765fd3ac2 --- testing/web-platform/meta/MANIFEST.json | 20 ++++++++++++++++++- .../cssTransformValue.tentative.html | 5 +++++ .../tests/resources/testdriver-vendor.js | 1 - 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index c53d127ea10f..92b2f1af4529 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -262224,6 +262224,11 @@ {} ] ], + "css/tools/apiclient/.git": [ + [ + {} + ] + ], "css/tools/apiclient/.gitignore": [ [ {} @@ -262329,6 +262334,11 @@ {} ] ], + "css/tools/w3ctestlib/.git": [ + [ + {} + ] + ], "css/tools/w3ctestlib/.hgignore": [ [ {} @@ -514620,7 +514630,7 @@ "testharness" ], "css/css-typed-om/stylevalue-serialization/cssTransformValue.tentative.html": [ - "fdc7e5f43de941a0d79b0c4c13ae515038e028d1", + "71591a5fdc7f90841dcc204c70f1a3e611024edc", "testharness" ], "css/css-typed-om/stylevalue-serialization/cssUnitValue.tentative.html": [ @@ -528483,6 +528493,10 @@ "7301f0ec4d66b71a92818aa3d532c5eca718f677", "support" ], + "css/tools/apiclient/.git": [ + "a2b0c02018abee3ad13874cc7f9845330586121d", + "support" + ], "css/tools/apiclient/.gitignore": [ "4f8c72d787595386529108512329027d424dad47", "support" @@ -528567,6 +528581,10 @@ "715959f81edaae4a2ac5ad6a16dbb045c199074f", "support" ], + "css/tools/w3ctestlib/.git": [ + "a10ce8304adab69198559ff8548d05a7af17bc6e", + "support" + ], "css/tools/w3ctestlib/.hgignore": [ "68a4744eda8cfd5d6313a91e1468cffacf37b61f", "support" diff --git a/testing/web-platform/tests/css/css-typed-om/stylevalue-serialization/cssTransformValue.tentative.html b/testing/web-platform/tests/css/css-typed-om/stylevalue-serialization/cssTransformValue.tentative.html index 8662b4fd2afd..00d723fc6db4 100644 --- a/testing/web-platform/tests/css/css-typed-om/stylevalue-serialization/cssTransformValue.tentative.html +++ b/testing/web-platform/tests/css/css-typed-om/stylevalue-serialization/cssTransformValue.tentative.html @@ -44,6 +44,11 @@ const gTestCases = [ cssText: 'skew(90deg, 45deg)', desc: 'CSSSkew' }, + { + value: new CSSSkew(CSS.deg(90), CSS.turn(0)), + cssText: 'skew(90deg)', + desc: 'CSSSkew with Y which is 0 value' + }, { value: new CSSPerspective(CSS.px(1)), cssText: 'perspective(1px)', diff --git a/testing/web-platform/tests/resources/testdriver-vendor.js b/testing/web-platform/tests/resources/testdriver-vendor.js index 3e8840363639..e69de29bb2d1 100644 --- a/testing/web-platform/tests/resources/testdriver-vendor.js +++ b/testing/web-platform/tests/resources/testdriver-vendor.js @@ -1 +0,0 @@ -// This file intentionally left blank From 638a8d6b0c32b9dc8da885c645cc0942cd15b3f3 Mon Sep 17 00:00:00 2001 From: moz-wptsync-bot Date: Fri, 23 Feb 2018 23:18:09 +0000 Subject: [PATCH 22/67] Bug 1440796 [wpt PR 9377]- Update wpt metadata, a=testonly wpt-pr: 9377 wpt-type: metadata --- testing/web-platform/meta/cors/304.htm.ini | 1 - .../meta/css/CSS2/ui/outline-applies-to-005.xht.ini | 1 + .../meta/css/CSS2/ui/outline-applies-to-006.xht.ini | 1 + .../meta/css/CSS2/ui/outline-color-applies-to-005.xht.ini | 1 + .../meta/css/CSS2/ui/outline-color-applies-to-006.xht.ini | 1 + .../meta/css/CSS2/ui/outline-style-applies-to-005.xht.ini | 1 + .../meta/css/CSS2/ui/outline-style-applies-to-006.xht.ini | 1 + .../meta/css/CSS2/ui/outline-width-applies-to-005.xht.ini | 1 + .../meta/css/CSS2/ui/outline-width-applies-to-006.xht.ini | 1 + ...nd-mode-both-parent-and-blended-with-3D-transform.html.ini | 1 + .../css/css-masking/clip-path/clip-path-ellipse-001.html.ini | 1 + .../transform3d-backface-visibility-002.html.ini | 1 + .../transform3d-backface-visibility-005.html.ini | 1 + .../css/css-transforms/transform3d-preserve3d-006.html.ini | 1 + .../css/css-transforms/transform3d-preserve3d-007.html.ini | 1 + .../css/css-transforms/transform3d-preserve3d-008.html.ini | 1 + .../css/css-transforms/transform3d-preserve3d-009.html.ini | 1 + .../css/css-transforms/transform3d-preserve3d-011.html.ini | 1 + .../css/css-transforms/transform3d-preserve3d-013.html.ini | 1 + .../meta/css/css-transforms/transforms-skewX.html.ini | 1 + .../meta/css/css-transforms/transforms-skewY.html.ini | 1 + testing/web-platform/meta/css/css-ui/outline-013.html.ini | 1 + .../background/border-image-repeat-round-1.html.ini | 1 + .../background/border-image-repeat-round-2.html.ini | 1 + .../masking/clip-path-geometryBox-2.html.ini | 1 + .../mozilla-central-reftests/masking/mask-clip-1.html.ini | 1 + .../shapes1/shape-outside-circle-039.html.ini | 1 + .../shapes1/shape-outside-circle-040.html.ini | 1 + .../shapes1/shape-outside-circle-045.html.ini | 1 + .../shapes1/shape-outside-circle-046.html.ini | 1 + .../shapes1/shape-outside-ellipse-040.html.ini | 1 + .../shapes1/shape-outside-ellipse-041.html.ini | 1 + .../shapes1/shape-outside-ellipse-042.html.ini | 1 + .../shapes1/shape-outside-ellipse-043.html.ini | 1 + .../shapes1/shape-outside-inset-018.html.ini | 1 + .../shapes1/shape-outside-inset-019.html.ini | 1 + .../meta/fetch/api/basic/conditional-get.html.ini | 1 - .../meta/fetch/api/request/request-cache-default.html.ini | 1 - .../meta/fetch/api/request/request-cache-force-cache.html.ini | 1 - .../meta/fetch/api/request/request-cache-reload.html.ini | 1 - .../meta/html/syntax/parsing/html5lib_tests15.html.ini | 4 ---- testing/web-platform/meta/websockets/constructor/014.html.ini | 2 -- 42 files changed, 35 insertions(+), 11 deletions(-) diff --git a/testing/web-platform/meta/cors/304.htm.ini b/testing/web-platform/meta/cors/304.htm.ini index c460f632775f..6498aad1cc12 100644 --- a/testing/web-platform/meta/cors/304.htm.ini +++ b/testing/web-platform/meta/cors/304.htm.ini @@ -1,2 +1 @@ prefs: [network.http.rcwn.enabled:false] -[304.htm] diff --git a/testing/web-platform/meta/css/CSS2/ui/outline-applies-to-005.xht.ini b/testing/web-platform/meta/css/CSS2/ui/outline-applies-to-005.xht.ini index 88b07d676057..fbf9855ef3bf 100644 --- a/testing/web-platform/meta/css/CSS2/ui/outline-applies-to-005.xht.ini +++ b/testing/web-platform/meta/css/CSS2/ui/outline-applies-to-005.xht.ini @@ -1,3 +1,4 @@ [outline-applies-to-005.xht] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/CSS2/ui/outline-applies-to-006.xht.ini b/testing/web-platform/meta/css/CSS2/ui/outline-applies-to-006.xht.ini index c72ed68a622d..13f2e04a8006 100644 --- a/testing/web-platform/meta/css/CSS2/ui/outline-applies-to-006.xht.ini +++ b/testing/web-platform/meta/css/CSS2/ui/outline-applies-to-006.xht.ini @@ -1,3 +1,4 @@ [outline-applies-to-006.xht] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/CSS2/ui/outline-color-applies-to-005.xht.ini b/testing/web-platform/meta/css/CSS2/ui/outline-color-applies-to-005.xht.ini index 31142e9101c6..242e37fb18d0 100644 --- a/testing/web-platform/meta/css/CSS2/ui/outline-color-applies-to-005.xht.ini +++ b/testing/web-platform/meta/css/CSS2/ui/outline-color-applies-to-005.xht.ini @@ -1,3 +1,4 @@ [outline-color-applies-to-005.xht] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/CSS2/ui/outline-color-applies-to-006.xht.ini b/testing/web-platform/meta/css/CSS2/ui/outline-color-applies-to-006.xht.ini index bc06b5261f5c..2295a0adad83 100644 --- a/testing/web-platform/meta/css/CSS2/ui/outline-color-applies-to-006.xht.ini +++ b/testing/web-platform/meta/css/CSS2/ui/outline-color-applies-to-006.xht.ini @@ -1,3 +1,4 @@ [outline-color-applies-to-006.xht] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/CSS2/ui/outline-style-applies-to-005.xht.ini b/testing/web-platform/meta/css/CSS2/ui/outline-style-applies-to-005.xht.ini index 745e36a63dc5..6469ee16d2dd 100644 --- a/testing/web-platform/meta/css/CSS2/ui/outline-style-applies-to-005.xht.ini +++ b/testing/web-platform/meta/css/CSS2/ui/outline-style-applies-to-005.xht.ini @@ -1,3 +1,4 @@ [outline-style-applies-to-005.xht] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/CSS2/ui/outline-style-applies-to-006.xht.ini b/testing/web-platform/meta/css/CSS2/ui/outline-style-applies-to-006.xht.ini index b447904d3a09..364b3bc4c6fc 100644 --- a/testing/web-platform/meta/css/CSS2/ui/outline-style-applies-to-006.xht.ini +++ b/testing/web-platform/meta/css/CSS2/ui/outline-style-applies-to-006.xht.ini @@ -1,3 +1,4 @@ [outline-style-applies-to-006.xht] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/CSS2/ui/outline-width-applies-to-005.xht.ini b/testing/web-platform/meta/css/CSS2/ui/outline-width-applies-to-005.xht.ini index 34558d1522cb..3d2c01b15160 100644 --- a/testing/web-platform/meta/css/CSS2/ui/outline-width-applies-to-005.xht.ini +++ b/testing/web-platform/meta/css/CSS2/ui/outline-width-applies-to-005.xht.ini @@ -1,3 +1,4 @@ [outline-width-applies-to-005.xht] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/CSS2/ui/outline-width-applies-to-006.xht.ini b/testing/web-platform/meta/css/CSS2/ui/outline-width-applies-to-006.xht.ini index 6f8b516287f6..64088b5ae748 100644 --- a/testing/web-platform/meta/css/CSS2/ui/outline-width-applies-to-006.xht.ini +++ b/testing/web-platform/meta/css/CSS2/ui/outline-width-applies-to-006.xht.ini @@ -1,3 +1,4 @@ [outline-width-applies-to-006.xht] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/compositing/mix-blend-mode/mix-blend-mode-both-parent-and-blended-with-3D-transform.html.ini b/testing/web-platform/meta/css/compositing/mix-blend-mode/mix-blend-mode-both-parent-and-blended-with-3D-transform.html.ini index 749854c55641..d0eebb881693 100644 --- a/testing/web-platform/meta/css/compositing/mix-blend-mode/mix-blend-mode-both-parent-and-blended-with-3D-transform.html.ini +++ b/testing/web-platform/meta/css/compositing/mix-blend-mode/mix-blend-mode-both-parent-and-blended-with-3D-transform.html.ini @@ -1,3 +1,4 @@ [mix-blend-mode-both-parent-and-blended-with-3D-transform.html] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-001.html.ini b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-001.html.ini index 1200a5561d95..c181973e80a7 100644 --- a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-001.html.ini +++ b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-001.html.ini @@ -1,3 +1,4 @@ [clip-path-ellipse-001.html] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/css-transforms/transform3d-backface-visibility-002.html.ini b/testing/web-platform/meta/css/css-transforms/transform3d-backface-visibility-002.html.ini index bcd4ea8fc967..cb35dfd5c24c 100644 --- a/testing/web-platform/meta/css/css-transforms/transform3d-backface-visibility-002.html.ini +++ b/testing/web-platform/meta/css/css-transforms/transform3d-backface-visibility-002.html.ini @@ -1,3 +1,4 @@ [transform3d-backface-visibility-002.html] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/css-transforms/transform3d-backface-visibility-005.html.ini b/testing/web-platform/meta/css/css-transforms/transform3d-backface-visibility-005.html.ini index bbc408e3b10a..de4694f8cca1 100644 --- a/testing/web-platform/meta/css/css-transforms/transform3d-backface-visibility-005.html.ini +++ b/testing/web-platform/meta/css/css-transforms/transform3d-backface-visibility-005.html.ini @@ -1,3 +1,4 @@ [transform3d-backface-visibility-005.html] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/css-transforms/transform3d-preserve3d-006.html.ini b/testing/web-platform/meta/css/css-transforms/transform3d-preserve3d-006.html.ini index cbc73ba1c294..81b4ba6f7647 100644 --- a/testing/web-platform/meta/css/css-transforms/transform3d-preserve3d-006.html.ini +++ b/testing/web-platform/meta/css/css-transforms/transform3d-preserve3d-006.html.ini @@ -1,3 +1,4 @@ [transform3d-preserve3d-006.html] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/css-transforms/transform3d-preserve3d-007.html.ini b/testing/web-platform/meta/css/css-transforms/transform3d-preserve3d-007.html.ini index f659d640866a..ac63101f7b2e 100644 --- a/testing/web-platform/meta/css/css-transforms/transform3d-preserve3d-007.html.ini +++ b/testing/web-platform/meta/css/css-transforms/transform3d-preserve3d-007.html.ini @@ -1,3 +1,4 @@ [transform3d-preserve3d-007.html] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/css-transforms/transform3d-preserve3d-008.html.ini b/testing/web-platform/meta/css/css-transforms/transform3d-preserve3d-008.html.ini index d031b8970001..85ac3241a561 100644 --- a/testing/web-platform/meta/css/css-transforms/transform3d-preserve3d-008.html.ini +++ b/testing/web-platform/meta/css/css-transforms/transform3d-preserve3d-008.html.ini @@ -1,3 +1,4 @@ [transform3d-preserve3d-008.html] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/css-transforms/transform3d-preserve3d-009.html.ini b/testing/web-platform/meta/css/css-transforms/transform3d-preserve3d-009.html.ini index 63100fde282d..7da46bf65085 100644 --- a/testing/web-platform/meta/css/css-transforms/transform3d-preserve3d-009.html.ini +++ b/testing/web-platform/meta/css/css-transforms/transform3d-preserve3d-009.html.ini @@ -1,3 +1,4 @@ [transform3d-preserve3d-009.html] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/css-transforms/transform3d-preserve3d-011.html.ini b/testing/web-platform/meta/css/css-transforms/transform3d-preserve3d-011.html.ini index 1a3681033230..b80d08fc2e7b 100644 --- a/testing/web-platform/meta/css/css-transforms/transform3d-preserve3d-011.html.ini +++ b/testing/web-platform/meta/css/css-transforms/transform3d-preserve3d-011.html.ini @@ -1,3 +1,4 @@ [transform3d-preserve3d-011.html] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/css-transforms/transform3d-preserve3d-013.html.ini b/testing/web-platform/meta/css/css-transforms/transform3d-preserve3d-013.html.ini index f8662cfda984..3a707c20cd4c 100644 --- a/testing/web-platform/meta/css/css-transforms/transform3d-preserve3d-013.html.ini +++ b/testing/web-platform/meta/css/css-transforms/transform3d-preserve3d-013.html.ini @@ -1,3 +1,4 @@ [transform3d-preserve3d-013.html] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/css-transforms/transforms-skewX.html.ini b/testing/web-platform/meta/css/css-transforms/transforms-skewX.html.ini index 831eb56fdd40..8b76714ccfe0 100644 --- a/testing/web-platform/meta/css/css-transforms/transforms-skewX.html.ini +++ b/testing/web-platform/meta/css/css-transforms/transforms-skewX.html.ini @@ -1,3 +1,4 @@ [transforms-skewX.html] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/css-transforms/transforms-skewY.html.ini b/testing/web-platform/meta/css/css-transforms/transforms-skewY.html.ini index ecda65b2df77..93f3e2d17bbb 100644 --- a/testing/web-platform/meta/css/css-transforms/transforms-skewY.html.ini +++ b/testing/web-platform/meta/css/css-transforms/transforms-skewY.html.ini @@ -1,3 +1,4 @@ [transforms-skewY.html] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/css-ui/outline-013.html.ini b/testing/web-platform/meta/css/css-ui/outline-013.html.ini index da56966eedd5..f12e688f7c4e 100644 --- a/testing/web-platform/meta/css/css-ui/outline-013.html.ini +++ b/testing/web-platform/meta/css/css-ui/outline-013.html.ini @@ -1,3 +1,4 @@ [outline-013.html] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/background/border-image-repeat-round-1.html.ini b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/background/border-image-repeat-round-1.html.ini index 3b80ff5e9f38..83fc021dd2cc 100644 --- a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/background/border-image-repeat-round-1.html.ini +++ b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/background/border-image-repeat-round-1.html.ini @@ -1,3 +1,4 @@ [border-image-repeat-round-1.html] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/background/border-image-repeat-round-2.html.ini b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/background/border-image-repeat-round-2.html.ini index a36dae0e3889..a67dda7eff2e 100644 --- a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/background/border-image-repeat-round-2.html.ini +++ b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/background/border-image-repeat-round-2.html.ini @@ -1,3 +1,4 @@ [border-image-repeat-round-2.html] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/masking/clip-path-geometryBox-2.html.ini b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/masking/clip-path-geometryBox-2.html.ini index b4394e7b7e41..6a6bb4e0f0dc 100644 --- a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/masking/clip-path-geometryBox-2.html.ini +++ b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/masking/clip-path-geometryBox-2.html.ini @@ -1,3 +1,4 @@ [clip-path-geometryBox-2.html] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/masking/mask-clip-1.html.ini b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/masking/mask-clip-1.html.ini index 44d18e330c44..f9bfe173bad8 100644 --- a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/masking/mask-clip-1.html.ini +++ b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/masking/mask-clip-1.html.ini @@ -1,3 +1,4 @@ [mask-clip-1.html] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-039.html.ini b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-039.html.ini index 196dff9663b1..f3370d1aa413 100644 --- a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-039.html.ini +++ b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-039.html.ini @@ -1,3 +1,4 @@ [shape-outside-circle-039.html] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-040.html.ini b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-040.html.ini index d37c40fc509e..6e24ff976daf 100644 --- a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-040.html.ini +++ b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-040.html.ini @@ -1,3 +1,4 @@ [shape-outside-circle-040.html] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-045.html.ini b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-045.html.ini index dad32850858b..a1c7a022678f 100644 --- a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-045.html.ini +++ b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-045.html.ini @@ -1,3 +1,4 @@ [shape-outside-circle-045.html] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-046.html.ini b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-046.html.ini index 123523be7b6c..e346fa990872 100644 --- a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-046.html.ini +++ b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-circle-046.html.ini @@ -1,3 +1,4 @@ [shape-outside-circle-046.html] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-040.html.ini b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-040.html.ini index a18fe1cae602..5152e4be8557 100644 --- a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-040.html.ini +++ b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-040.html.ini @@ -1,3 +1,4 @@ [shape-outside-ellipse-040.html] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-041.html.ini b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-041.html.ini index df345c6a53e7..560dac53baa7 100644 --- a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-041.html.ini +++ b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-041.html.ini @@ -1,3 +1,4 @@ [shape-outside-ellipse-041.html] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-042.html.ini b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-042.html.ini index 71d369d116e2..af1f213efd85 100644 --- a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-042.html.ini +++ b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-042.html.ini @@ -1,3 +1,4 @@ [shape-outside-ellipse-042.html] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-043.html.ini b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-043.html.ini index c2f2719fdbc3..d41e514b77e2 100644 --- a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-043.html.ini +++ b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-ellipse-043.html.ini @@ -1,3 +1,4 @@ [shape-outside-ellipse-043.html] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-018.html.ini b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-018.html.ini index 830b71ed9c22..3f23a94038c9 100644 --- a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-018.html.ini +++ b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-018.html.ini @@ -1,3 +1,4 @@ [shape-outside-inset-018.html] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-019.html.ini b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-019.html.ini index 5b485e682dec..b26611f19d62 100644 --- a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-019.html.ini +++ b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/shapes1/shape-outside-inset-019.html.ini @@ -1,3 +1,4 @@ [shape-outside-inset-019.html] expected: if webrender: FAIL + PASS diff --git a/testing/web-platform/meta/fetch/api/basic/conditional-get.html.ini b/testing/web-platform/meta/fetch/api/basic/conditional-get.html.ini index 0e1c8fb86527..6498aad1cc12 100644 --- a/testing/web-platform/meta/fetch/api/basic/conditional-get.html.ini +++ b/testing/web-platform/meta/fetch/api/basic/conditional-get.html.ini @@ -1,2 +1 @@ prefs: [network.http.rcwn.enabled:false] -[conditional-get.html] diff --git a/testing/web-platform/meta/fetch/api/request/request-cache-default.html.ini b/testing/web-platform/meta/fetch/api/request/request-cache-default.html.ini index b5089424c859..6498aad1cc12 100644 --- a/testing/web-platform/meta/fetch/api/request/request-cache-default.html.ini +++ b/testing/web-platform/meta/fetch/api/request/request-cache-default.html.ini @@ -1,2 +1 @@ prefs: [network.http.rcwn.enabled:false] -[request-cache-default.html] diff --git a/testing/web-platform/meta/fetch/api/request/request-cache-force-cache.html.ini b/testing/web-platform/meta/fetch/api/request/request-cache-force-cache.html.ini index 040f10f2bb38..6498aad1cc12 100644 --- a/testing/web-platform/meta/fetch/api/request/request-cache-force-cache.html.ini +++ b/testing/web-platform/meta/fetch/api/request/request-cache-force-cache.html.ini @@ -1,2 +1 @@ prefs: [network.http.rcwn.enabled:false] -[request-cache-force-cache.html] diff --git a/testing/web-platform/meta/fetch/api/request/request-cache-reload.html.ini b/testing/web-platform/meta/fetch/api/request/request-cache-reload.html.ini index 3bc17e282099..6498aad1cc12 100644 --- a/testing/web-platform/meta/fetch/api/request/request-cache-reload.html.ini +++ b/testing/web-platform/meta/fetch/api/request/request-cache-reload.html.ini @@ -1,2 +1 @@ prefs: [network.http.rcwn.enabled:false] -[request-cache-reload.html] diff --git a/testing/web-platform/meta/html/syntax/parsing/html5lib_tests15.html.ini b/testing/web-platform/meta/html/syntax/parsing/html5lib_tests15.html.ini index f0a32a43d580..050d4306ac64 100644 --- a/testing/web-platform/meta/html/syntax/parsing/html5lib_tests15.html.ini +++ b/testing/web-platform/meta/html/syntax/parsing/html5lib_tests15.html.ini @@ -11,7 +11,3 @@ [html5lib_tests15.html 938af694979b4eae59e7bd3ab71d76e5254192a0] expected: FAIL - -[html5lib_tests15.html?run_type=write] - -[html5lib_tests15.html?run_type=uri] diff --git a/testing/web-platform/meta/websockets/constructor/014.html.ini b/testing/web-platform/meta/websockets/constructor/014.html.ini index b511b5cfd064..1ecf2e83b18f 100644 --- a/testing/web-platform/meta/websockets/constructor/014.html.ini +++ b/testing/web-platform/meta/websockets/constructor/014.html.ini @@ -2,5 +2,3 @@ disabled: if (os == "win") and (version == "5.1.2600"): https://bugzilla.mozilla.org/show_bug.cgi?id=1090198 if e10s and debug: https://bugzilla.mozilla.org/show_bug.cgi?id=1090198 - -[014.html?wss] From 7251e2d81f6e1133dbec8f25996be5fd76a5255a Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Tue, 27 Feb 2018 16:09:24 +0000 Subject: [PATCH 23/67] Bug 1441488 [wpt PR 9368] - Payment Request: include DOM IDLs as untested, a=testonly Automatic update from web-platform-tests Ensure that dependent IDLs are pulled in as "untested" so that unrelated failures don't show up here. In particular, a missing AbortController/AbortSignal implementation should not be reported as a Payment Request failure. https://github.com/w3c/web-platform-tests/issues/9367 wpt-commits: b2106604925d34625418666ba06d1b20d96f02f4 wpt-pr: 9368 reapplied-commits: 370e267e160568862f1fd9ec246ab5bb840f586e, fe4514c84e7ad28e46bad5da93381deb99b177f3, 7806af854343c043a2645a4034fdc7812f65daad, 9ddfd21554293dec5a4bf2e5375ae4f3c9f2ded0, 75f63c4d1ebc949647184fd60972fc7b9fd4affb, 1f3a5b496acd2288cc8cf0c32af86cb35157ea4e, 88b42bd5847abac58a62c4d6b33c1509bfce5f3d, 15c2e4c690700c6c115f8afe5e44ded10d943538, c8d461ef1437641ae7d4ea1d21e1e60cd62910b0, a6088a5f48ee299386a84d2f771902267d7355b1, 0634cd8f08ebe0905a9188fb1398c7b5f889c5dc, c8ee4a012dae506ae06bb5b2ad50942b04c1aaaa, c2c352456a4cf62dcc12f851138b04397675a445, b93a8879555d2fa7e7d4e00a275513a3a6338b35, b86e1331cb36634fd33677043b61fc0c1d8485bc, 44ddf14fd3346658c3223f13652073fafbfa48fa, a1a5840a6bb53e305ba02bcbeb215659342d0edb, 7465cb110ae5ec2e2ca73182caf5293f0efc8fd5, aad5349b3458bc3414e274b33fa86a1123901ff2, eca0907980d2769c449894a6277c60c1a306792f, 38626987c0cfd6e715cfcc6f4f1a1209191a03c5, e4a67f7ddcde6cd99348e9104bd7ed07074da44a, bb3c9990840a0fae2afc840b5952d7874785b112, 042d7adef0bdb9dc80e825c3997ace7519477c42, 99f1ea44fc7915b8b7b33bce4732fa8765fd3ac2 --- testing/web-platform/meta/MANIFEST.json | 2 +- .../tests/payment-request/interfaces.https.html | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index 92b2f1af4529..b8224d619609 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -572862,7 +572862,7 @@ "testharness" ], "payment-request/interfaces.https.html": [ - "87fb3213b7442ceb3f096d88b6bae3074f96d29c", + "d269e8378f2a84ba96c981536667817e0db9e2d1", "testharness" ], "payment-request/payment-request-abort-method.https.html": [ diff --git a/testing/web-platform/tests/payment-request/interfaces.https.html b/testing/web-platform/tests/payment-request/interfaces.https.html index bfbcad48afe5..a7ec323f0cda 100644 --- a/testing/web-platform/tests/payment-request/interfaces.https.html +++ b/testing/web-platform/tests/payment-request/interfaces.https.html @@ -7,12 +7,13 @@ + + + +
+
+ + + + diff --git a/testing/web-platform/tests/css/css-align/gaps/column-gap-animation-002.html b/testing/web-platform/tests/css/css-align/gaps/column-gap-animation-002.html new file mode 100644 index 000000000000..133b98a31c45 --- /dev/null +++ b/testing/web-platform/tests/css/css-align/gaps/column-gap-animation-002.html @@ -0,0 +1,34 @@ + + +CSS Box Alignment Test: column-gap normal test animation + + + + + + + + +
+
+ + + diff --git a/testing/web-platform/tests/css/css-align/gaps/column-gap-animation-003.html b/testing/web-platform/tests/css/css-align/gaps/column-gap-animation-003.html new file mode 100644 index 000000000000..ef8f0e52e4b6 --- /dev/null +++ b/testing/web-platform/tests/css/css-align/gaps/column-gap-animation-003.html @@ -0,0 +1,33 @@ + + +CSS Box Alignment Test: Default column-gap test animation + + + + + + + + +
+
+ + + diff --git a/testing/web-platform/tests/css/css-align/gaps/column-gap-parsing-001.html b/testing/web-platform/tests/css/css-align/gaps/column-gap-parsing-001.html new file mode 100644 index 000000000000..f0bcea4d98db --- /dev/null +++ b/testing/web-platform/tests/css/css-align/gaps/column-gap-parsing-001.html @@ -0,0 +1,144 @@ + + +CSS Box Alignment Test: column-gap parsing + + + + + + +
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+ + + + + diff --git a/testing/web-platform/tests/css/css-align/gaps/gap-animation-001.html b/testing/web-platform/tests/css/css-align/gaps/gap-animation-001.html new file mode 100644 index 000000000000..881bb18446e8 --- /dev/null +++ b/testing/web-platform/tests/css/css-align/gaps/gap-animation-001.html @@ -0,0 +1,38 @@ + + +CSS Box Alignment Test: gap test animation + + + + + + + + +
+
+ + + + diff --git a/testing/web-platform/tests/css/css-align/gaps/gap-animation-002.html b/testing/web-platform/tests/css/css-align/gaps/gap-animation-002.html new file mode 100644 index 000000000000..44d8c70b3a85 --- /dev/null +++ b/testing/web-platform/tests/css/css-align/gaps/gap-animation-002.html @@ -0,0 +1,36 @@ + + +CSS Box Alignment Test: gap normal test animation + + + + + + + + +
+
+ + + diff --git a/testing/web-platform/tests/css/css-align/gaps/gap-animation-003.html b/testing/web-platform/tests/css/css-align/gaps/gap-animation-003.html new file mode 100644 index 000000000000..c047946fb7f9 --- /dev/null +++ b/testing/web-platform/tests/css/css-align/gaps/gap-animation-003.html @@ -0,0 +1,35 @@ + + +CSS Box Alignment Test: Default gap test animation + + + + + + + + +
+
+ + + diff --git a/testing/web-platform/tests/css/css-align/gaps/gap-animation-004.html b/testing/web-platform/tests/css/css-align/gaps/gap-animation-004.html new file mode 100644 index 000000000000..8b6fbe440f9e --- /dev/null +++ b/testing/web-platform/tests/css/css-align/gaps/gap-animation-004.html @@ -0,0 +1,37 @@ + + +CSS Box Alignment Test: gap test animation + + + + + + + + +
+
+ + + diff --git a/testing/web-platform/tests/css/css-align/gaps/gap-parsing-001.html b/testing/web-platform/tests/css/css-align/gaps/gap-parsing-001.html new file mode 100644 index 000000000000..488561281842 --- /dev/null +++ b/testing/web-platform/tests/css/css-align/gaps/gap-parsing-001.html @@ -0,0 +1,226 @@ + + +CSS Box Alignment Test: gap shorthand parsing + + + + + + +
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+ + + + + diff --git a/testing/web-platform/tests/css/css-align/gaps/grid-column-gap-parsing-001.html b/testing/web-platform/tests/css/css-align/gaps/grid-column-gap-parsing-001.html new file mode 100644 index 000000000000..a552463950c1 --- /dev/null +++ b/testing/web-platform/tests/css/css-align/gaps/grid-column-gap-parsing-001.html @@ -0,0 +1,144 @@ + + +CSS Box Alignment Test: column-gap parsing + + + + + + +
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+ + + + + diff --git a/testing/web-platform/tests/css/css-align/gaps/grid-gap-parsing-001.html b/testing/web-platform/tests/css/css-align/gaps/grid-gap-parsing-001.html new file mode 100644 index 000000000000..614b23a7a4f8 --- /dev/null +++ b/testing/web-platform/tests/css/css-align/gaps/grid-gap-parsing-001.html @@ -0,0 +1,226 @@ + + +CSS Box Alignment Test: gap shorthand parsing + + + + + + +
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+ + + + + diff --git a/testing/web-platform/tests/css/css-align/gaps/grid-row-gap-parsing-001.html b/testing/web-platform/tests/css/css-align/gaps/grid-row-gap-parsing-001.html new file mode 100644 index 000000000000..9dc8c8da59a9 --- /dev/null +++ b/testing/web-platform/tests/css/css-align/gaps/grid-row-gap-parsing-001.html @@ -0,0 +1,144 @@ + + +CSS Box Alignment Test: row-gap parsing + + + + + + +
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+ + + + + diff --git a/testing/web-platform/tests/css/css-align/gaps/row-gap-animation-001.html b/testing/web-platform/tests/css/css-align/gaps/row-gap-animation-001.html new file mode 100644 index 000000000000..da4a235deda3 --- /dev/null +++ b/testing/web-platform/tests/css/css-align/gaps/row-gap-animation-001.html @@ -0,0 +1,36 @@ + + +CSS Box Alignment Test: row-gap test animation + + + + + + + + +
+
+ + + + diff --git a/testing/web-platform/tests/css/css-align/gaps/row-gap-animation-002.html b/testing/web-platform/tests/css/css-align/gaps/row-gap-animation-002.html new file mode 100644 index 000000000000..330e1054f143 --- /dev/null +++ b/testing/web-platform/tests/css/css-align/gaps/row-gap-animation-002.html @@ -0,0 +1,34 @@ + + +CSS Box Alignment Test: row-gap normal test animation + + + + + + + + +
+
+ + + diff --git a/testing/web-platform/tests/css/css-align/gaps/row-gap-animation-003.html b/testing/web-platform/tests/css/css-align/gaps/row-gap-animation-003.html new file mode 100644 index 000000000000..574e3ff7c85e --- /dev/null +++ b/testing/web-platform/tests/css/css-align/gaps/row-gap-animation-003.html @@ -0,0 +1,33 @@ + + +CSS Box Alignment Test: Default row-gap test animation + + + + + + + + +
+
+ + + diff --git a/testing/web-platform/tests/css/css-align/gaps/row-gap-parsing-001.html b/testing/web-platform/tests/css/css-align/gaps/row-gap-parsing-001.html new file mode 100644 index 000000000000..6de848c3c2ac --- /dev/null +++ b/testing/web-platform/tests/css/css-align/gaps/row-gap-parsing-001.html @@ -0,0 +1,144 @@ + + +CSS Box Alignment Test: row-gap parsing + + + + + + +
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+ + + + + From ad803046b24a5a45309da4b25b9a3d7e8ba4f5be Mon Sep 17 00:00:00 2001 From: moz-wptsync-bot Date: Mon, 26 Feb 2018 21:44:52 +0000 Subject: [PATCH 26/67] Bug 1441242 [wpt PR 9227]- Update wpt metadata, a=testonly wpt-pr: 9227 wpt-type: metadata --- .../gaps/column-gap-parsing-001.html.ini | 4 + .../css-align/gaps/gap-animation-001.html.ini | 4 + .../css-align/gaps/gap-animation-002.html.ini | 4 + .../css-align/gaps/gap-animation-003.html.ini | 4 + .../css-align/gaps/gap-animation-004.html.ini | 4 + .../css-align/gaps/gap-parsing-001.html.ini | 76 +++++++++++++++++++ .../gaps/grid-column-gap-parsing-001.html.ini | 4 + .../gaps/grid-gap-parsing-001.html.ini | 76 +++++++++++++++++++ .../gaps/grid-row-gap-parsing-001.html.ini | 49 ++++++++++++ .../gaps/row-gap-animation-001.html.ini | 4 + .../gaps/row-gap-animation-002.html.ini | 4 + .../gaps/row-gap-animation-003.html.ini | 4 + .../gaps/row-gap-parsing-001.html.ini | 49 ++++++++++++ 13 files changed, 286 insertions(+) create mode 100644 testing/web-platform/meta/css/css-align/gaps/column-gap-parsing-001.html.ini create mode 100644 testing/web-platform/meta/css/css-align/gaps/gap-animation-001.html.ini create mode 100644 testing/web-platform/meta/css/css-align/gaps/gap-animation-002.html.ini create mode 100644 testing/web-platform/meta/css/css-align/gaps/gap-animation-003.html.ini create mode 100644 testing/web-platform/meta/css/css-align/gaps/gap-animation-004.html.ini create mode 100644 testing/web-platform/meta/css/css-align/gaps/gap-parsing-001.html.ini create mode 100644 testing/web-platform/meta/css/css-align/gaps/grid-column-gap-parsing-001.html.ini create mode 100644 testing/web-platform/meta/css/css-align/gaps/grid-gap-parsing-001.html.ini create mode 100644 testing/web-platform/meta/css/css-align/gaps/grid-row-gap-parsing-001.html.ini create mode 100644 testing/web-platform/meta/css/css-align/gaps/row-gap-animation-001.html.ini create mode 100644 testing/web-platform/meta/css/css-align/gaps/row-gap-animation-002.html.ini create mode 100644 testing/web-platform/meta/css/css-align/gaps/row-gap-animation-003.html.ini create mode 100644 testing/web-platform/meta/css/css-align/gaps/row-gap-parsing-001.html.ini diff --git a/testing/web-platform/meta/css/css-align/gaps/column-gap-parsing-001.html.ini b/testing/web-platform/meta/css/css-align/gaps/column-gap-parsing-001.html.ini new file mode 100644 index 000000000000..093342978683 --- /dev/null +++ b/testing/web-platform/meta/css/css-align/gaps/column-gap-parsing-001.html.ini @@ -0,0 +1,4 @@ +[column-gap-parsing-001.html] + [column-gap accepts percentage] + expected: FAIL + diff --git a/testing/web-platform/meta/css/css-align/gaps/gap-animation-001.html.ini b/testing/web-platform/meta/css/css-align/gaps/gap-animation-001.html.ini new file mode 100644 index 000000000000..368f60a2382a --- /dev/null +++ b/testing/web-platform/meta/css/css-align/gaps/gap-animation-001.html.ini @@ -0,0 +1,4 @@ +[gap-animation-001.html] + [gap is interpolable] + expected: FAIL + diff --git a/testing/web-platform/meta/css/css-align/gaps/gap-animation-002.html.ini b/testing/web-platform/meta/css/css-align/gaps/gap-animation-002.html.ini new file mode 100644 index 000000000000..0d69d1ec367b --- /dev/null +++ b/testing/web-platform/meta/css/css-align/gaps/gap-animation-002.html.ini @@ -0,0 +1,4 @@ +[gap-animation-002.html] + [gap: normal is not interpolable] + expected: FAIL + diff --git a/testing/web-platform/meta/css/css-align/gaps/gap-animation-003.html.ini b/testing/web-platform/meta/css/css-align/gaps/gap-animation-003.html.ini new file mode 100644 index 000000000000..9fa25dc683db --- /dev/null +++ b/testing/web-platform/meta/css/css-align/gaps/gap-animation-003.html.ini @@ -0,0 +1,4 @@ +[gap-animation-003.html] + [Default gap is not interpolable] + expected: FAIL + diff --git a/testing/web-platform/meta/css/css-align/gaps/gap-animation-004.html.ini b/testing/web-platform/meta/css/css-align/gaps/gap-animation-004.html.ini new file mode 100644 index 000000000000..dc8783b6bf0a --- /dev/null +++ b/testing/web-platform/meta/css/css-align/gaps/gap-animation-004.html.ini @@ -0,0 +1,4 @@ +[gap-animation-004.html] + [gap is interpolable] + expected: FAIL + diff --git a/testing/web-platform/meta/css/css-align/gaps/gap-parsing-001.html.ini b/testing/web-platform/meta/css/css-align/gaps/gap-parsing-001.html.ini new file mode 100644 index 000000000000..5ba1370ba90b --- /dev/null +++ b/testing/web-platform/meta/css/css-align/gaps/gap-parsing-001.html.ini @@ -0,0 +1,76 @@ +[gap-parsing-001.html] + [Default gap is 'normal'] + expected: FAIL + + [gap accepts pixels] + expected: FAIL + + [gap accepts pixels 2] + expected: FAIL + + [gap accepts pixels combined with percentage] + expected: FAIL + + [gap accepts em] + expected: FAIL + + [gap accepts em 2] + expected: FAIL + + [gap accepts vw] + expected: FAIL + + [gap accepts vw and vh] + expected: FAIL + + [gap accepts percentage] + expected: FAIL + + [gap accepts percentage 2] + expected: FAIL + + [gap accepts calc()] + expected: FAIL + + [gap accepts calc() 2] + expected: FAIL + + [Initial gap is 'normal'] + expected: FAIL + + [Initial gap is 'normal' 2] + expected: FAIL + + [Initial inherited gap is 'normal'] + expected: FAIL + + [gap is inheritable] + expected: FAIL + + [Negative gap is invalid] + expected: FAIL + + ['max-content' gap is invalid] + expected: FAIL + + ['none' gap is invalid] + expected: FAIL + + [Angle gap is invalid] + expected: FAIL + + [Resolution gap is invalid] + expected: FAIL + + [Time gap is invalid] + expected: FAIL + + [gap with three values is invalid] + expected: FAIL + + [gap with slash is invalid] + expected: FAIL + + [gap with one wrong value is invalid] + expected: FAIL + diff --git a/testing/web-platform/meta/css/css-align/gaps/grid-column-gap-parsing-001.html.ini b/testing/web-platform/meta/css/css-align/gaps/grid-column-gap-parsing-001.html.ini new file mode 100644 index 000000000000..ee616cb52fff --- /dev/null +++ b/testing/web-platform/meta/css/css-align/gaps/grid-column-gap-parsing-001.html.ini @@ -0,0 +1,4 @@ +[grid-column-gap-parsing-001.html] + [column-gap accepts percentage] + expected: FAIL + diff --git a/testing/web-platform/meta/css/css-align/gaps/grid-gap-parsing-001.html.ini b/testing/web-platform/meta/css/css-align/gaps/grid-gap-parsing-001.html.ini new file mode 100644 index 000000000000..d3b8829b3766 --- /dev/null +++ b/testing/web-platform/meta/css/css-align/gaps/grid-gap-parsing-001.html.ini @@ -0,0 +1,76 @@ +[grid-gap-parsing-001.html] + [Default gap is 'normal'] + expected: FAIL + + [gap accepts pixels] + expected: FAIL + + [gap accepts pixels 2] + expected: FAIL + + [gap accepts pixels combined with percentage] + expected: FAIL + + [gap accepts em] + expected: FAIL + + [gap accepts em 2] + expected: FAIL + + [gap accepts vw] + expected: FAIL + + [gap accepts vw and vh] + expected: FAIL + + [gap accepts percentage] + expected: FAIL + + [gap accepts percentage 2] + expected: FAIL + + [gap accepts calc()] + expected: FAIL + + [gap accepts calc() 2] + expected: FAIL + + [Initial gap is 'normal'] + expected: FAIL + + [Initial gap is 'normal' 2] + expected: FAIL + + [Initial inherited gap is 'normal'] + expected: FAIL + + [gap is inheritable] + expected: FAIL + + [Negative gap is invalid] + expected: FAIL + + ['max-content' gap is invalid] + expected: FAIL + + ['none' gap is invalid] + expected: FAIL + + [Angle gap is invalid] + expected: FAIL + + [Resolution gap is invalid] + expected: FAIL + + [Time gap is invalid] + expected: FAIL + + [gap with three values is invalid] + expected: FAIL + + [gap with slash is invalid] + expected: FAIL + + [gap with one wrong value is invalid] + expected: FAIL + diff --git a/testing/web-platform/meta/css/css-align/gaps/grid-row-gap-parsing-001.html.ini b/testing/web-platform/meta/css/css-align/gaps/grid-row-gap-parsing-001.html.ini new file mode 100644 index 000000000000..0cc467d48756 --- /dev/null +++ b/testing/web-platform/meta/css/css-align/gaps/grid-row-gap-parsing-001.html.ini @@ -0,0 +1,49 @@ +[grid-row-gap-parsing-001.html] + [Default row-gap is 'normal'] + expected: FAIL + + [row-gap accepts pixels] + expected: FAIL + + [row-gap accepts em] + expected: FAIL + + [row-gap accepts percentage] + expected: FAIL + + [row-gap accepts calc()] + expected: FAIL + + [Initial row-gap is 'normal'] + expected: FAIL + + [Initial row-gap is 'normal' 2] + expected: FAIL + + [Initial inherited row-gap is 'normal'] + expected: FAIL + + [row-gap is inheritable] + expected: FAIL + + [Negative row-gap is invalid] + expected: FAIL + + ['max-content' row-gap is invalid] + expected: FAIL + + ['none' row-gap is invalid] + expected: FAIL + + [row-gap with multiple values is invalid] + expected: FAIL + + [Angle row-gap is invalid] + expected: FAIL + + [Resolution row-gap is invalid] + expected: FAIL + + [Time row-gap is invalid] + expected: FAIL + diff --git a/testing/web-platform/meta/css/css-align/gaps/row-gap-animation-001.html.ini b/testing/web-platform/meta/css/css-align/gaps/row-gap-animation-001.html.ini new file mode 100644 index 000000000000..8e43e8858284 --- /dev/null +++ b/testing/web-platform/meta/css/css-align/gaps/row-gap-animation-001.html.ini @@ -0,0 +1,4 @@ +[row-gap-animation-001.html] + [row-gap is interpolable] + expected: FAIL + diff --git a/testing/web-platform/meta/css/css-align/gaps/row-gap-animation-002.html.ini b/testing/web-platform/meta/css/css-align/gaps/row-gap-animation-002.html.ini new file mode 100644 index 000000000000..ba1bcddaf716 --- /dev/null +++ b/testing/web-platform/meta/css/css-align/gaps/row-gap-animation-002.html.ini @@ -0,0 +1,4 @@ +[row-gap-animation-002.html] + [row-gap: normal is not interpolable] + expected: FAIL + diff --git a/testing/web-platform/meta/css/css-align/gaps/row-gap-animation-003.html.ini b/testing/web-platform/meta/css/css-align/gaps/row-gap-animation-003.html.ini new file mode 100644 index 000000000000..88a6bcf7e25f --- /dev/null +++ b/testing/web-platform/meta/css/css-align/gaps/row-gap-animation-003.html.ini @@ -0,0 +1,4 @@ +[row-gap-animation-003.html] + [Default row-gap is not interpolable] + expected: FAIL + diff --git a/testing/web-platform/meta/css/css-align/gaps/row-gap-parsing-001.html.ini b/testing/web-platform/meta/css/css-align/gaps/row-gap-parsing-001.html.ini new file mode 100644 index 000000000000..7588478bb088 --- /dev/null +++ b/testing/web-platform/meta/css/css-align/gaps/row-gap-parsing-001.html.ini @@ -0,0 +1,49 @@ +[row-gap-parsing-001.html] + [Default row-gap is 'normal'] + expected: FAIL + + [row-gap accepts pixels] + expected: FAIL + + [row-gap accepts em] + expected: FAIL + + [row-gap accepts percentage] + expected: FAIL + + [row-gap accepts calc()] + expected: FAIL + + [Initial row-gap is 'normal'] + expected: FAIL + + [Initial row-gap is 'normal' 2] + expected: FAIL + + [Initial inherited row-gap is 'normal'] + expected: FAIL + + [row-gap is inheritable] + expected: FAIL + + [Negative row-gap is invalid] + expected: FAIL + + ['max-content' row-gap is invalid] + expected: FAIL + + ['none' row-gap is invalid] + expected: FAIL + + [row-gap with multiple values is invalid] + expected: FAIL + + [Angle row-gap is invalid] + expected: FAIL + + [Resolution row-gap is invalid] + expected: FAIL + + [Time row-gap is invalid] + expected: FAIL + From a78d5ced645f51903831a28310566bc8d9d31a39 Mon Sep 17 00:00:00 2001 From: Adam Rice Date: Tue, 27 Feb 2018 16:15:27 +0000 Subject: [PATCH 27/67] Bug 1441488 [wpt PR 9361] - Implement AbortController and AbortSignal, a=testonly Automatic update from web-platform-tests Also adjust layout tests expectations to match the new behaviour. One fetch() wpt test that previously failed due to AbortController being undefined now times out because the "signal" properties in fetch options doesn't do anything yet. This will be fixed once it is implemented. Spec: https://dom.spec.whatwg.org/#aborting-ongoing-activities Design doc: https://docs.google.com/document/d/1OuoCG2uiijbAwbCw9jaS7tHEO0LBO_4gMNio1ox0qlY/edit Intent to Ship: https://groups.google.com/a/chromium.org/d/msg/blink-dev/9vNZh4fhV2U/ZVxD2iQACgAJ BUG=750599 Change-Id: I0e504bbf7f8552d602913ee2069bbf90f95deaff Reviewed-on: https://chromium-review.googlesource.com/896669 Commit-Queue: Adam Rice Reviewed-by: Kent Tamura Reviewed-by: Hayato Ito Reviewed-by: Joshua Bell Cr-Commit-Position: refs/heads/master@{#534352} wpt-commits: 7caa3de7471cf19b78ee9efa313c7341a462b5e3 wpt-pr: 9361 reapplied-commits: 370e267e160568862f1fd9ec246ab5bb840f586e, fe4514c84e7ad28e46bad5da93381deb99b177f3, 7806af854343c043a2645a4034fdc7812f65daad, 9ddfd21554293dec5a4bf2e5375ae4f3c9f2ded0, 75f63c4d1ebc949647184fd60972fc7b9fd4affb, 1f3a5b496acd2288cc8cf0c32af86cb35157ea4e, 88b42bd5847abac58a62c4d6b33c1509bfce5f3d, 15c2e4c690700c6c115f8afe5e44ded10d943538, c8d461ef1437641ae7d4ea1d21e1e60cd62910b0, a6088a5f48ee299386a84d2f771902267d7355b1, 0634cd8f08ebe0905a9188fb1398c7b5f889c5dc, c8ee4a012dae506ae06bb5b2ad50942b04c1aaaa, c2c352456a4cf62dcc12f851138b04397675a445, b93a8879555d2fa7e7d4e00a275513a3a6338b35, b86e1331cb36634fd33677043b61fc0c1d8485bc, 44ddf14fd3346658c3223f13652073fafbfa48fa, a1a5840a6bb53e305ba02bcbeb215659342d0edb, 7465cb110ae5ec2e2ca73182caf5293f0efc8fd5, aad5349b3458bc3414e274b33fa86a1123901ff2, eca0907980d2769c449894a6277c60c1a306792f, 38626987c0cfd6e715cfcc6f4f1a1209191a03c5, e4a67f7ddcde6cd99348e9104bd7ed07074da44a, bb3c9990840a0fae2afc840b5952d7874785b112, 042d7adef0bdb9dc80e825c3997ace7519477c42, 99f1ea44fc7915b8b7b33bce4732fa8765fd3ac2 --- testing/web-platform/meta/MANIFEST.json | 4 +- .../web-platform/tests/dom/abort/event.any.js | 47 ++++++++++++++++++- .../web-platform/tests/dom/interfaces.html | 17 +++++-- 3 files changed, 61 insertions(+), 7 deletions(-) diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index 813b2f5939ea..66da0804a449 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -537402,7 +537402,7 @@ "support" ], "dom/abort/event.any.js": [ - "25e9c1104acb9b0092d1303190588a3953cf635d", + "d41904ddfc56e5ef3e89d965a4e5fa392e996ef9", "testharness" ], "dom/collections/HTMLCollection-as-proto-length-get-throws.html": [ @@ -537634,7 +537634,7 @@ "testharness" ], "dom/interfaces.html": [ - "7d00e3a778083a91156f4e042c7abd270060a7fc", + "3308c9f3341c12ce99217309eba608e50cca669d", "testharness" ], "dom/lists/DOMTokenList-Iterable.html": [ diff --git a/testing/web-platform/tests/dom/abort/event.any.js b/testing/web-platform/tests/dom/abort/event.any.js index 3b25702c2e4c..a67e6f400fcf 100644 --- a/testing/web-platform/tests/dom/abort/event.any.js +++ b/testing/web-platform/tests/dom/abort/event.any.js @@ -17,6 +17,51 @@ test(t => { assert_true(s.aborted); c.abort(); -}, "AbortController() basics"); +}, "AbortController abort() should fire event synchronously"); + +test(t => { + const controller = new AbortController(); + const signal = controller.signal; + assert_equals(controller.signal, signal, + "value of controller.signal should not have changed"); + controller.abort(); + assert_equals(controller.signal, signal, + "value of controller.signal should still not have changed"); +}, "controller.signal should always return the same object"); + +test(t => { + const controller = new AbortController(); + const signal = controller.signal; + let eventCount = 0; + signal.onabort = () => { + ++eventCount; + }; + controller.abort(); + assert_true(signal.aborted); + assert_equals(eventCount, 1, "event handler should have been called once"); + controller.abort(); + assert_true(signal.aborted); + assert_equals(eventCount, 1, + "event handler should not have been called again"); +}, "controller.abort() should do nothing the second time it is called"); + +test(t => { + const controller = new AbortController(); + controller.abort(); + controller.signal.onabort = + t.unreached_func("event handler should not be called"); +}, "event handler should not be called if added after controller.abort()"); + +test(t => { + const controller = new AbortController(); + const signal = controller.signal; + signal.onabort = t.step_func(e => { + assert_equals(e.type, "abort", "event type should be abort"); + assert_equals(e.target, signal, "event target should be signal"); + assert_false(e.bubbles, "event should not bubble"); + assert_true(e.isTrusted, "event should be trusted"); + }); + controller.abort(); +}, "the abort event should have the right properties"); done(); diff --git a/testing/web-platform/tests/dom/interfaces.html b/testing/web-platform/tests/dom/interfaces.html index 8e9572d0f09c..3cb08f405a5a 100644 --- a/testing/web-platform/tests/dom/interfaces.html +++ b/testing/web-platform/tests/dom/interfaces.html @@ -18,8 +18,12 @@ element.setAttribute("bar", "baz"); var idlArray = new IdlArray(); -function doTest(idl) { - idlArray.add_idls(idl); +function doTest([html, dom]) { + // HTML is needed for EventHandler. Provide a dummy interface for + // LinkStyle which HTML depends on but we're not testing. + idlArray.add_untested_idls('interface LinkStyle {};'); + idlArray.add_untested_idls(html); + idlArray.add_idls(dom); idlArray.add_objects({ EventTarget: ['new EventTarget()'], Event: ['document.createEvent("Event")', 'new Event("foo")'], @@ -46,8 +50,13 @@ function doTest(idl) { idlArray.test(); } +function fetchText(url) { + return fetch(url).then((response) => response.text()); +} + promise_test(function() { - return fetch("/interfaces/dom.idl").then(response => response.text()) - .then(doTest); + return Promise.all(['/interfaces/html.idl', + '/interfaces/dom.idl'].map(fetchText)) + .then(doTest); }, "Test driver"); From 5a1bac44d83f6783ac015a2a9c5dc3f69c65ba56 Mon Sep 17 00:00:00 2001 From: moz-wptsync-bot Date: Mon, 26 Feb 2018 23:44:06 +0000 Subject: [PATCH 28/67] Bug 1441247 [wpt PR 9361]- Update wpt metadata, a=testonly wpt-pr: 9361 wpt-type: metadata --- testing/web-platform/meta/dom/interfaces.html.ini | 3 --- 1 file changed, 3 deletions(-) diff --git a/testing/web-platform/meta/dom/interfaces.html.ini b/testing/web-platform/meta/dom/interfaces.html.ini index 4bdb62f2098d..ed7f660db16b 100644 --- a/testing/web-platform/meta/dom/interfaces.html.ini +++ b/testing/web-platform/meta/dom/interfaces.html.ini @@ -26,9 +26,6 @@ [AbortSignal interface: new AbortController().signal must inherit property "onabort" with the proper type (1)] expected: FAIL - [AbortSignal interface: new AbortController().signal must inherit property "onabort" with the proper type] - expected: FAIL - [Document interface: new Document() must inherit property "origin" with the proper type] expected: FAIL From ae6b02e0b2b573db30f0437e2e306f54b2e6cb89 Mon Sep 17 00:00:00 2001 From: Kent Tamura Date: Tue, 27 Feb 2018 16:17:24 +0000 Subject: [PATCH 29/67] Bug 1441488 [wpt PR 9386] - custom-elements: Support custom built-in elements in XML parser., a=testonly Automatic update from web-platform-tests * Enable Document::CreateElement to support both of V0 type extension and V1 custom built-in Merge is_v1 flag to CreateDocumentFlags. It is a tri-state flag; -- Supports only V0, for createElement('div', 'my-div') -- Supports only V1, for createElement('div', {is:'my-div'}) -- Supports both (default) * Enable Document::CreateElement to support asynchronous custom elements creation. Bug: 808302 Change-Id: I4a60bf8a687c0ec93b395d99d816aadb8dfdd4a5 Reviewed-on: https://chromium-review.googlesource.com/901103 Reviewed-by: Yoshifumi Inoue Commit-Queue: Kent Tamura Cr-Commit-Position: refs/heads/master@{#534364} wpt-commits: de0e83a8e669417ca7bdc3f71da69c8758dabc40 wpt-pr: 9386 reapplied-commits: 370e267e160568862f1fd9ec246ab5bb840f586e, fe4514c84e7ad28e46bad5da93381deb99b177f3, 7806af854343c043a2645a4034fdc7812f65daad, 9ddfd21554293dec5a4bf2e5375ae4f3c9f2ded0, 75f63c4d1ebc949647184fd60972fc7b9fd4affb, 1f3a5b496acd2288cc8cf0c32af86cb35157ea4e, 88b42bd5847abac58a62c4d6b33c1509bfce5f3d, 15c2e4c690700c6c115f8afe5e44ded10d943538, c8d461ef1437641ae7d4ea1d21e1e60cd62910b0, a6088a5f48ee299386a84d2f771902267d7355b1, 0634cd8f08ebe0905a9188fb1398c7b5f889c5dc, c8ee4a012dae506ae06bb5b2ad50942b04c1aaaa, c2c352456a4cf62dcc12f851138b04397675a445, b93a8879555d2fa7e7d4e00a275513a3a6338b35, b86e1331cb36634fd33677043b61fc0c1d8485bc, 44ddf14fd3346658c3223f13652073fafbfa48fa, a1a5840a6bb53e305ba02bcbeb215659342d0edb, 7465cb110ae5ec2e2ca73182caf5293f0efc8fd5, aad5349b3458bc3414e274b33fa86a1123901ff2, eca0907980d2769c449894a6277c60c1a306792f, 38626987c0cfd6e715cfcc6f4f1a1209191a03c5, e4a67f7ddcde6cd99348e9104bd7ed07074da44a, bb3c9990840a0fae2afc840b5952d7874785b112, 042d7adef0bdb9dc80e825c3997ace7519477c42, 99f1ea44fc7915b8b7b33bce4732fa8765fd3ac2 --- testing/web-platform/meta/MANIFEST.json | 10 +++++++ ...uses-create-an-element-for-a-token-svg.svg | 27 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 testing/web-platform/tests/custom-elements/parser/parser-uses-create-an-element-for-a-token-svg.svg diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index 66da0804a449..30f99028c74b 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -315054,6 +315054,12 @@ {} ] ], + "custom-elements/parser/parser-uses-create-an-element-for-a-token-svg.svg": [ + [ + "/custom-elements/parser/parser-uses-create-an-element-for-a-token-svg.svg", + {} + ] + ], "custom-elements/parser/parser-uses-registry-of-owner-document.html": [ [ "/custom-elements/parser/parser-uses-registry-of-owner-document.html", @@ -537017,6 +537023,10 @@ "ed5476ab5b9a8d23ab7d84665c5d3224bb53dd18", "testharness" ], + "custom-elements/parser/parser-uses-create-an-element-for-a-token-svg.svg": [ + "51ecc75f42124e8071a767ef908ecc915cbf0fc1", + "testharness" + ], "custom-elements/parser/parser-uses-registry-of-owner-document.html": [ "a62669ffcc75d54df38b65e33463566238c8644c", "testharness" diff --git a/testing/web-platform/tests/custom-elements/parser/parser-uses-create-an-element-for-a-token-svg.svg b/testing/web-platform/tests/custom-elements/parser/parser-uses-create-an-element-for-a-token-svg.svg new file mode 100644 index 000000000000..526de0f63fa2 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/parser/parser-uses-create-an-element-for-a-token-svg.svg @@ -0,0 +1,27 @@ + + +XML parser should use "create an element for a token" + + + + + +
+
From 68b758cc4f94548c890d06daa9a676fb9184d656 Mon Sep 17 00:00:00 2001 From: moz-wptsync-bot Date: Tue, 27 Feb 2018 01:32:35 +0000 Subject: [PATCH 30/67] Bug 1441252 [wpt PR 9386]- Update wpt metadata, a=testonly wpt-pr: 9386 wpt-type: metadata --- .../parser-uses-create-an-element-for-a-token-svg.svg.ini | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 testing/web-platform/meta/custom-elements/parser/parser-uses-create-an-element-for-a-token-svg.svg.ini diff --git a/testing/web-platform/meta/custom-elements/parser/parser-uses-create-an-element-for-a-token-svg.svg.ini b/testing/web-platform/meta/custom-elements/parser/parser-uses-create-an-element-for-a-token-svg.svg.ini new file mode 100644 index 000000000000..981c65652f3f --- /dev/null +++ b/testing/web-platform/meta/custom-elements/parser/parser-uses-create-an-element-for-a-token-svg.svg.ini @@ -0,0 +1,4 @@ +[parser-uses-create-an-element-for-a-token-svg.svg] + [XML parser should create custom built-in elements.] + expected: FAIL + From 9a872a71e03e1dd3a47172a928a73750fca4ff28 Mon Sep 17 00:00:00 2001 From: Sriram Date: Tue, 27 Feb 2018 16:19:21 +0000 Subject: [PATCH 31/67] Bug 1441488 [wpt PR 9385] - Fix dom_override_remove_cue_while_paused.html, a=testonly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automatic update from web-platform-tests The failure looks to be because of the difference in screenshots. The test has a white background video, where as the reftest has a div element. Adding same video instead of div in reftest also to pass the test. Bug: 774567 Change-Id: I2b616df29c74f449dcce04e3e7c83da9c61427a3 Reviewed-on: https://chromium-review.googlesource.com/896734 Reviewed-by: Fredrik Söderquist Commit-Queue: srirama chandra sekhar Cr-Commit-Position: refs/heads/master@{#534365} wpt-commits: 58bd5c5b7bb4eb05df0092e0d5e2c38da021e890 wpt-pr: 9385 reapplied-commits: 370e267e160568862f1fd9ec246ab5bb840f586e, fe4514c84e7ad28e46bad5da93381deb99b177f3, 7806af854343c043a2645a4034fdc7812f65daad, 9ddfd21554293dec5a4bf2e5375ae4f3c9f2ded0, 75f63c4d1ebc949647184fd60972fc7b9fd4affb, 1f3a5b496acd2288cc8cf0c32af86cb35157ea4e, 88b42bd5847abac58a62c4d6b33c1509bfce5f3d, 15c2e4c690700c6c115f8afe5e44ded10d943538, c8d461ef1437641ae7d4ea1d21e1e60cd62910b0, a6088a5f48ee299386a84d2f771902267d7355b1, 0634cd8f08ebe0905a9188fb1398c7b5f889c5dc, c8ee4a012dae506ae06bb5b2ad50942b04c1aaaa, c2c352456a4cf62dcc12f851138b04397675a445, b93a8879555d2fa7e7d4e00a275513a3a6338b35, b86e1331cb36634fd33677043b61fc0c1d8485bc, 44ddf14fd3346658c3223f13652073fafbfa48fa, a1a5840a6bb53e305ba02bcbeb215659342d0edb, 7465cb110ae5ec2e2ca73182caf5293f0efc8fd5, aad5349b3458bc3414e274b33fa86a1123901ff2, eca0907980d2769c449894a6277c60c1a306792f, 38626987c0cfd6e715cfcc6f4f1a1209191a03c5, e4a67f7ddcde6cd99348e9104bd7ed07074da44a, bb3c9990840a0fae2afc840b5952d7874785b112, 042d7adef0bdb9dc80e825c3997ace7519477c42, 99f1ea44fc7915b8b7b33bce4732fa8765fd3ac2 --- testing/web-platform/meta/MANIFEST.json | 4 ++-- ..._override_remove_cue_while_paused-ref.html | 19 +++++++++---------- .../dom_override_remove_cue_while_paused.html | 8 ++++---- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index 30f99028c74b..c3a8a63ee23c 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -596004,11 +596004,11 @@ "reftest" ], "webvtt/rendering/cues-with-video/processing-model/dom_override_remove_cue_while_paused-ref.html": [ - "5b8a5f597777418b7dba44e6e07d05625c599ce7", + "c5af748ae8fd0d476c20926f2cc7ad2103b22aa4", "support" ], "webvtt/rendering/cues-with-video/processing-model/dom_override_remove_cue_while_paused.html": [ - "5f9e48b0160ac1916034ac29cce97282ce9b1ecf", + "e1eb138e07d42f488051ab6cb4ead266981c5ed8", "reftest" ], "webvtt/rendering/cues-with-video/processing-model/enable_controls_reposition-ref.html": [ diff --git a/testing/web-platform/tests/webvtt/rendering/cues-with-video/processing-model/dom_override_remove_cue_while_paused-ref.html b/testing/web-platform/tests/webvtt/rendering/cues-with-video/processing-model/dom_override_remove_cue_while_paused-ref.html index 66505b22bf57..60f7bb0cd380 100644 --- a/testing/web-platform/tests/webvtt/rendering/cues-with-video/processing-model/dom_override_remove_cue_while_paused-ref.html +++ b/testing/web-platform/tests/webvtt/rendering/cues-with-video/processing-model/dom_override_remove_cue_while_paused-ref.html @@ -1,14 +1,13 @@ + Reference for WebVTT rendering, cue text should be removed when removing them using the DOM APIs while paused + -
+ + \ No newline at end of file diff --git a/testing/web-platform/tests/webvtt/rendering/cues-with-video/processing-model/dom_override_remove_cue_while_paused.html b/testing/web-platform/tests/webvtt/rendering/cues-with-video/processing-model/dom_override_remove_cue_while_paused.html index 708eba98c015..9233df874cf4 100644 --- a/testing/web-platform/tests/webvtt/rendering/cues-with-video/processing-model/dom_override_remove_cue_while_paused.html +++ b/testing/web-platform/tests/webvtt/rendering/cues-with-video/processing-model/dom_override_remove_cue_while_paused.html @@ -2,15 +2,15 @@ WebVTT rendering, cue text should be removed when removing them using the DOM APIs while paused + - -