From 5e3b64d3ecc6fec505cde2c36a3c27cd156e1d44 Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Wed, 4 Apr 2018 11:25:42 -0700 Subject: [PATCH 01/88] Bug 1450358 P0 Factor the event listener runtime leak checking test into a reusable test framework. r=baku --- dom/events/test/event_leak_utils.js | 81 +++++++++++++++++++ dom/events/test/mochitest.ini | 1 + dom/serviceworkers/test/mochitest.ini | 1 + .../test/test_event_listener_leaks.html | 57 +------------ 4 files changed, 85 insertions(+), 55 deletions(-) create mode 100644 dom/events/test/event_leak_utils.js diff --git a/dom/events/test/event_leak_utils.js b/dom/events/test/event_leak_utils.js new file mode 100644 index 000000000000..3aa013d80e2d --- /dev/null +++ b/dom/events/test/event_leak_utils.js @@ -0,0 +1,81 @@ +// Any copyright is dedicated to the Public Domain. +// http://creativecommons.org/publicdomain/zero/1.0/ +"use strict" + +// This function runs a number of tests where: +// +// 1. An iframe is created +// 2. The target callback is executed with the iframe's contentWindow as +// an argument. +// 3. The iframe is destroyed and GC is forced. +// 4. Verifies that the iframe's contentWindow has been GC'd. +// +// Different ways of destroying the iframe are checked. Simple +// remove(), destruction via bfcache, or replacement by document.open(). +// +// Please pass a target callback that exercises the API under +// test using the given window. The callback should try to leave the +// API active to increase the liklihood of provoking an API. Any activity +// should be canceled by the destruction of the window. +async function checkForEventListenerLeaks(name, target) { + // Test if we leak in the case where we do nothing special to + // the frame before removing it from the DOM. + await _eventListenerLeakStep(target, `${name} default`); + + // Test the case where we navigate the frame before removing it + // from the DOM so that the window using the target API ends up + // in bfcache. + await _eventListenerLeakStep(target, `${name} bfcache`, frame => { + frame.src = "about:blank"; + return new Promise(resolve => frame.onload = resolve); + }); + + // Test the case where we document.open() the frame before removing + // it from the DOM so that the window using the target API ends + // up getting replaced. + await _eventListenerLeakStep(target, `${name} document.open()`, frame => { + frame.contentDocument.open(); + frame.contentDocument.close(); + }); +} + +// ---------------- +// Internal helpers +// ---------------- + +// Utility function to create a loaded iframe. +async function _withFrame(doc, url) { + let frame = doc.createElement('iframe'); + frame.src = url; + doc.body.appendChild(frame); + await new Promise(resolve => frame.onload = resolve); + return frame; +} + +// This function defines the basic form of the test cases. We create an +// iframe, execute the target callback to manipulate the DOM, remove the frame +// from the DOM, and then check to see if the frame was GC'd. The caller +// may optionally pass in a callback that will be executed with the +// frame as an argument before removing it from the DOM. +async function _eventListenerLeakStep(target, name, extra) { + let frame = await _withFrame(document, "empty.html"); + + await target(frame.contentWindow); + + let weakRef = SpecialPowers.Cu.getWeakReference(frame.contentWindow); + ok(weakRef.get(), `should be able to create a weak reference - ${name}`); + + if (extra) { + await extra(frame); + } + + frame.remove(); + frame = null; + + // Perform two GC'd to avoid intermittent delayed collection. + await new Promise(resolve => SpecialPowers.exactGC(resolve)); + await new Promise(resolve => SpecialPowers.exactGC(resolve)); + + ok(!weakRef.get(), `iframe content window should be garbage collected - ${name}`); +} + diff --git a/dom/events/test/mochitest.ini b/dom/events/test/mochitest.ini index 2fe44f86af1e..ed38db1fdd06 100644 --- a/dom/events/test/mochitest.ini +++ b/dom/events/test/mochitest.ini @@ -15,6 +15,7 @@ support-files = bug418986-3.js error_event_worker.js empty.js + event_leak_utils.js window_bug493251.html window_bug659071.html window_wheel_default_action.html diff --git a/dom/serviceworkers/test/mochitest.ini b/dom/serviceworkers/test/mochitest.ini index 230b3fa16868..74e26f74dfb2 100644 --- a/dom/serviceworkers/test/mochitest.ini +++ b/dom/serviceworkers/test/mochitest.ini @@ -233,6 +233,7 @@ support-files = sw_storage_not_allow.js update_worker.sjs self_update_worker.sjs + !/dom/events/test/event_leak_utils.js [test_bug1151916.html] [test_bug1240436.html] diff --git a/dom/serviceworkers/test/test_event_listener_leaks.html b/dom/serviceworkers/test/test_event_listener_leaks.html index a38ce871642c..9406c7327b6f 100644 --- a/dom/serviceworkers/test/test_event_listener_leaks.html +++ b/dom/serviceworkers/test/test_event_listener_leaks.html @@ -8,26 +8,16 @@ Bug 1447871 - Test some service worker leak conditions +

- -

 
+  
+  
+
+
+

+ + + + + From 0b6897561a64578d92630994ba0e25b6f328737f Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Wed, 4 Apr 2018 11:25:42 -0700 Subject: [PATCH 03/88] Bug 1450358 P2 Test AbortSignal for event listener related runtime leaks. r=baku --- dom/abort/tests/mochitest.ini | 2 + .../tests/test_event_listener_leaks.html | 43 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 dom/abort/tests/test_event_listener_leaks.html diff --git a/dom/abort/tests/mochitest.ini b/dom/abort/tests/mochitest.ini index 9817a9e9aa10..a96437d37c60 100644 --- a/dom/abort/tests/mochitest.ini +++ b/dom/abort/tests/mochitest.ini @@ -2,6 +2,8 @@ support-files = worker_abort_controller_fetch.js slow.sjs + !/dom/events/test/event_leak_utils.js [test_abort_controller.html] [test_abort_controller_fetch.html] +[test_event_listener_leaks.html] diff --git a/dom/abort/tests/test_event_listener_leaks.html b/dom/abort/tests/test_event_listener_leaks.html new file mode 100644 index 000000000000..ac2a596b2430 --- /dev/null +++ b/dom/abort/tests/test_event_listener_leaks.html @@ -0,0 +1,43 @@ + + + + + Bug 1450271 - Test AbortSignal event listener leak conditions + + + + + +

+ + + + + From 79bfa1d9c875c6edd005abdce190914901b3a408 Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Wed, 4 Apr 2018 11:25:43 -0700 Subject: [PATCH 04/88] Bug 1450358 P3 Verify that Animation does not leak via event listeners. r=baku --- dom/animation/test/mochitest.ini | 2 + .../mozilla/test_event_listener_leaks.html | 44 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 dom/animation/test/mozilla/test_event_listener_leaks.html diff --git a/dom/animation/test/mochitest.ini b/dom/animation/test/mochitest.ini index aff7b4ead6f1..d8550fa49898 100644 --- a/dom/animation/test/mochitest.ini +++ b/dom/animation/test/mochitest.ini @@ -13,6 +13,7 @@ support-files = mozilla/file_transition_finish_on_compositor.html ../../../layout/style/test/property_database.js testcommon.js + !/dom/events/test/event_leak_utils.js [css-animations/test_animations-dynamic-changes.html] [css-animations/test_animation-cancel.html] @@ -73,6 +74,7 @@ skip-if = webrender # bug 1424752 [mozilla/test_transition_finish_on_compositor.html] skip-if = toolkit == 'android' || webrender # bug 1424752 for webrender [mozilla/test_underlying_discrete_value.html] +[mozilla/test_event_listener_leaks.html] [style/test_animation-seeking-with-current-time.html] [style/test_animation-seeking-with-start-time.html] [style/test_animation-setting-effect.html] diff --git a/dom/animation/test/mozilla/test_event_listener_leaks.html b/dom/animation/test/mozilla/test_event_listener_leaks.html new file mode 100644 index 000000000000..8e5d664ce8c7 --- /dev/null +++ b/dom/animation/test/mozilla/test_event_listener_leaks.html @@ -0,0 +1,44 @@ + + + + + Bug 1450271 - Test Animation event listener leak conditions + + + + + + + + + + From d44ca0b8540c63317a3b2be3eb5e3e103de90c9a Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Wed, 4 Apr 2018 11:25:43 -0700 Subject: [PATCH 05/88] Bug 1450358 P4 Add a MediaQueryList event listener leak test. r=baku --- layout/style/test/mochitest.ini | 2 + .../test/test_mql_event_listener_leaks.html | 43 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 layout/style/test/test_mql_event_listener_leaks.html diff --git a/layout/style/test/mochitest.ini b/layout/style/test/mochitest.ini index 10a915e6de2d..60ef4a575be6 100644 --- a/layout/style/test/mochitest.ini +++ b/layout/style/test/mochitest.ini @@ -11,6 +11,7 @@ support-files = chrome/match.png chrome/mismatch.png descriptor_database.js + !/dom/events/test/event_leak_utils.js empty.html file_computed_style_bfcache_display_none.html file_computed_style_bfcache_display_none2.html @@ -371,3 +372,4 @@ skip-if = toolkit == 'android' # TIMED_OUT for android [test_first_letter_restrictions.html] [test_first_line_restrictions.html] [test_placeholder_restrictions.html] +[test_mql_event_listener_leaks.html] diff --git a/layout/style/test/test_mql_event_listener_leaks.html b/layout/style/test/test_mql_event_listener_leaks.html new file mode 100644 index 000000000000..f4851eab51a5 --- /dev/null +++ b/layout/style/test/test_mql_event_listener_leaks.html @@ -0,0 +1,43 @@ + + + + + Bug 1450271 - Test MediaQueryList event listener leak conditions + + + + + + + + + + From a7d24d8541063508e09f8d86c197439604be5c8b Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Wed, 4 Apr 2018 11:25:43 -0700 Subject: [PATCH 06/88] Bug 1450358 P5 Test EventSource for event listener leaks. r=baku --- dom/base/test/mochitest.ini | 2 + ...test_eventsource_event_listener_leaks.html | 40 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 dom/base/test/test_eventsource_event_listener_leaks.html diff --git a/dom/base/test/mochitest.ini b/dom/base/test/mochitest.ini index a5e8aaa2c9f2..685fecef1091 100644 --- a/dom/base/test/mochitest.ini +++ b/dom/base/test/mochitest.ini @@ -238,6 +238,7 @@ support-files = file4_setting_opener.html PASS.html FAIL.html + !/dom/events/test/event_leak_utils.js [test_anchor_area_referrer.html] [test_anchor_area_referrer_changing.html] @@ -647,6 +648,7 @@ skip-if = toolkit == 'android' #bug 904183 [test_encodeToStringWithRequiresReinitAfterOutput.html] [test_error.html] [test_EventSource_redirects.html] +[test_eventsource_event_listener_leaks.html] [test_explicit_user_agent.html] skip-if = (toolkit == 'android') # Android: Bug 775227 [test_getAttribute_after_createAttribute.html] diff --git a/dom/base/test/test_eventsource_event_listener_leaks.html b/dom/base/test/test_eventsource_event_listener_leaks.html new file mode 100644 index 000000000000..33bddde47ae5 --- /dev/null +++ b/dom/base/test/test_eventsource_event_listener_leaks.html @@ -0,0 +1,40 @@ + + + + + Bug 1450358 - Test EventSource event listener leak conditions + + + + + + + + + From 0e1f0b0b34dfa72fdb60d6d044885cddc261aa65 Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Wed, 4 Apr 2018 11:25:43 -0700 Subject: [PATCH 07/88] Bug 1450358 P6 Add BroadcastChannel event listener leak test. r=baku --- dom/broadcastchannel/tests/mochitest.ini | 2 + .../tests/test_event_listener_leaks.html | 56 +++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 dom/broadcastchannel/tests/test_event_listener_leaks.html diff --git a/dom/broadcastchannel/tests/mochitest.ini b/dom/broadcastchannel/tests/mochitest.ini index fa30a3cca969..87e2c2586f43 100644 --- a/dom/broadcastchannel/tests/mochitest.ini +++ b/dom/broadcastchannel/tests/mochitest.ini @@ -5,6 +5,7 @@ support-files = broadcastchannel_worker.js broadcastchannel_worker_alive.js broadcastchannel_worker_any.js + !/dom/events/test/event_leak_utils.js file_mozbrowser.html file_mozbrowser2.html iframe_mozbrowser.html @@ -21,6 +22,7 @@ support-files = [test_broadcastchannel_worker.html] [test_broadcastchannel_worker_alive.html] [test_bfcache.html] +[test_event_listener_leaks.html] [test_invalidState.html] [test_ordering.html] [test_dataCloning.html] diff --git a/dom/broadcastchannel/tests/test_event_listener_leaks.html b/dom/broadcastchannel/tests/test_event_listener_leaks.html new file mode 100644 index 000000000000..b90f3c7013c9 --- /dev/null +++ b/dom/broadcastchannel/tests/test_event_listener_leaks.html @@ -0,0 +1,56 @@ + + + + + Bug 1450358 - Test BroadcastChannel event listener leak conditions + + + + + + + + + + From 41c2f967ce4cc9c233b0e9a5869e8aea631da0f4 Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Wed, 4 Apr 2018 11:25:43 -0700 Subject: [PATCH 08/88] Bug 1450358 P7 Test MessageChannel for event listener leaks. r=baku --- dom/messagechannel/tests/mochitest.ini | 2 + .../tests/test_event_listener_leaks.html | 51 +++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 dom/messagechannel/tests/test_event_listener_leaks.html diff --git a/dom/messagechannel/tests/mochitest.ini b/dom/messagechannel/tests/mochitest.ini index 67d18d06fb61..dfd96129ab44 100644 --- a/dom/messagechannel/tests/mochitest.ini +++ b/dom/messagechannel/tests/mochitest.ini @@ -9,7 +9,9 @@ support-files = sharedWorker_messageChannel.js sharedWorker2_messageChannel.js iframe_messageChannel_sharedWorker2.html + !/dom/events/test/event_leak_utils.js +[test_event_listener_leaks.html] [test_messageChannel.html] [test_messageChannel_cloning.html] [test_messageChannel_pingpong.html] diff --git a/dom/messagechannel/tests/test_event_listener_leaks.html b/dom/messagechannel/tests/test_event_listener_leaks.html new file mode 100644 index 000000000000..94e31bfdbfe9 --- /dev/null +++ b/dom/messagechannel/tests/test_event_listener_leaks.html @@ -0,0 +1,51 @@ + + + + + Bug 1450358 - Test MessageChannel event listener leak conditions + + + + + + + + + + From 489c37ab4fb033a2f93f20f91a3ba623894ca53a Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Wed, 4 Apr 2018 11:25:43 -0700 Subject: [PATCH 09/88] Bug 1450358 P8 Test that SharedWorker does not leak windows through its event listener. r=baku --- dom/workers/test/mochitest.ini | 2 + ...est_sharedworker_event_listener_leaks.html | 52 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 dom/workers/test/test_sharedworker_event_listener_leaks.html diff --git a/dom/workers/test/mochitest.ini b/dom/workers/test/mochitest.ini index 178424afa98f..087d774a2908 100644 --- a/dom/workers/test/mochitest.ini +++ b/dom/workers/test/mochitest.ini @@ -103,6 +103,7 @@ support-files = !/dom/xhr/tests/subdir/relativeLoad_sub_worker.js !/dom/xhr/tests/subdir/relativeLoad_sub_worker2.js !/dom/xhr/tests/subdir/relativeLoad_sub_import.js + !/dom/events/test/event_leak_utils.js [test_404.html] [test_atob.html] @@ -196,3 +197,4 @@ scheme=https [test_subworkers_suspended.html] skip-if = toolkit == 'android' #bug 1366501 [test_bug1317725.html] +[test_sharedworker_event_listener_leaks.html] diff --git a/dom/workers/test/test_sharedworker_event_listener_leaks.html b/dom/workers/test/test_sharedworker_event_listener_leaks.html new file mode 100644 index 000000000000..ea070fc4c578 --- /dev/null +++ b/dom/workers/test/test_sharedworker_event_listener_leaks.html @@ -0,0 +1,52 @@ + + + + + Bug 1450358 - Test SharedWorker event listener leak conditions + + + + + + + + + + From 1aa7a9218ad73cb3d444173efc97e86df0cb1e03 Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Wed, 4 Apr 2018 13:21:21 -0500 Subject: [PATCH 10/88] Bug 1450800 - Add null check to InternalGCPointerPolicy methods (r=sfink) --HG-- extra : rebase_source : e0e665b0166e89518be6ef851327e503025001f4 --- js/src/gc/Policy.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/js/src/gc/Policy.h b/js/src/gc/Policy.h index f49657501da2..a9f0c390f6e6 100644 --- a/js/src/gc/Policy.h +++ b/js/src/gc/Policy.h @@ -122,11 +122,21 @@ template struct InternalGCPointerPolicy { using Type = typename mozilla::RemovePointer::Type; static T initial() { return nullptr; } - static void preBarrier(T v) { Type::writeBarrierPre(v); } - static void postBarrier(T* vp, T prev, T next) { Type::writeBarrierPost(vp, prev, next); } - static void readBarrier(T v) { Type::readBarrier(v); } + static void preBarrier(T v) { + if (v) + Type::writeBarrierPre(v); + } + static void postBarrier(T* vp, T prev, T next) { + if (*vp) + Type::writeBarrierPost(vp, prev, next); + } + static void readBarrier(T v) { + if (v) + Type::readBarrier(v); + } static void trace(JSTracer* trc, T* vp, const char* name) { - TraceManuallyBarrieredEdge(trc, vp, name); + if (*vp) + TraceManuallyBarrieredEdge(trc, vp, name); } static bool isValid(T v) { return gc::IsCellPointerValidOrNull(v); From ba40ea72e0e6eac79254cc94c32e8f26c1e59e20 Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Wed, 4 Apr 2018 13:23:03 -0500 Subject: [PATCH 11/88] Bug 1450800 - Baldr: don't need HeapPtr for GCVector elements (r=lth) --HG-- extra : rebase_source : b3770eab295820704ccd21ed64f3325ec906b215 --- .../jit-test/tests/wasm/regress/bug1450800.js | 26 +++++++++++++++++++ js/src/wasm/WasmTypes.h | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 js/src/jit-test/tests/wasm/regress/bug1450800.js diff --git a/js/src/jit-test/tests/wasm/regress/bug1450800.js b/js/src/jit-test/tests/wasm/regress/bug1450800.js new file mode 100644 index 000000000000..b1b53c3c8ebf --- /dev/null +++ b/js/src/jit-test/tests/wasm/regress/bug1450800.js @@ -0,0 +1,26 @@ +if (!this.gczeal || !WebAssembly.Global) + quit(); + +gczeal(9, 10); +function wasmEvalText(str, imports) { + let binary = wasmTextToBinary(str); + m = new WebAssembly.Module(binary); + return new WebAssembly.Instance(m, imports); +} +assertEq(wasmEvalText(`(module + (global (import "a" "b") (mut i32)) + (func (export "get") (result i32) get_global 0) +)`, { a: { b: 42 }}).exports.get(), 42); +for (let v of []) {} +function testInitExpr(type, initialValue, nextValue, coercion, assertFunc = assertEq) { + var module = wasmEvalText(`(module + (import "globals" "a" (global ${type})) + (global $glob_imm ${type} (get_global 0)) + (export "global_imm" (global $glob_imm)) + )`, { + globals: { + a: coercion(initialValue) + } + }).exports; +} +testInitExpr('i32', 13, 37, x => x | 0); diff --git a/js/src/wasm/WasmTypes.h b/js/src/wasm/WasmTypes.h index cbac2f1fd16d..3da45cfec887 100644 --- a/js/src/wasm/WasmTypes.h +++ b/js/src/wasm/WasmTypes.h @@ -71,7 +71,7 @@ typedef Handle HandleWasmTableObject; typedef MutableHandle MutableHandleWasmTableObject; class WasmGlobalObject; -typedef GCVector, 8, SystemAllocPolicy> WasmGlobalObjectVector; +typedef GCVector WasmGlobalObjectVector; typedef Rooted RootedWasmGlobalObject; namespace wasm { From 419465b581f3401cc30df7b6cf39553874235206 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 4 Apr 2018 14:39:48 -0400 Subject: [PATCH 12/88] Bug 1085061. Remove the hasXPConnectImpls flag from EventTarget. r=peterv This is the behavior change. The cleanup will be in bug 1085062. --- dom/bindings/Bindings.conf | 6 ------ 1 file changed, 6 deletions(-) diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf index 5771507155ea..45052b16d61f 100644 --- a/dom/bindings/Bindings.conf +++ b/dom/bindings/Bindings.conf @@ -298,12 +298,6 @@ DOMInterfaces = { }, 'EventTarget': { - # When we get rid of hasXPConnectImpls, we can get rid of the - # couldBeDOMBinding stuff in GetOrCreateDOMReflector. - # - # We can also get rid of the UnwrapArg bits in - # the dom QueryInterface (in BindingUtils.cpp) at that point. - 'hasXPConnectImpls': True, 'jsImplParent': 'mozilla::DOMEventTargetHelper', }, From fe15e92e6bcf4ecca0cd6e598a7d45625f7ccbaf Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 4 Apr 2018 14:39:52 -0400 Subject: [PATCH 13/88] Bug 1085062. Remove hasXPConnectImpls support from bindings codegen. r=peterv --- dom/base/nsWrapperCache.h | 4 +- dom/bindings/BindingUtils.cpp | 37 +--------- dom/bindings/BindingUtils.h | 26 +------ dom/bindings/Codegen.py | 135 ++-------------------------------- dom/bindings/Configuration.py | 8 +- 5 files changed, 16 insertions(+), 194 deletions(-) diff --git a/dom/base/nsWrapperCache.h b/dom/base/nsWrapperCache.h index 1323c587d90e..1cd48167a919 100644 --- a/dom/base/nsWrapperCache.h +++ b/dom/base/nsWrapperCache.h @@ -343,7 +343,9 @@ protected: private: // Friend declarations for things that need to be able to call // SetIsNotDOMBinding(). The goal is to get rid of all of these, and - // SetIsNotDOMBinding() too. + // SetIsNotDOMBinding() too. Once that's done, we can remove the + // couldBeDOMBinding bits in DoGetOrCreateDOMReflector, as well as any ither + // consumers of IsDOMBinding(). friend class SandboxPrivate; void SetIsNotDOMBinding() { diff --git a/dom/bindings/BindingUtils.cpp b/dom/bindings/BindingUtils.cpp index 2a5175d40029..b788c920376a 100644 --- a/dom/bindings/BindingUtils.cpp +++ b/dom/bindings/BindingUtils.cpp @@ -1233,8 +1233,7 @@ QueryInterface(JSContext* cx, unsigned argc, JS::Value* vp) // Switch this to UnwrapDOMObjectToISupports once our global objects are // using new bindings. - nsCOMPtr native; - UnwrapArg(cx, obj, getter_AddRefs(native)); + nsCOMPtr native = UnwrapDOMObjectToISupports(obj); if (!native) { return Throw(cx, NS_ERROR_FAILURE); } @@ -3265,40 +3264,6 @@ UnwrapArgImpl(JSContext* cx, return wrappedJS->QueryInterface(iid, ppArg); } -nsresult -UnwrapXPConnectImpl(JSContext* cx, - JS::MutableHandle src, - const nsIID &iid, - void **ppArg) -{ - if (!NS_IsMainThread()) { - return NS_ERROR_NOT_AVAILABLE; - } - - MOZ_ASSERT(src.isObject()); - // Unwrap ourselves, because we're going to want access to the unwrapped - // object. - JS::Rooted obj(cx, - js::CheckedUnwrap(&src.toObject(), - /* stopAtWindowProxy = */ false)); - if (!obj) { - return NS_ERROR_NOT_AVAILABLE; - } - - nsCOMPtr iface = xpc::UnwrapReflectorToISupports(obj); - if (!iface) { - return NS_ERROR_XPC_BAD_CONVERT_JS; - } - - if (NS_FAILED(iface->QueryInterface(iid, ppArg))) { - return NS_ERROR_XPC_BAD_CONVERT_JS; - } - - // Now update our source to keep rooting our object. - src.setObject(*obj); - return NS_OK; -} - nsresult UnwrapWindowProxyImpl(JSContext* cx, JS::Handle src, diff --git a/dom/bindings/BindingUtils.h b/dom/bindings/BindingUtils.h index fd1a8ab9590c..413aed0e425a 100644 --- a/dom/bindings/BindingUtils.h +++ b/dom/bindings/BindingUtils.h @@ -80,29 +80,6 @@ UnwrapArg(JSContext* cx, JS::Handle src, return UnwrapWindowProxyImpl(cx, src, ppArg); } -nsresult -UnwrapXPConnectImpl(JSContext* cx, JS::MutableHandle src, - const nsIID& iid, void** ppArg); - -/* - * Convert a jsval being used as a Web IDL interface implementation to an XPCOM - * pointer; this is only used for Web IDL interfaces that specify - * hasXPConnectImpls. This is not the same as UnwrapArg because caller _can_ - * assume that if unwrapping succeeds "val" will be updated so it's rooting the - * XPCOM pointer. Also, UnwrapXPConnect doesn't need to worry about doing - * XPCWrappedJS things. - * - * val must be an ObjectValue. - */ -template -inline nsresult -UnwrapXPConnect(JSContext* cx, JS::MutableHandle val, - Interface** ppThis) -{ - return UnwrapXPConnectImpl(cx, val, NS_GET_TEMPLATE_IID(Interface), - reinterpret_cast(ppThis)); -} - bool ThrowInvalidThis(JSContext* aCx, const JS::CallArgs& aArgs, bool aSecurityError, const char* aInterfaceName); @@ -1093,7 +1070,8 @@ DoGetOrCreateDOMReflector(JSContext* cx, T* value, { MOZ_ASSERT(value); MOZ_ASSERT_IF(givenProto, js::IsObjectInContextCompartment(givenProto, cx)); - // We can get rid of this when we remove support for hasXPConnectImpls. + // We can get rid of this when we remove support for + // nsWrapperCache::SetIsNotDOMBinding. bool couldBeDOMBinding = CouldBeDOMBinding(value); JSObject* obj = value->GetWrapper(); if (obj) { diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index cc80dfe3672a..3ac05911db47 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -686,11 +686,6 @@ class CGPrototypeJSClass(CGThing): protoGetter=protoGetter) -def NeedsGeneratedHasInstance(descriptor): - assert descriptor.interface.hasInterfaceObject() - return descriptor.hasXPConnectImpls - - def InterfaceObjectProtoGetter(descriptor, forXrays=False): """ Returns a tuple with two elements: @@ -741,9 +736,7 @@ class CGInterfaceObjectJSClass(CGThing): ctorname = "nullptr" else: ctorname = "ThrowingConstructor" - needsHasInstance = ( - not NeedsGeneratedHasInstance(self.descriptor) and - self.descriptor.interface.hasInterfacePrototypeObject()) + needsHasInstance = self.descriptor.interface.hasInterfacePrototypeObject() prototypeID, depth = PrototypeIDAndDepth(self.descriptor) slotCount = "DOM_INTERFACE_SLOTS_BASE" @@ -1106,15 +1099,6 @@ class CGHeaders(CGWrapper): implementationIncludes |= set(self.getDeclarationFilename(i) for i in interfacesImplementingSelf) - # Grab the includes for the things that involve XPCOM interfaces - hasInstanceIncludes = set(self.getDeclarationFilename(d.interface) for d - in descriptors if - d.interface.hasInterfaceObject() and - NeedsGeneratedHasInstance(d) and - d.interface.hasInterfacePrototypeObject()) - if len(hasInstanceIncludes) > 0: - hasInstanceIncludes.add("nsContentUtils.h") - # Now find all the things we'll need as arguments because we # need to wrap or unwrap them. bindingHeaders = set() @@ -1298,7 +1282,6 @@ class CGHeaders(CGWrapper): definePre=_includeString(sorted(set(defineIncludes) | bindingIncludes | bindingHeaders | - hasInstanceIncludes | implementationIncludes))) @staticmethod @@ -1980,52 +1963,6 @@ class CGNamedConstructors(CGThing): namedConstructors=namedConstructors) -class CGHasInstanceHook(CGAbstractStaticMethod): - def __init__(self, descriptor): - args = [Argument('JSContext*', 'cx'), - Argument('unsigned', 'argc'), - Argument('JS::Value*', 'vp')] - assert descriptor.interface.hasInterfaceObject() - assert NeedsGeneratedHasInstance(descriptor) - CGAbstractStaticMethod.__init__(self, descriptor, HASINSTANCE_HOOK_NAME, - 'bool', args) - - def define(self): - return CGAbstractStaticMethod.define(self) - - def definition_body(self): - return self.generate_code() - - def generate_code(self): - return fill( - """ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - if (!args.get(0).isObject()) { - args.rval().setBoolean(false); - return true; - } - - JS::Rooted instance(cx, &args[0].toObject()); - - static_assert(IsBaseOf::value, - "HasInstance only works for nsISupports-based classes."); - - bool ok = InterfaceHasInstance(cx, argc, vp); - if (!ok || args.rval().toBoolean()) { - return ok; - } - - // FIXME Limit this to chrome by checking xpc::AccessCheck::isChrome(obj). - nsCOMPtr native = - xpc::UnwrapReflectorToISupports(js::UncheckedUnwrap(instance, /* stopAtWindowProxy = */ false)); - nsCOMPtr qiResult = do_QueryInterface(native); - args.rval().setBoolean(!!qiResult); - return true; - """, - nativeType=self.descriptor.nativeType, - name=self.descriptor.interface.identifier.name) - - def isChromeOnly(m): return m.getExtendedAttribute("ChromeOnly") @@ -2442,20 +2379,6 @@ class MethodDefiner(PropertyDefiner): "condition": MemberCondition() }) - if (static and - not unforgeable and - descriptor.interface.hasInterfaceObject() and - NeedsGeneratedHasInstance(descriptor)): - self.regular.append({ - "name": "@@hasInstance", - "methodInfo": False, - "nativeName": HASINSTANCE_HOOK_NAME, - "length": 1, - # Flags match those of Function[Symbol.hasInstance] - "flags": "JSPROP_READONLY | JSPROP_PERMANENT", - "condition": MemberCondition() - }) - # Generate the keys/values/entries aliases for value iterables. maplikeOrSetlikeOrIterable = descriptor.interface.maplikeOrSetlikeOrIterable if (not static and @@ -4340,14 +4263,6 @@ class CastableObjectUnwrapper(): "target": target, "codeOnFailure": codeOnFailure, } - # Supporting both the "cross origin object" case and the "has - # XPConnect impls" case at the same time is a pain, so let's - # not do that. That allows us to assume that our source is - # always a Handle or MutableHandle. - if allowCrossOriginObj and descriptor.hasXPConnectImpls: - raise TypeError("Interface %s both allows a cross-origin 'this' " - "and has XPConnect impls. We don't support that" % - descriptor.name) if allowCrossOriginObj: self.substitution["uncheckedObjDecl"] = fill( """ @@ -4368,30 +4283,14 @@ class CastableObjectUnwrapper(): codeOnFailure=(codeOnFailure % { 'securityError': 'true'})) self.substitution["source"] = "maybeUncheckedObj" self.substitution["mutableSource"] = "&maybeUncheckedObj" - # No need to set up xpconnectUnwrap, since it won't be - # used in the allowCrossOriginObj case. else: self.substitution["uncheckedObjDecl"] = "" self.substitution["uncheckedObjGet"] = "" self.substitution["source"] = source self.substitution["mutableSource"] = mutableSource - xpconnectUnwrap = ( - "nsresult rv = UnwrapXPConnect<${type}>(cx, ${mutableSource}, getter_AddRefs(objPtr));\n") - if descriptor.hasXPConnectImpls: - self.substitution["codeOnFailure"] = string.Template( - "RefPtr<${type}> objPtr;\n" + - xpconnectUnwrap + - "if (NS_FAILED(rv)) {\n" - "${indentedCodeOnFailure}" - "}\n" - "// We should have an object\n" - "MOZ_ASSERT(objPtr);\n" - "${target} = objPtr;\n" - ).substitute(self.substitution, - indentedCodeOnFailure=indent(codeOnFailure)) - elif (isCallbackReturnValue == "JSImpl" and - descriptor.interface.isJSImplemented()): + if (isCallbackReturnValue == "JSImpl" and + descriptor.interface.isJSImplemented()): exceptionCode = exceptionCode or codeOnFailure self.substitution["codeOnFailure"] = fill( """ @@ -6835,18 +6734,10 @@ def getWrapTemplateForType(type, descriptorProvider, result, successCode, if isConstructorRetval: wrapArgs += ", desiredProto" wrap = "%s(%s)" % (wrapMethod, wrapArgs) - if not descriptor.hasXPConnectImpls: - # Can only fail to wrap as a new-binding object - # if they already threw an exception. - failed = ("MOZ_ASSERT(JS_IsExceptionPending(cx));\n" + - exceptionCode) - else: - if descriptor.notflattened: - raise TypeError("%s has XPConnect impls but not flattened; " - "fallback won't work correctly" % - descriptor.interface.identifier.name) - # Try old-style wrapping for bindings which might be XPConnect impls. - failed = wrapAndSetPtr("HandleNewBindingWrappingFailure(cx, ${obj}, %s, ${jsvalHandle})" % result) + # Can only fail to wrap as a new-binding object + # if they already threw an exception. + failed = ("MOZ_ASSERT(JS_IsExceptionPending(cx));\n" + + exceptionCode) else: if descriptor.notflattened: getIID = "&NS_GET_IID(%s), " % descriptor.nativeType @@ -9226,12 +9117,6 @@ class CGSpecializedGetter(CGAbstractStaticMethod): nativeName = CGSpecializedGetter.makeNativeName(self.descriptor, self.attr) if self.attr.slotIndices is not None: - if self.descriptor.hasXPConnectImpls: - raise TypeError("Interface '%s' has XPConnect impls, so we " - "can't use our slot for property '%s'!" % - (self.descriptor.interface.identifier.name, - self.attr.identifier.name)) - # We're going to store this return value in a slot on some object, # to cache it. The question is, which object? For dictionary and # sequence return values, we want to use a slot on the Xray expando @@ -12863,12 +12748,6 @@ class CGDescriptor(CGThing): for m in clearableCachedAttrs(descriptor): cgThings.append(CGJSImplClearCachedValueMethod(descriptor, m)) - # Need to output our generated hasinstance bits before - # PropertyArrays tries to use them. - if (descriptor.interface.hasInterfaceObject() and - NeedsGeneratedHasInstance(descriptor)): - cgThings.append(CGHasInstanceHook(descriptor)) - properties = PropertyArrays(descriptor) cgThings.append(CGGeneric(define=str(properties))) cgThings.append(CGNativeProperties(descriptor, properties)) diff --git a/dom/bindings/Configuration.py b/dom/bindings/Configuration.py index 52b378b31ee2..ceef8bc65049 100644 --- a/dom/bindings/Configuration.py +++ b/dom/bindings/Configuration.py @@ -399,8 +399,6 @@ class Descriptor(DescriptorProvider): self.notflattened = desc.get('notflattened', False) self.register = desc.get('register', True) - self.hasXPConnectImpls = desc.get('hasXPConnectImpls', False) - # If we're concrete, we need to crawl our ancestor interfaces and mark # them as having a concrete descendant. self.concrete = (not self.interface.isExternal() and @@ -762,10 +760,10 @@ class Descriptor(DescriptorProvider): Returns true if this descriptor requires generic ops other than GenericBindingMethod/GenericBindingGetter/GenericBindingSetter. - In practice we need to do this if our this value might be an XPConnect - object or if we need to coerce null/undefined to the global. + In practice we need to do this if we need to coerce null/undefined + to the global. """ - return self.hasXPConnectImpls or self.interface.isOnGlobalProtoChain() + return self.interface.isOnGlobalProtoChain() def isGlobal(self): """ From c6d492b79e47d179d7cca43a54b8690ea851b238 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 4 Apr 2018 14:40:01 -0400 Subject: [PATCH 14/88] Bug 1445670. Make sure to clear out the pending request when our image gets blocked by the data document policy. r=jdm --- dom/base/crashtests/1445670.html | 20 ++++++++++++++++++++ dom/base/crashtests/crashtests.list | 1 + dom/base/nsImageLoadingContent.cpp | 5 +++++ 3 files changed, 26 insertions(+) create mode 100644 dom/base/crashtests/1445670.html diff --git a/dom/base/crashtests/1445670.html b/dom/base/crashtests/1445670.html new file mode 100644 index 000000000000..8afbcfbea2d7 --- /dev/null +++ b/dom/base/crashtests/1445670.html @@ -0,0 +1,20 @@ + + + + + + + + + \ No newline at end of file diff --git a/dom/base/crashtests/crashtests.list b/dom/base/crashtests/crashtests.list index 636ce7b89fe1..447196eb1f0c 100644 --- a/dom/base/crashtests/crashtests.list +++ b/dom/base/crashtests/crashtests.list @@ -238,3 +238,4 @@ pref(dom.webcomponents.shadowdom.enabled,false) load 1422931.html pref(dom.webcomponents.shadowdom.enabled,true) load 1419799.html skip-if(!browserIsRemote) pref(dom.webcomponents.customelements.enabled,true) pref(dom.disable_open_during_load,false) load 1419902.html # skip on non e10s loads, Bug 1419902 pref(dom.webcomponents.shadowdom.enabled,true) load 1428053.html +load 1445670.html diff --git a/dom/base/nsImageLoadingContent.cpp b/dom/base/nsImageLoadingContent.cpp index e351d59dfbcd..c9a484fc92d8 100644 --- a/dom/base/nsImageLoadingContent.cpp +++ b/dom/base/nsImageLoadingContent.cpp @@ -927,6 +927,11 @@ nsImageLoadingContent::LoadImage(nsIURI* aNewURI, // Data documents, or documents from DOMParser shouldn't perform image loading. if (aDocument->IsLoadedAsData()) { + // This is the only codepath on which we can reach SetBlockedRequest while + // our pending request exists. Just clear it out here if we do have one. + ClearPendingRequest(NS_BINDING_ABORTED, + Some(OnNonvisible::DISCARD_IMAGES)); + SetBlockedRequest(nsIContentPolicy::REJECT_REQUEST); FireEvent(NS_LITERAL_STRING("error")); From aa63116f80d3bba3ec2798145882ffdad599a9b1 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 4 Apr 2018 14:43:41 -0400 Subject: [PATCH 15/88] Bug 1085062 followup. Actually address the review comments. r=peterv --- dom/base/nsWrapperCache.h | 2 +- dom/bindings/BindingUtils.cpp | 2 -- dom/bindings/Codegen.py | 5 ++--- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/dom/base/nsWrapperCache.h b/dom/base/nsWrapperCache.h index 1cd48167a919..d23c65c08fce 100644 --- a/dom/base/nsWrapperCache.h +++ b/dom/base/nsWrapperCache.h @@ -344,7 +344,7 @@ private: // Friend declarations for things that need to be able to call // SetIsNotDOMBinding(). The goal is to get rid of all of these, and // SetIsNotDOMBinding() too. Once that's done, we can remove the - // couldBeDOMBinding bits in DoGetOrCreateDOMReflector, as well as any ither + // couldBeDOMBinding bits in DoGetOrCreateDOMReflector, as well as any other // consumers of IsDOMBinding(). friend class SandboxPrivate; void SetIsNotDOMBinding() diff --git a/dom/bindings/BindingUtils.cpp b/dom/bindings/BindingUtils.cpp index b788c920376a..c3b50877154e 100644 --- a/dom/bindings/BindingUtils.cpp +++ b/dom/bindings/BindingUtils.cpp @@ -1231,8 +1231,6 @@ QueryInterface(JSContext* cx, unsigned argc, JS::Value* vp) return false; } - // Switch this to UnwrapDOMObjectToISupports once our global objects are - // using new bindings. nsCOMPtr native = UnwrapDOMObjectToISupports(obj); if (!native) { return Throw(cx, NS_ERROR_FAILURE); diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 3ac05911db47..3a0a7b0a969f 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -23,7 +23,6 @@ FINALIZE_HOOK_NAME = '_finalize' OBJECT_MOVED_HOOK_NAME = '_objectMoved' CONSTRUCT_HOOK_NAME = '_constructor' LEGACYCALLER_HOOK_NAME = '_legacycaller' -HASINSTANCE_HOOK_NAME = '_hasInstance' RESOLVE_HOOK_NAME = '_resolve' MAY_RESOLVE_HOOK_NAME = '_mayResolve' NEW_ENUMERATE_HOOK_NAME = '_newEnumerate' @@ -6734,8 +6733,8 @@ def getWrapTemplateForType(type, descriptorProvider, result, successCode, if isConstructorRetval: wrapArgs += ", desiredProto" wrap = "%s(%s)" % (wrapMethod, wrapArgs) - # Can only fail to wrap as a new-binding object - # if they already threw an exception. + # Can only fail to wrap as a new-binding object if they already + # threw an exception. failed = ("MOZ_ASSERT(JS_IsExceptionPending(cx));\n" + exceptionCode) else: From 51864e0561bd2b9c214eca5dc3b6c24dd1d57071 Mon Sep 17 00:00:00 2001 From: Michael Kaply Date: Tue, 3 Apr 2018 15:59:52 -0500 Subject: [PATCH 16/88] Bug 1429179 - Add policy to clear data on shutdown. r=felipe MozReview-Commit-ID: canswg76ZN --- .../components/enterprisepolicies/Policies.jsm | 16 ++++++++++++++++ .../schemas/policies-schema.json | 7 +++++++ .../browser_policies_simple_pref_policies.js | 18 ++++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/browser/components/enterprisepolicies/Policies.jsm b/browser/components/enterprisepolicies/Policies.jsm index e069de672aea..6d60ea7a82e5 100644 --- a/browser/components/enterprisepolicies/Policies.jsm +++ b/browser/components/enterprisepolicies/Policies.jsm @@ -573,6 +573,22 @@ var Policies = { } }, + "SanitizeOnShutdown": { + onBeforeUIStartup(manager, param) { + setAndLockPref("privacy.sanitize.sanitizeOnShutdown", param); + if (param) { + setAndLockPref("privacy.clearOnShutdown.cache", true); + setAndLockPref("privacy.clearOnShutdown.cookies", true); + setAndLockPref("privacy.clearOnShutdown.downloads", true); + setAndLockPref("privacy.clearOnShutdown.formdata", true); + setAndLockPref("privacy.clearOnShutdown.history", true); + setAndLockPref("privacy.clearOnShutdown.sessions", true); + setAndLockPref("privacy.clearOnShutdown.siteSettings", true); + setAndLockPref("privacy.clearOnShutdown.offlineApps", true); + } + } + }, + "SearchBar": { onAllWindowsRestored(manager, param) { // This policy is meant to change the default behavior, not to force it. diff --git a/browser/components/enterprisepolicies/schemas/policies-schema.json b/browser/components/enterprisepolicies/schemas/policies-schema.json index d9dc834d17b4..9dc97b992506 100644 --- a/browser/components/enterprisepolicies/schemas/policies-schema.json +++ b/browser/components/enterprisepolicies/schemas/policies-schema.json @@ -516,6 +516,13 @@ "type": "boolean" }, + "SanitizeOnShutdown": { + "description": "Clears ALL browser data on shutdown.", + "first_available": "60.0", + + "type": "boolean" + }, + "SearchBar": { "description": "Sets the default location of the search bar. Only applies on firtrun, but can be changed.", "first_available": "60.0", diff --git a/browser/components/enterprisepolicies/tests/browser/browser_policies_simple_pref_policies.js b/browser/components/enterprisepolicies/tests/browser/browser_policies_simple_pref_policies.js index e9eefc3c5444..1d63edec9346 100644 --- a/browser/components/enterprisepolicies/tests/browser/browser_policies_simple_pref_policies.js +++ b/browser/components/enterprisepolicies/tests/browser/browser_policies_simple_pref_policies.js @@ -126,6 +126,24 @@ const POLICIES_TESTS = [ "xpinstall.enabled": false, } }, + + // POLICY: SanitizeOnShutdown + { + policies: { + "SanitizeOnShutdown": true, + }, + lockedPrefs: { + "privacy.sanitize.sanitizeOnShutdown": true, + "privacy.clearOnShutdown.cache": true, + "privacy.clearOnShutdown.cookies": true, + "privacy.clearOnShutdown.downloads": true, + "privacy.clearOnShutdown.formdata": true, + "privacy.clearOnShutdown.history": true, + "privacy.clearOnShutdown.sessions": true, + "privacy.clearOnShutdown.siteSettings": true, + "privacy.clearOnShutdown.offlineApps": true, + } + }, ]; add_task(async function test_policy_remember_passwords() { From 5dac44183cf248903cdb6b9f6999a816f240251b Mon Sep 17 00:00:00 2001 From: Kanika Saini Date: Wed, 4 Apr 2018 23:49:22 +0530 Subject: [PATCH 17/88] Bug 1443242 - Disable about:debugging in InstallAddons Policy. r=felipe --- browser/components/enterprisepolicies/Policies.jsm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/browser/components/enterprisepolicies/Policies.jsm b/browser/components/enterprisepolicies/Policies.jsm index 6d60ea7a82e5..e0af21788088 100644 --- a/browser/components/enterprisepolicies/Policies.jsm +++ b/browser/components/enterprisepolicies/Policies.jsm @@ -510,6 +510,9 @@ var Policies = { } if ("Default" in param) { setAndLockPref("xpinstall.enabled", param.Default); + if (!param.Default) { + manager.disallowFeature("about:debugging"); + } } } }, From 63ee85a278a51832687c16b6f79042a44654368b Mon Sep 17 00:00:00 2001 From: Felipe Gomes Date: Wed, 4 Apr 2018 15:56:15 -0300 Subject: [PATCH 18/88] Bug 1450761 - Add pref to disable the Add Exception button on certificate error pages. r=jaws --- browser/base/content/aboutNetError.xhtml | 3 +++ browser/base/content/content.js | 9 +++++-- .../test/about/browser_aboutCertError.js | 24 +++++++++++++++++++ browser/themes/shared/aboutNetError.css | 4 ++++ 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/browser/base/content/aboutNetError.xhtml b/browser/base/content/aboutNetError.xhtml index ddba41c8f702..2682475fb217 100644 --- a/browser/base/content/aboutNetError.xhtml +++ b/browser/base/content/aboutNetError.xhtml @@ -369,6 +369,9 @@ // set the checkbox checkbox.checked = !!options.automatic; } + if (options && options.hideAddExceptionButton) { + document.querySelector(".exceptionDialogButtonContainer").hidden = true; + } }, true, true); let event = new CustomEvent("AboutNetErrorLoad", {bubbles: true}); diff --git a/browser/base/content/content.js b/browser/base/content/content.js index a19360acf661..2a54cf2cb60e 100644 --- a/browser/base/content/content.js +++ b/browser/base/content/content.js @@ -653,8 +653,12 @@ var AboutNetAndCertErrorListener = { // Values for telemtery bins: see TLS_ERROR_REPORT_UI in Histograms.json const TLS_ERROR_REPORT_TELEMETRY_UI_SHOWN = 0; + let hideAddExceptionButton = false; + if (this.isAboutCertError(win.document)) { ClickEventHandler.onCertError(originalTarget, win); + hideAddExceptionButton = + Services.prefs.getBoolPref("security.certerror.hideAddException", false); } if (this.isAboutNetError(win.document)) { let docShell = win.document.docShell; @@ -676,7 +680,8 @@ var AboutNetAndCertErrorListener = { detail: JSON.stringify({ enabled: Services.prefs.getBoolPref("security.ssl.errorReporting.enabled"), changedCertPrefs: this.changedCertPrefs(), - automatic + automatic, + hideAddExceptionButton, }) })); @@ -734,7 +739,7 @@ var ClickEventHandler = { } // Handle click events from about pages - if (event.button == 0) { + if (event.button == 0 && !originalTarget.disabled) { if (AboutNetAndCertErrorListener.isAboutCertError(ownerDoc)) { this.onCertError(originalTarget, ownerDoc.defaultView); return; diff --git a/browser/base/content/test/about/browser_aboutCertError.js b/browser/base/content/test/about/browser_aboutCertError.js index 690e145cc0ce..9ca51ba1fbf8 100644 --- a/browser/base/content/test/about/browser_aboutCertError.js +++ b/browser/base/content/test/about/browser_aboutCertError.js @@ -290,6 +290,9 @@ add_task(async function checkAdvancedDetails() { ok(shortDescText.textContent.includes("expired.example.com"), "Should list hostname in error message."); + let exceptionButton = doc.getElementById("exceptionDialogButton"); + ok(!exceptionButton.disabled, "Exception button is not disabled by default."); + let advancedButton = doc.getElementById("advancedButton"); advancedButton.click(); let el = doc.getElementById("errorCode"); @@ -334,6 +337,27 @@ add_task(async function checkAdvancedDetails() { } }); +add_task(async function checkhideAddExceptionButton() { + info("Loading a bad cert page and verifying the pref security.certerror.hideAddException"); + Services.prefs.setBoolPref("security.certerror.hideAddException", true); + + for (let useFrame of [false, true]) { + let tab = await openErrorPage(BAD_CERT, useFrame); + let browser = tab.linkedBrowser; + + await ContentTask.spawn(browser, {frame: useFrame}, async function({frame}) { + let doc = frame ? content.document.querySelector("iframe").contentDocument : content.document; + + let exceptionButton = doc.querySelector(".exceptionDialogButtonContainer"); + ok(exceptionButton.hidden, "Exception button is hidden."); + }); + + BrowserTestUtils.removeTab(gBrowser.selectedTab); + } + + Services.prefs.clearUserPref("security.certerror.hideAddException"); +}); + add_task(async function checkAdvancedDetailsForHSTS() { info("Loading a bad STS cert page and verifying the advanced details section"); for (let useFrame of [false, true]) { diff --git a/browser/themes/shared/aboutNetError.css b/browser/themes/shared/aboutNetError.css index 013065b991c8..2ea14aff2317 100644 --- a/browser/themes/shared/aboutNetError.css +++ b/browser/themes/shared/aboutNetError.css @@ -161,6 +161,10 @@ span#hostname { padding: 10px; } +.exceptionDialogButtonContainer[hidden] { + display: none; +} + .illustrated #errorPageContainer { min-height: 300px; display: flex; From f24699c29379e8e613f7941076af1e9b3e7181fc Mon Sep 17 00:00:00 2001 From: Felipe Gomes Date: Wed, 4 Apr 2018 15:56:27 -0300 Subject: [PATCH 19/88] Bug 1450761 - Policy to disable the Add Exception button on certificate error pages. r=jaws --- browser/components/enterprisepolicies/Policies.jsm | 4 ++++ .../enterprisepolicies/schemas/policies-schema.json | 4 ++++ .../tests/browser/browser_policies_simple_pref_policies.js | 6 +++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/browser/components/enterprisepolicies/Policies.jsm b/browser/components/enterprisepolicies/Policies.jsm index e0af21788088..1cc825e7ecb4 100644 --- a/browser/components/enterprisepolicies/Policies.jsm +++ b/browser/components/enterprisepolicies/Policies.jsm @@ -301,6 +301,10 @@ var Policies = { "DisableSecurityBypass": { onBeforeUIStartup(manager, param) { + if ("InvalidCertificate" in param) { + setAndLockPref("security.certerror.hideAddException", param.InvalidCertificate); + } + if ("SafeBrowsing" in param) { setAndLockPref("browser.safebrowsing.allowOverride", !param.SafeBrowsing); } diff --git a/browser/components/enterprisepolicies/schemas/policies-schema.json b/browser/components/enterprisepolicies/schemas/policies-schema.json index 9dc97b992506..a5ef46eba63a 100644 --- a/browser/components/enterprisepolicies/schemas/policies-schema.json +++ b/browser/components/enterprisepolicies/schemas/policies-schema.json @@ -247,6 +247,10 @@ "type": "object", "properties": { + "InvalidCertificate": { + "type": "boolean" + }, + "SafeBrowsing": { "type": "boolean" } diff --git a/browser/components/enterprisepolicies/tests/browser/browser_policies_simple_pref_policies.js b/browser/components/enterprisepolicies/tests/browser/browser_policies_simple_pref_policies.js index 1d63edec9346..3a68222c471c 100644 --- a/browser/components/enterprisepolicies/tests/browser/browser_policies_simple_pref_policies.js +++ b/browser/components/enterprisepolicies/tests/browser/browser_policies_simple_pref_policies.js @@ -43,10 +43,14 @@ const POLICIES_TESTS = [ { policies: { "DisableSecurityBypass": { + "InvalidCertificate": true, "SafeBrowsing": true } }, - lockedPrefs: { "browser.safebrowsing.allowOverride": false }, + lockedPrefs: { + "security.certerror.hideAddException": true, + "browser.safebrowsing.allowOverride": false, + }, }, From 811f83e65eae80cf43454f74f0cb59e57a747cbd Mon Sep 17 00:00:00 2001 From: Jason Laster Date: Thu, 22 Mar 2018 20:03:21 -0400 Subject: [PATCH 20/88] Bug 1448431 - Don't pause on console expression exceptions. r=jimb MozReview-Commit-ID: JrQjvtBy3LP --- .../browser_dbg-expressions-error.js | 30 ++----- devtools/server/actors/thread.js | 4 +- .../unit/test_ignore_caught_exceptions.js | 82 ++++++++++-------- .../test_ignore_no_interface_exceptions.js | 86 ++++++++++--------- .../tests/unit/test_pause_exceptions-01.js | 13 +-- .../tests/unit/test_pause_exceptions-02.js | 26 +++--- .../tests/unit/test_pause_exceptions-03.js | 60 +++++++++++++ devtools/server/tests/unit/xpcshell.ini | 1 + 8 files changed, 180 insertions(+), 122 deletions(-) create mode 100644 devtools/server/tests/unit/test_pause_exceptions-03.js diff --git a/devtools/client/debugger/new/test/mochitest/browser_dbg-expressions-error.js b/devtools/client/debugger/new/test/mochitest/browser_dbg-expressions-error.js index afe6baf7ce9a..2ece23457e32 100644 --- a/devtools/client/debugger/new/test/mochitest/browser_dbg-expressions-error.js +++ b/devtools/client/debugger/new/test/mochitest/browser_dbg-expressions-error.js @@ -22,11 +22,11 @@ function getValue(dbg, index) { } async function addExpression(dbg, input) { - info("Adding an expression"); + const evaluation = waitForDispatch(dbg, "EVALUATE_EXPRESSION"); findElementWithSelector(dbg, expressionSelectors.input).focus(); type(dbg, input); pressKey(dbg, "Enter"); - await waitForDispatch(dbg, "EVALUATE_EXPRESSION"); + await evaluation; } async function editExpression(dbg, input) { @@ -40,37 +40,17 @@ async function editExpression(dbg, input) { await evaluation; } -/* - * When we add a bad expression, we'll pause, - * resume, and wait for the expression to finish being evaluated. - */ -async function addBadExpression(dbg, input) { - const evaluation = waitForDispatch(dbg, "EVALUATE_EXPRESSION"); - - findElementWithSelector(dbg, expressionSelectors.input).focus(); - type(dbg, input); - pressKey(dbg, "Enter"); - - await waitForPaused(dbg); - - ok(dbg.selectors.isEvaluatingExpression(dbg.getState())); - await resume(dbg); - await evaluation; -} - add_task(async function() { const dbg = await initDebugger("doc-script-switching.html"); - const onPausedOnException = togglePauseOnExceptions(dbg, true, false); + await togglePauseOnExceptions(dbg, true, false); // add a good expression, 2 bad expressions, and another good one await addExpression(dbg, "location"); - await addBadExpression(dbg, "foo.bar"); - await addBadExpression(dbg, "foo.batt"); + await addExpression(dbg, "foo.bar"); + await addExpression(dbg, "foo.batt"); await addExpression(dbg, "2"); - await onPausedOnException; - // check the value of is(getValue(dbg, 2), "(unavailable)"); is(getValue(dbg, 3), "(unavailable)"); diff --git a/devtools/server/actors/thread.js b/devtools/server/actors/thread.js index 1a40c6d6a7b2..7e8a70fec193 100644 --- a/devtools/server/actors/thread.js +++ b/devtools/server/actors/thread.js @@ -1537,7 +1537,9 @@ const ThreadActor = ActorClassWithSpec(threadSpec, { this.sources.getOriginalLocation(generatedLocation)); const url = originalSourceActor ? originalSourceActor.url : null; - if (this.sources.isBlackBoxed(url)) { + // We ignore sources without a url because we do not + // want to pause at console evaluations or watch expressions. + if (!url || this.sources.isBlackBoxed(url)) { return undefined; } diff --git a/devtools/server/tests/unit/test_ignore_caught_exceptions.js b/devtools/server/tests/unit/test_ignore_caught_exceptions.js index 7ecd71ac0f52..b972d81f45d9 100644 --- a/devtools/server/tests/unit/test_ignore_caught_exceptions.js +++ b/devtools/server/tests/unit/test_ignore_caught_exceptions.js @@ -11,46 +11,52 @@ var gDebuggee; var gClient; -var gThreadClient; function run_test() { - initTestDebuggerServer(); - gDebuggee = addTestGlobal("test-stack"); - gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect().then(function() { - attachTestTabAndResume(gClient, "test-stack", - function(response, tabClient, threadClient) { - gThreadClient = threadClient; - test_pause_frame(); - }); - }); do_test_pending(); -} - -function test_pause_frame() { - gThreadClient.addOneTimeListener("paused", function(event, packet) { - gThreadClient.addOneTimeListener("paused", function(event, packet) { - Assert.equal(packet.why.type, "exception"); - Assert.equal(packet.why.exception, "bar"); - gThreadClient.resume(function() { - finishClient(gClient); - }); - }); - gThreadClient.pauseOnExceptions(true, true); - gThreadClient.resume(); + run_test_with_server(DebuggerServer, function() { + run_test_with_server(WorkerDebuggerServer, do_test_finished); }); - - try { - /* eslint-disable */ - gDebuggee.eval("(" + function () { - debugger; - try { - throw "foo"; - } catch (e) {} - throw "bar"; - } + ")()"); - /* eslint-enable */ - } catch (e) { - /* Empty */ - } +} + +function run_test_with_server(server, callback) { + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-pausing", server); + gClient = new DebuggerClient(server.connectPipe()); + gClient.connect(test_pause_frame); +} + +async function test_pause_frame() { + const [,, threadClient] = await attachTestTabAndResume(gClient, "test-pausing"); + await executeOnNextTickAndWaitForPause(evaluateTestCode, gClient); + + evaluateTestCode(); + + threadClient.pauseOnExceptions(true, true); + await resume(threadClient); + const paused = await waitForPause(gClient); + Assert.equal(paused.why.type, "exception"); + equal(paused.frame.where.line, 6, "paused at throw"); + + await resume(threadClient); + finishClient(gClient); +} + +function evaluateTestCode() { + /* eslint-disable */ + try { + Cu.evalInSandbox(` // 1 + debugger; // 2 + try { // 3 + throw "foo"; // 4 + } catch (e) {} // 5 + throw "bar"; // 6 + `, // 7 + gDebuggee, + "1.8", + "test_pause_exceptions-03.js", + 1 + ); + } catch (e) {} + /* eslint-disable */ } diff --git a/devtools/server/tests/unit/test_ignore_no_interface_exceptions.js b/devtools/server/tests/unit/test_ignore_no_interface_exceptions.js index a15745005d9a..b617c3b05be5 100644 --- a/devtools/server/tests/unit/test_ignore_no_interface_exceptions.js +++ b/devtools/server/tests/unit/test_ignore_no_interface_exceptions.js @@ -10,47 +10,55 @@ var gDebuggee; var gClient; -var gThreadClient; function run_test() { - initTestDebuggerServer(); - gDebuggee = addTestGlobal("test-no-interface"); - gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect().then(function() { - attachTestTabAndResume(gClient, "test-no-interface", - function(response, tabClient, threadClient) { - gThreadClient = threadClient; - test_pause_frame(); - }); - }); do_test_pending(); -} - -function test_pause_frame() { - gThreadClient.pauseOnExceptions(true, false, function() { - gThreadClient.addOneTimeListener("paused", function(event, packet) { - Assert.equal(packet.why.type, "exception"); - Assert.equal(packet.why.exception, 42); - gThreadClient.resume(function() { - finishClient(gClient); - }); - }); - - /* eslint-disable */ - gDebuggee.eval("(" + function () { - function QueryInterface() { - throw Cr.NS_ERROR_NO_INTERFACE; - } - function stopMe() { - throw 42; - } - try { - QueryInterface(); - } catch (e) {} - try { - stopMe(); - } catch (e) {} - } + ")()"); - /* eslint-enable */ + run_test_with_server(DebuggerServer, function() { + run_test_with_server(WorkerDebuggerServer, do_test_finished); }); } + +function run_test_with_server(server, callback) { + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-pausing", server); + gClient = new DebuggerClient(server.connectPipe()); + gClient.connect(test_pause_frame); +} + +async function test_pause_frame() { + const [,, threadClient] = await attachTestTabAndResume(gClient, "test-pausing"); + + await threadClient.pauseOnExceptions(true, false); + await executeOnNextTickAndWaitForPause(evaluateTestCode, gClient); + + await resume(threadClient); + const paused = await waitForPause(gClient); + Assert.equal(paused.why.type, "exception"); + equal(paused.frame.where.line, 12, "paused at throw"); + + await resume(threadClient); + finishClient(gClient); +} + +function evaluateTestCode() { + /* eslint-disable */ + Cu.evalInSandbox(` // 1 + function QueryInterface() { // 2 + throw Cr.NS_ERROR_NO_INTERFACE; // 3 + } // 4 + function stopMe() { // 5 + throw 42; // 6 + } // 7 + try { // 8 + QueryInterface(); // 9 + } catch (e) {} // 10 + try { // 11 + stopMe(); // 12 + } catch (e) {}`, // 13 + gDebuggee, + "1.8", + "test_ignore_no_interface_exceptions.js", + 1 + ); + /* eslint-disable */ +} diff --git a/devtools/server/tests/unit/test_pause_exceptions-01.js b/devtools/server/tests/unit/test_pause_exceptions-01.js index e22f35cdfb1f..23d9eb63c0c5 100644 --- a/devtools/server/tests/unit/test_pause_exceptions-01.js +++ b/devtools/server/tests/unit/test_pause_exceptions-01.js @@ -30,12 +30,11 @@ function run_test() { function test_pause_frame() { gThreadClient.addOneTimeListener("paused", function(event, packet) { gThreadClient.addOneTimeListener("paused", function(event, packet) { - Assert.equal(packet.why.type, "exception"); - Assert.equal(packet.why.exception, 42); - gThreadClient.resume(function() { - finishClient(gClient); - }); + Assert.equal(packet.why.type, "debuggerStatement"); + Assert.equal(packet.frame.where.line, 9); + gThreadClient.resume(() => finishClient(gClient)); }); + gThreadClient.pauseOnExceptions(true); gThreadClient.resume(); }); @@ -48,7 +47,9 @@ function test_pause_frame() { } try { stopMe(); - } catch (e) {} + } catch (e) { + debugger + } } + ")()"); /* eslint-enable */ } diff --git a/devtools/server/tests/unit/test_pause_exceptions-02.js b/devtools/server/tests/unit/test_pause_exceptions-02.js index 23e23ef690ef..a9174c83686c 100644 --- a/devtools/server/tests/unit/test_pause_exceptions-02.js +++ b/devtools/server/tests/unit/test_pause_exceptions-02.js @@ -5,7 +5,7 @@ /** * Test that setting pauseOnExceptions to true when the debugger isn't in a - * paused state will cause the debuggee to pause when an exceptions is thrown. + * paused state will not cause the debuggee to pause when an exceptions is thrown. */ var gDebuggee; @@ -29,21 +29,21 @@ function run_test() { function test_pause_frame() { gThreadClient.pauseOnExceptions(true, false, function() { gThreadClient.addOneTimeListener("paused", function(event, packet) { - Assert.equal(packet.why.type, "exception"); - Assert.equal(packet.why.exception, 42); - gThreadClient.resume(function() { - finishClient(gClient); - }); + Assert.equal(packet.why.type, "debuggerStatement"); + Assert.equal(packet.frame.where.line, 8); + gThreadClient.resume(() => finishClient(gClient)); }); /* eslint-disable */ - gDebuggee.eval("(" + function () { - function stopMe() { - throw 42; - } - try { - stopMe(); - } catch (e) {} + gDebuggee.eval("(" + function () { // 1 + function stopMe() { // 2 + throw 42; // 3 + } // 4 + try { // 5 + stopMe(); // 6 + } catch (e) { // 7 + debugger; // 8 + } // 9 } + ")()"); /* eslint-enable */ }); diff --git a/devtools/server/tests/unit/test_pause_exceptions-03.js b/devtools/server/tests/unit/test_pause_exceptions-03.js new file mode 100644 index 000000000000..37c87a678f7b --- /dev/null +++ b/devtools/server/tests/unit/test_pause_exceptions-03.js @@ -0,0 +1,60 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow */ + +"use strict"; + +/** + * Test that setting pauseOnExceptions to true will cause the debuggee to pause + * when an exception is thrown. + */ + +var gDebuggee; +var gClient; + +function run_test() { + do_test_pending(); + run_test_with_server(DebuggerServer, function() { + run_test_with_server(WorkerDebuggerServer, do_test_finished); + }); +} + +function run_test_with_server(server, callback) { + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-pausing", server); + gClient = new DebuggerClient(server.connectPipe()); + gClient.connect(test_pause_frame); +} + +async function test_pause_frame() { + const [,, threadClient] = await attachTestTabAndResume(gClient, "test-pausing"); + await executeOnNextTickAndWaitForPause(evaluateTestCode, gClient); + + threadClient.pauseOnExceptions(true); + await resume(threadClient); + const paused = await waitForPause(gClient); + Assert.equal(paused.why.type, "exception"); + equal(paused.frame.where.line, 4, "paused at throw"); + + await resume(threadClient); + finishClient(gClient); +} + +function evaluateTestCode() { + /* eslint-disable */ + Cu.evalInSandbox( + ` // 1 + function stopMe() { // 2 + debugger; // 3 + throw 42; // 4 + } // 5 + try { // 6 + stopMe(); // 7 + } catch (e) {}`, // 8 + gDebuggee, + "1.8", + "test_pause_exceptions-03.js", + 1 + ); + /* eslint-disable */ +} \ No newline at end of file diff --git a/devtools/server/tests/unit/xpcshell.ini b/devtools/server/tests/unit/xpcshell.ini index a24b8f3bdc7b..2f873f70a39a 100644 --- a/devtools/server/tests/unit/xpcshell.ini +++ b/devtools/server/tests/unit/xpcshell.ini @@ -198,6 +198,7 @@ reason = bug 1104838 [test_framebindings-07.js] [test_pause_exceptions-01.js] [test_pause_exceptions-02.js] +[test_pause_exceptions-03.js] [test_longstringactor.js] [test_longstringgrips-01.js] [test_longstringgrips-02.js] From eb4b0ebf2fa638f398b545c907fa77482cbcc5fd Mon Sep 17 00:00:00 2001 From: Felipe Gomes Date: Wed, 4 Apr 2018 16:22:24 -0300 Subject: [PATCH 21/88] Bug 1429161. Policy follow-up: hide instead of disabling the Forget button. r=jaws --- browser/components/customizableui/CustomizableWidgets.jsm | 1 - browser/components/enterprisepolicies/Policies.jsm | 2 +- .../browser_policy_disable_forgetbutton.js | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/browser/components/customizableui/CustomizableWidgets.jsm b/browser/components/customizableui/CustomizableWidgets.jsm index 00a9eb23cea8..657c5db7b7cb 100644 --- a/browser/components/customizableui/CustomizableWidgets.jsm +++ b/browser/components/customizableui/CustomizableWidgets.jsm @@ -804,7 +804,6 @@ if (Services.prefs.getBoolPref("privacy.panicButton.enabled")) { id: "panic-button", type: "view", viewId: "PanelUI-panicView", - disabled: !Services.policies.isAllowed("panicButton"), forgetButtonCalled(aEvent) { let doc = aEvent.target.ownerDocument; diff --git a/browser/components/enterprisepolicies/Policies.jsm b/browser/components/enterprisepolicies/Policies.jsm index 1cc825e7ecb4..21e1afb2bf4b 100644 --- a/browser/components/enterprisepolicies/Policies.jsm +++ b/browser/components/enterprisepolicies/Policies.jsm @@ -260,7 +260,7 @@ var Policies = { "DisableForgetButton": { onProfileAfterChange(manager, param) { if (param) { - manager.disallowFeature("panicButton"); + setAndLockPref("privacy.panicButton.enabled", false); } } }, diff --git a/browser/components/enterprisepolicies/tests/browser/disable_forget_button/browser_policy_disable_forgetbutton.js b/browser/components/enterprisepolicies/tests/browser/disable_forget_button/browser_policy_disable_forgetbutton.js index 2e2b5d5bfd08..723aad5d756f 100644 --- a/browser/components/enterprisepolicies/tests/browser/disable_forget_button/browser_policy_disable_forgetbutton.js +++ b/browser/components/enterprisepolicies/tests/browser/disable_forget_button/browser_policy_disable_forgetbutton.js @@ -5,5 +5,5 @@ add_task(async function test_policy_disable_forget_button() { let widget = CustomizableUI.getWidget("panic-button"); - is(widget.disabled, true, "Forget Button is disabled"); + isnot(widget.type, "view", "Forget Button was not created"); }); From aeee824925aa5d34c78f718ed178324c59fa5c5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Qu=C3=A8ze?= Date: Wed, 4 Apr 2018 21:29:16 +0200 Subject: [PATCH 22/88] Bug 1449925 - make the --private command line parameter work when browser.startup.blankWindow is true, r=Ehsan. --- browser/components/nsBrowserContentHandler.js | 12 +++++++++--- docshell/base/nsDocShell.cpp | 7 ------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/browser/components/nsBrowserContentHandler.js b/browser/components/nsBrowserContentHandler.js index 9c474ecd137b..a3df75f75681 100644 --- a/browser/components/nsBrowserContentHandler.js +++ b/browser/components/nsBrowserContentHandler.js @@ -213,9 +213,6 @@ function openBrowserWindow(cmdLine, urlOrUrlList, postData = null, win.document.documentElement.removeAttribute("windowtype"); if (forcePrivate) { - // This causes a "Only internal code is allowed to set the - // usePrivateBrowsing attribute" warning in the Browser Console. - // Still better than having a white window that flickers. win.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIWebNavigation) .QueryInterface(Ci.nsILoadContext) @@ -418,6 +415,15 @@ nsBrowserContentHandler.prototype = { // PB builds. if (cmdLine.handleFlag("private", false) && PrivateBrowsingUtils.enabled) { PrivateBrowsingUtils.enterTemporaryAutoStartMode(); + if (cmdLine.state == nsICommandLine.STATE_INITIAL_LAUNCH) { + let win = Services.wm.getMostRecentWindow("navigator:blank"); + if (win) { + win.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsILoadContext) + .usePrivateBrowsing = true; + } + } } if (cmdLine.handleFlag("setDefaultBrowser", false)) { ShellService.setDefaultBrowser(true, true); diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index d3c3fcde4c79..027161527cc0 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -112,7 +112,6 @@ #include "nsIPromptFactory.h" #include "nsIReflowObserver.h" #include "nsIScriptChannel.h" -#include "nsIScriptError.h" #include "nsIScriptObjectPrincipal.h" #include "nsIScriptSecurityManager.h" #include "nsIScrollableFrame.h" @@ -1732,12 +1731,6 @@ nsDocShell::GetUsePrivateBrowsing(bool* aUsePrivateBrowsing) NS_IMETHODIMP nsDocShell::SetUsePrivateBrowsing(bool aUsePrivateBrowsing) { - nsContentUtils::ReportToConsoleNonLocalized( - NS_LITERAL_STRING("Only internal code is allowed to set the usePrivateBrowsing attribute"), - nsIScriptError::warningFlag, - NS_LITERAL_CSTRING("Internal API Used"), - mContentViewer ? mContentViewer->GetDocument() : nullptr); - if (!CanSetOriginAttributes()) { bool changed = aUsePrivateBrowsing != (mPrivateBrowsingId > 0); From 2c63cffb46480ffb619d5cfd922bc488a3e261d9 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 4 Apr 2018 15:32:19 -0400 Subject: [PATCH 23/88] Bug 1447454. Stop allowing implicit downcasts in StrongOrRawPtr. r=peterv MozReview-Commit-ID: BSXp3ThY1dC --- dom/bindings/BindingUtils.h | 2 +- dom/events/TouchEvent.cpp | 2 +- dom/events/TouchEvent.h | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dom/bindings/BindingUtils.h b/dom/bindings/BindingUtils.h index 413aed0e425a..55d8fecf8d45 100644 --- a/dom/bindings/BindingUtils.h +++ b/dom/bindings/BindingUtils.h @@ -3313,7 +3313,7 @@ template inline RefPtr StrongOrRawPtr(already_AddRefed&& aPtr) { - return aPtr.template downcast(); + return Move(aPtr); } template +already_AddRefed TouchEvent::Constructor(const GlobalObject& aGlobal, const nsAString& aType, const TouchEventInit& aParam, diff --git a/dom/events/TouchEvent.h b/dom/events/TouchEvent.h index bcf4a9a30a8a..90364d8d6afc 100644 --- a/dom/events/TouchEvent.h +++ b/dom/events/TouchEvent.h @@ -120,10 +120,10 @@ public: static bool PrefEnabled(JSContext* aCx, JSObject* aGlobal); static bool PrefEnabled(nsIDocShell* aDocShell); - static already_AddRefed Constructor(const GlobalObject& aGlobal, - const nsAString& aType, - const TouchEventInit& aParam, - ErrorResult& aRv); + static already_AddRefed Constructor(const GlobalObject& aGlobal, + const nsAString& aType, + const TouchEventInit& aParam, + ErrorResult& aRv); protected: ~TouchEvent() {} From b8083056040b70fc12df17308e47c0a2550341cb Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 4 Apr 2018 15:32:19 -0400 Subject: [PATCH 24/88] Bug 1450182. Remove the EventListenerWasAdded/Removed hooks from DOMEventTargetHelper. r=smaug MozReview-Commit-ID: GWnAvK61hVT --- dom/bindings/Codegen.py | 71 ++++++++++++++++++++++---- dom/bindings/parser/WebIDL.py | 1 + dom/events/DOMEventTargetHelper.cpp | 6 --- dom/events/DOMEventTargetHelper.h | 7 --- dom/events/EventTarget.h | 11 +++- dom/webidl/AddonManager.webidl | 9 +--- toolkit/mozapps/extensions/amWebAPI.js | 4 +- 7 files changed, 76 insertions(+), 33 deletions(-) diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 3a0a7b0a969f..041b6b337c59 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -15301,13 +15301,6 @@ class CGJSImplMethod(CGJSImplMember): interface. """ def __init__(self, descriptor, method, signature, isConstructor, breakAfter=True): - virtual = False - override = False - if (method.identifier.name == "eventListenerWasAdded" or - method.identifier.name == "eventListenerWasRemoved"): - virtual = True - override = True - self.signature = signature self.descriptor = descriptor self.isConstructor = isConstructor @@ -15318,9 +15311,7 @@ class CGJSImplMethod(CGJSImplMember): descriptor.getExtendedAttributes(method), breakAfter=breakAfter, variadicIsSequence=True, - passJSBitsAsNeeded=False, - virtual=virtual, - override=override) + passJSBitsAsNeeded=False) def getArgs(self, returnType, argList): if self.isConstructor: @@ -15540,6 +15531,15 @@ class CGJSImplClass(CGBindingImplClass): ccDecl=ccDecl, jsImplName=jsImplName(descriptor.name)) + if descriptor.interface.getExtendedAttribute("WantsEventListenerHooks"): + # No need to do too much sanity checking here; the + # generated code will fail to compile if the methods we + # try to overrid aren't on a superclass. + self.methodDecls.extend( + self.getEventHookMethod(parentClass, "EventListenerAdded")) + self.methodDecls.extend( + self.getEventHookMethod(parentClass, "EventListenerRemoved")) + if descriptor.interface.hasChildInterfaces(): decorators = "" # We need a protected virtual destructor our subclasses can use @@ -15668,6 +15668,22 @@ class CGJSImplClass(CGBindingImplClass): ifaceName=self.descriptor.interface.identifier.name, implName=self.descriptor.name) + def getEventHookMethod(self, parentClass, methodName): + body = fill( + """ + ${parentClass}::${methodName}(aType); + mImpl->${methodName}(Substring(nsDependentAtomString(aType), 2), IgnoreErrors()); + """, + parentClass=parentClass, + methodName=methodName) + return [ClassMethod(methodName, + "void", + [Argument("nsAtom*", "aType")], + virtual=True, + override=True, + body=body), + ClassUsingDeclaration(parentClass, methodName)] + def isJSImplementedDescriptor(descriptorProvider): return (isinstance(descriptorProvider, Descriptor) and @@ -15980,6 +15996,16 @@ class CGCallbackInterface(CGCallback): idlist.append("__init") if needOnGetId: idlist.append("__onget") + + if (iface.isJSImplemented() and + iface.getExtendedAttribute("WantsEventListenerHooks")): + methods.append(CGJSImplEventHookOperation(descriptor, + "eventListenerAdded")) + methods.append(CGJSImplEventHookOperation(descriptor, + "eventListenerRemoved")) + idlist.append("eventListenerAdded") + idlist.append("eventListenerRemoved") + if len(idlist) != 0: methods.append(initIdsClassMethod(idlist, iface.identifier.name + "Atoms")) @@ -16525,6 +16551,27 @@ class CGJSImplOnGetOperation(CallbackOperationBase): def getPrettyName(self): return "__onget" +class CGJSImplEventHookOperation(CallbackOperationBase): + """ + Codegen the hooks on a JS impl for adding/removing event listeners. + """ + def __init__(self, descriptor, name): + self.name = name + + CallbackOperationBase.__init__( + self, + (BuiltinTypes[IDLBuiltinType.Types.void], + [FakeArgument(BuiltinTypes[IDLBuiltinType.Types.domstring], + None, + "aType")]), + name, MakeNativeName(name), + descriptor, + singleOperation=False, + rethrowContentException=False, + spiderMonkeyInterfacesAreStructs=True) + + def getPrettyName(self): + return self.name def getMaplikeOrSetlikeErrorReturn(helperImpl): """ @@ -17127,6 +17174,10 @@ class GlobalGenRoots(): d.interface.maplikeOrSetlikeOrIterable.isMaplike()): # We'll have an __onget() method. members.append(FakeMember('__onget')) + if (d.interface.isJSImplemented() and + d.interface.getExtendedAttribute("WantsEventListenerHooks")): + members.append(FakeMember('eventListenerAdded')) + members.append(FakeMember('eventListenerRemoved')) if len(members) == 0: continue diff --git a/dom/bindings/parser/WebIDL.py b/dom/bindings/parser/WebIDL.py index b93ab56ac257..ac89f1498fcc 100644 --- a/dom/bindings/parser/WebIDL.py +++ b/dom/bindings/parser/WebIDL.py @@ -1744,6 +1744,7 @@ class IDLInterface(IDLInterfaceOrNamespace): identifier == "ProbablyShortLivingWrapper" or identifier == "LegacyUnenumerableNamedProperties" or identifier == "RunConstructorInCallerCompartment" or + identifier == "WantsEventListenerHooks" or identifier == "NonOrdinaryGetPrototypeOf"): # Known extended attributes that do not take values if not attr.noArguments(): diff --git a/dom/events/DOMEventTargetHelper.cpp b/dom/events/DOMEventTargetHelper.cpp index 715d3371badb..3412f7906c1a 100644 --- a/dom/events/DOMEventTargetHelper.cpp +++ b/dom/events/DOMEventTargetHelper.cpp @@ -347,30 +347,24 @@ DOMEventTargetHelper::WantsUntrusted(bool* aRetVal) void DOMEventTargetHelper::EventListenerAdded(nsAtom* aType) { - EventListenerWasAdded(Substring(nsDependentAtomString(aType), 2), - IgnoreErrors()); MaybeUpdateKeepAlive(); } void DOMEventTargetHelper::EventListenerAdded(const nsAString& aType) { - EventListenerWasAdded(aType, IgnoreErrors()); MaybeUpdateKeepAlive(); } void DOMEventTargetHelper::EventListenerRemoved(nsAtom* aType) { - EventListenerWasRemoved(Substring(nsDependentAtomString(aType), 2), - IgnoreErrors()); MaybeUpdateKeepAlive(); } void DOMEventTargetHelper::EventListenerRemoved(const nsAString& aType) { - EventListenerWasRemoved(aType, IgnoreErrors()); MaybeUpdateKeepAlive(); } diff --git a/dom/events/DOMEventTargetHelper.h b/dom/events/DOMEventTargetHelper.h index ccb939b0ceed..703bc5238f63 100644 --- a/dom/events/DOMEventTargetHelper.h +++ b/dom/events/DOMEventTargetHelper.h @@ -156,13 +156,6 @@ public: virtual void EventListenerRemoved(nsAtom* aType) override; virtual void EventListenerRemoved(const nsAString& aType) override; - virtual void EventListenerWasAdded(const nsAString& aType, - ErrorResult& aRv, - JSCompartment* aCompartment = nullptr) {} - virtual void EventListenerWasRemoved(const nsAString& aType, - ErrorResult& aRv, - JSCompartment* aCompartment = nullptr) {} - // Dispatch a trusted, non-cancellable and non-bubbling event to |this|. nsresult DispatchTrustedEvent(const nsAString& aEventName); protected: diff --git a/dom/events/EventTarget.h b/dom/events/EventTarget.h index 379a0851fff1..13bb67f2086c 100644 --- a/dom/events/EventTarget.h +++ b/dom/events/EventTarget.h @@ -76,10 +76,19 @@ public: void SetEventHandler(const nsAString& aType, EventHandlerNonNull* aHandler, ErrorResult& rv); - // Note, for an event 'foo' aType will be 'onfoo'. + // The nsAtom version of EventListenerAdded is called on the main + // thread. The string version is called on workers. + // + // For an event 'foo' aType will be 'onfoo' when it's an atom and + // 'foo' when it's a string.. virtual void EventListenerAdded(nsAtom* aType) {} virtual void EventListenerAdded(const nsAString& aType) {} + // The nsAtom version of EventListenerRemoved is called on the main + // thread. The string version is called on workers. + // + // For an event 'foo' aType will be 'onfoo' when it's an atom and + // 'foo' when it's a string.. virtual void EventListenerRemoved(nsAtom* aType) {} virtual void EventListenerRemoved(const nsAString& aType) {} diff --git a/dom/webidl/AddonManager.webidl b/dom/webidl/AddonManager.webidl index c6f6d1668260..0fb9cf3925ee 100644 --- a/dom/webidl/AddonManager.webidl +++ b/dom/webidl/AddonManager.webidl @@ -57,7 +57,8 @@ dictionary addonInstallOptions { [HeaderFile="mozilla/AddonManagerWebAPI.h", Func="mozilla::AddonManagerWebAPI::IsAPIEnabled", NavigatorProperty="mozAddonManager", - JSImplementation="@mozilla.org/addon-web-api/manager;1"] + JSImplementation="@mozilla.org/addon-web-api/manager;1", + WantsEventListenerHooks] interface AddonManager : EventTarget { /** * Gets information about an add-on @@ -79,12 +80,6 @@ interface AddonManager : EventTarget { // Indicator to content whether permissions prompts are enabled readonly attribute boolean permissionPromptsEnabled; - - /* Hooks for managing event listeners */ - [ChromeOnly] - void eventListenerWasAdded(DOMString type); - [ChromeOnly] - void eventListenerWasRemoved(DOMString type); }; [ChromeOnly,Exposed=System,HeaderFile="mozilla/AddonManagerWebAPI.h"] diff --git a/toolkit/mozapps/extensions/amWebAPI.js b/toolkit/mozapps/extensions/amWebAPI.js index 504193bd6214..f4ec1ed19254 100644 --- a/toolkit/mozapps/extensions/amWebAPI.js +++ b/toolkit/mozapps/extensions/amWebAPI.js @@ -243,7 +243,7 @@ class WebAPI extends APIObject { return WEBEXT_PERMISSION_PROMPTS; } - eventListenerWasAdded(type) { + eventListenerAdded(type) { if (this.listenerCount == 0) { this.broker.setAddonListener(data => { let event = new this.window.AddonEvent(data.event, data); @@ -253,7 +253,7 @@ class WebAPI extends APIObject { this.listenerCount++; } - eventListenerWasRemoved(type) { + eventListenerRemoved(type) { this.listenerCount--; if (this.listenerCount == 0) { this.broker.setAddonListener(null); From 5ae156397883ff1ee431c4be1d88fe7b631ab394 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 4 Apr 2018 15:32:19 -0400 Subject: [PATCH 25/88] Bug 1450422. Get rid of nsIDOMDataChannel. r=mystor MozReview-Commit-ID: Dei5EEd0FZO --- dom/base/moz.build | 1 - dom/base/nsDOMDataChannel.cpp | 14 +++----------- dom/base/nsDOMDataChannel.h | 3 --- dom/base/nsDOMDataChannelDeclarations.h | 7 ++----- dom/base/nsIDOMDataChannel.idl | 10 ---------- dom/media/bridge/IPeerConnection.idl | 2 -- .../src/peerconnection/PeerConnectionImpl.cpp | 19 ++++++++----------- media/webrtc/signaling/test/FakePCObserver.h | 4 ++-- .../signaling/test/signaling_unittests.cpp | 4 ++-- xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp | 9 --------- 10 files changed, 17 insertions(+), 56 deletions(-) delete mode 100644 dom/base/nsIDOMDataChannel.idl diff --git a/dom/base/moz.build b/dom/base/moz.build index 796b8be5f228..5ab6c7b86003 100644 --- a/dom/base/moz.build +++ b/dom/base/moz.build @@ -16,7 +16,6 @@ XPIDL_SOURCES += [ 'mozIDOMWindow.idl', 'nsIContentPolicy.idl', 'nsIDocumentEncoder.idl', - 'nsIDOMDataChannel.idl', 'nsIDOMDOMCursor.idl', 'nsIDOMDOMRequest.idl', 'nsIDOMParser.idl', diff --git a/dom/base/nsDOMDataChannel.cpp b/dom/base/nsDOMDataChannel.cpp index b6d9d2cd9de0..aa5881f55664 100644 --- a/dom/base/nsDOMDataChannel.cpp +++ b/dom/base/nsDOMDataChannel.cpp @@ -11,7 +11,6 @@ #include "nsDOMDataChannelDeclarations.h" #include "nsDOMDataChannel.h" -#include "nsIDOMDataChannel.h" #include "mozilla/DOMEventTargetHelper.h" #include "mozilla/dom/File.h" #include "mozilla/dom/MessageEvent.h" @@ -69,7 +68,6 @@ NS_IMPL_ADDREF_INHERITED(nsDOMDataChannel, DOMEventTargetHelper) NS_IMPL_RELEASE_INHERITED(nsDOMDataChannel, DOMEventTargetHelper) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMDataChannel) - NS_INTERFACE_MAP_ENTRY(nsIDOMDataChannel) NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper) nsDOMDataChannel::nsDOMDataChannel(already_AddRefed& aDataChannel, @@ -535,7 +533,7 @@ nsDOMDataChannel::EventListenerRemoved(nsAtom* aType) nsresult NS_NewDOMDataChannel(already_AddRefed&& aDataChannel, nsPIDOMWindowInner* aWindow, - nsIDOMDataChannel** aDomDataChannel) + nsDOMDataChannel** aDomDataChannel) { RefPtr domdc = new nsDOMDataChannel(aDataChannel, aWindow); @@ -543,12 +541,6 @@ NS_NewDOMDataChannel(already_AddRefed&& aDataChannel, nsresult rv = domdc->Init(aWindow); NS_ENSURE_SUCCESS(rv,rv); - return CallQueryInterface(domdc, aDomDataChannel); -} - -/* static */ -void -NS_DataChannelAppReady(nsIDOMDataChannel* aDomDataChannel) -{ - ((nsDOMDataChannel *)aDomDataChannel)->AppReady(); + domdc.forget(aDomDataChannel); + return NS_OK; } diff --git a/dom/base/nsDOMDataChannel.h b/dom/base/nsDOMDataChannel.h index c2f058624135..c66aea60de4a 100644 --- a/dom/base/nsDOMDataChannel.h +++ b/dom/base/nsDOMDataChannel.h @@ -12,7 +12,6 @@ #include "mozilla/dom/RTCDataChannelBinding.h" #include "mozilla/dom/TypedArray.h" #include "mozilla/net/DataChannelListener.h" -#include "nsIDOMDataChannel.h" #include "nsIInputStream.h" @@ -25,7 +24,6 @@ class DataChannel; }; class nsDOMDataChannel final : public mozilla::DOMEventTargetHelper, - public nsIDOMDataChannel, public mozilla::DataChannelListener { public: @@ -35,7 +33,6 @@ public: nsresult Init(nsPIDOMWindowInner* aDOMWindow); NS_DECL_ISUPPORTS_INHERITED - NS_DECL_NSIDOMDATACHANNEL NS_REALLY_FORWARD_NSIDOMEVENTTARGET(mozilla::DOMEventTargetHelper) diff --git a/dom/base/nsDOMDataChannelDeclarations.h b/dom/base/nsDOMDataChannelDeclarations.h index 416561fcb776..acc2e81a57c2 100644 --- a/dom/base/nsDOMDataChannelDeclarations.h +++ b/dom/base/nsDOMDataChannelDeclarations.h @@ -11,20 +11,17 @@ // gets used with MOZ_INTERNAL_API not set for media/webrtc/signaling/testing #include "nsCOMPtr.h" -#include "nsIDOMDataChannel.h" namespace mozilla { class DataChannel; } +class nsDOMDataChannel; class nsPIDOMWindowInner; nsresult NS_NewDOMDataChannel(already_AddRefed&& dataChannel, nsPIDOMWindowInner* aWindow, - nsIDOMDataChannel** domDataChannel); - -// Tell DataChannel it's ok to deliver open and message events -void NS_DataChannelAppReady(nsIDOMDataChannel* domDataChannel); + nsDOMDataChannel** domDataChannel); #endif // nsDOMDataChannelDeclarations_h diff --git a/dom/base/nsIDOMDataChannel.idl b/dom/base/nsIDOMDataChannel.idl deleted file mode 100644 index 53fa124d291c..000000000000 --- a/dom/base/nsIDOMDataChannel.idl +++ /dev/null @@ -1,10 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsIDOMEventTarget.idl" - -[builtinclass, uuid(b00a4ca7-312e-4926-84f6-8ebb43e53d83)] -interface nsIDOMDataChannel : nsIDOMEventTarget -{ -}; diff --git a/dom/media/bridge/IPeerConnection.idl b/dom/media/bridge/IPeerConnection.idl index e19fc32171e1..53944bf7baa6 100644 --- a/dom/media/bridge/IPeerConnection.idl +++ b/dom/media/bridge/IPeerConnection.idl @@ -2,8 +2,6 @@ #include "nsIDOMWindow.idl" #include "nsIPropertyBag2.idl" -interface nsIDOMDataChannel; - /* Do not confuse with nsIDOMRTCPeerConnection. This interface is purely for * communication between the PeerConnection JS DOM binding and the C++ * implementation in SIPCC. diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp index c41a95042407..63706068eac3 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp @@ -78,7 +78,6 @@ #include "nsURLHelper.h" #include "nsNetUtil.h" #include "nsIURLParser.h" -#include "nsIDOMDataChannel.h" #include "NullPrincipal.h" #include "mozilla/PeerIdentity.h" #include "mozilla/dom/RTCCertificate.h" @@ -224,8 +223,6 @@ namespace mozilla { class DataChannel; } -class nsIDOMDataChannel; - // XXX Workaround for bug 998092 to maintain the existing broken semantics template<> struct nsISupportsWeakReference::COMTypeInfo { @@ -1365,12 +1362,13 @@ PeerConnectionImpl::CreateDataChannel(const nsAString& aLabel, new JsepTransceiver(SdpMediaSection::MediaType::kApplication)); mHaveDataStream = true; } - nsIDOMDataChannel *retval; - rv = NS_NewDOMDataChannel(dataChannel.forget(), mWindow, &retval); + RefPtr retval; + rv = NS_NewDOMDataChannel(dataChannel.forget(), mWindow, + getter_AddRefs(retval)); if (NS_FAILED(rv)) { return rv; } - *aRetval = static_cast(retval); + retval.forget(aRetval); return NS_OK; } @@ -1401,14 +1399,13 @@ do_QueryObjectReferent(nsIWeakReference* aRawPtr) { // Not a member function so that we don't need to keep the PC live. -static void NotifyDataChannel_m(RefPtr aChannel, +static void NotifyDataChannel_m(RefPtr aChannel, RefPtr aObserver) { MOZ_ASSERT(NS_IsMainThread()); JSErrorResult rv; - RefPtr channel = static_cast(&*aChannel); - aObserver->NotifyDataChannel(*channel, rv); - NS_DataChannelAppReady(aChannel); + aObserver->NotifyDataChannel(*aChannel, rv); + aChannel->AppReady(); } void @@ -1420,7 +1417,7 @@ PeerConnectionImpl::NotifyDataChannel(already_AddRefed aChannel) MOZ_ASSERT(channel); CSFLogDebug(LOGTAG, "%s: channel: %p", __FUNCTION__, channel.get()); - nsCOMPtr domchannel; + RefPtr domchannel; nsresult rv = NS_NewDOMDataChannel(channel.forget(), mWindow, getter_AddRefs(domchannel)); NS_ENSURE_SUCCESS_VOID(rv); diff --git a/media/webrtc/signaling/test/FakePCObserver.h b/media/webrtc/signaling/test/FakePCObserver.h index 460059b7fc9a..b3d5786b25b0 100644 --- a/media/webrtc/signaling/test/FakePCObserver.h +++ b/media/webrtc/signaling/test/FakePCObserver.h @@ -27,7 +27,7 @@ class PeerConnectionImpl; } class nsIDOMWindow; -class nsIDOMDataChannel; +class nsDOMDataChannel; namespace test { @@ -83,7 +83,7 @@ public: NS_IMETHOD OnSetRemoteDescriptionSuccess(ER&) = 0; NS_IMETHOD OnSetLocalDescriptionError(uint32_t code, const char *msg, ER&) = 0; NS_IMETHOD OnSetRemoteDescriptionError(uint32_t code, const char *msg, ER&) = 0; - NS_IMETHOD NotifyDataChannel(nsIDOMDataChannel *channel, ER&) = 0; + NS_IMETHOD NotifyDataChannel(nsDataChannel *channel, ER&) = 0; NS_IMETHOD OnStateChange(mozilla::dom::PCObserverStateType state_type, ER&, void* = nullptr) = 0; NS_IMETHOD OnAddStream(mozilla::DOMMediaStream &stream, ER&) = 0; diff --git a/media/webrtc/signaling/test/signaling_unittests.cpp b/media/webrtc/signaling/test/signaling_unittests.cpp index 6eecae82448b..9a9c9f5f05d5 100644 --- a/media/webrtc/signaling/test/signaling_unittests.cpp +++ b/media/webrtc/signaling/test/signaling_unittests.cpp @@ -242,7 +242,7 @@ public: NS_IMETHOD OnSetRemoteDescriptionSuccess(ER&) override; NS_IMETHOD OnSetLocalDescriptionError(uint32_t code, const char *msg, ER&) override; NS_IMETHOD OnSetRemoteDescriptionError(uint32_t code, const char *msg, ER&) override; - NS_IMETHOD NotifyDataChannel(nsIDOMDataChannel *channel, ER&) override; + NS_IMETHOD NotifyDataChannel(nsDataChannel *channel, ER&) override; NS_IMETHOD OnStateChange(PCObserverStateType state_type, ER&, void*) override; NS_IMETHOD OnAddStream(DOMMediaStream &stream, ER&) override; NS_IMETHOD OnRemoveStream(DOMMediaStream &stream, ER&) override; @@ -345,7 +345,7 @@ TestObserver::OnSetRemoteDescriptionError(uint32_t code, const char *message, ER } NS_IMETHODIMP -TestObserver::NotifyDataChannel(nsIDOMDataChannel *channel, ER&) +TestObserver::NotifyDataChannel(nsDataChannel *channel, ER&) { std::cout << name << ": NotifyDataChannel" << std::endl; return NS_OK; diff --git a/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp b/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp index 8f4d0f59407e..53edcee1372e 100644 --- a/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp +++ b/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp @@ -7,9 +7,6 @@ #include "ShimInterfaceInfo.h" -#ifdef MOZ_WEBRTC -#include "nsIDOMDataChannel.h" -#endif #include "nsIDOMDOMCursor.h" #include "nsIDOMDOMException.h" #include "nsIDOMDOMRequest.h" @@ -65,9 +62,6 @@ #include "mozilla/dom/OfflineResourceListBinding.h" #include "mozilla/dom/PositionErrorBinding.h" #include "mozilla/dom/RangeBinding.h" -#ifdef MOZ_WEBRTC -#include "mozilla/dom/RTCDataChannelBinding.h" -#endif #include "mozilla/dom/SelectionBinding.h" #include "mozilla/dom/StorageEventBinding.h" #include "mozilla/dom/StyleSheetBinding.h" @@ -153,9 +147,6 @@ const ComponentsInterfaceShimEntry kComponentsInterfaceShimMap[] = DEFINE_SHIM(OfflineResourceList), DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMParser, DOMParser), DEFINE_SHIM(Range), -#ifdef MOZ_WEBRTC - DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMDataChannel, RTCDataChannel), -#endif DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMSerializer, XMLSerializer), DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsITreeBoxObject, TreeBoxObject), DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIWebBrowserPersistable, FrameLoader), From 764cd472b62aca6d53b987c698db5df25e8eb770 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 4 Apr 2018 15:32:19 -0400 Subject: [PATCH 26/88] Bug 1445710. Reduce codesize a bit by removing DOM DefineInterfaceObject methods. r=peterv MozReview-Commit-ID: 6JRYz4FV9vP --- dom/bindings/Codegen.py | 37 +---------------- dom/bindings/WebIDLGlobalNameHash.cpp | 58 ++++++++++++++++++++++----- dom/bindings/WebIDLGlobalNameHash.h | 8 ++-- 3 files changed, 51 insertions(+), 52 deletions(-) diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 041b6b337c59..ac5a6b986b80 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -3396,38 +3396,6 @@ class CGGetNamedPropertiesObjectMethod(CGAbstractStaticMethod): nativeType=self.descriptor.nativeType) -class CGDefineDOMInterfaceMethod(CGAbstractMethod): - """ - A method for resolve hooks to try to lazily define the interface object for - a given interface. - """ - def __init__(self, descriptor): - args = [Argument('JSContext*', 'aCx'), - Argument('JS::Handle', 'aGlobal'), - Argument('JS::Handle', 'id'), - Argument('bool', 'aDefineOnGlobal')] - CGAbstractMethod.__init__(self, descriptor, 'DefineDOMInterface', 'JSObject*', args) - - def definition_body(self): - if len(self.descriptor.interface.namedConstructors) > 0: - getConstructor = dedent(""" - JSObject* interfaceObject = GetConstructorObjectHandle(aCx, aDefineOnGlobal); - if (!interfaceObject) { - return nullptr; - } - for (unsigned slot = DOM_INTERFACE_SLOTS_BASE; slot < JSCLASS_RESERVED_SLOTS(&sInterfaceObjectClass.mBase); ++slot) { - JSObject* constructor = &js::GetReservedSlot(interfaceObject, slot).toObject(); - if (JS_GetFunctionId(JS_GetObjectFunction(constructor)) == JSID_TO_STRING(id)) { - return constructor; - } - } - return interfaceObject; - """) - else: - getConstructor = "return GetConstructorObjectHandle(aCx, aDefineOnGlobal);\n" - return getConstructor - - def getConditionList(idlobj, cxName, objName): """ Get the list of conditions for idlobj (to be used in "is this enabled" @@ -12774,9 +12742,6 @@ class CGDescriptor(CGThing): descriptor.isExposedConditionally()): cgThings.append(CGConstructorEnabled(descriptor)) - if descriptor.registersGlobalNamesOnWindow: - cgThings.append(CGDefineDOMInterfaceMethod(descriptor)) - if (descriptor.interface.hasMembersInSlots() and descriptor.interface.hasChildInterfaces()): raise TypeError("We don't support members in slots on " @@ -13909,7 +13874,7 @@ class CGRegisterGlobalNames(CGAbstractMethod): currentOffset = 0 for (name, desc) in getGlobalNames(self.config): length = len(name) - define += "WebIDLGlobalNameHash::Register(%i, %i, %sBinding::DefineDOMInterface, %s, constructors::id::%s);\n" % ( + define += "WebIDLGlobalNameHash::Register(%i, %i, %sBinding::CreateInterfaceObjects, %s, constructors::id::%s);\n" % ( currentOffset, length, desc.name, getCheck(desc), desc.name) currentOffset += length + 1 # Add trailing null. return define diff --git a/dom/bindings/WebIDLGlobalNameHash.cpp b/dom/bindings/WebIDLGlobalNameHash.cpp index 3588cb106f88..11b49df6651b 100644 --- a/dom/bindings/WebIDLGlobalNameHash.cpp +++ b/dom/bindings/WebIDLGlobalNameHash.cpp @@ -5,13 +5,18 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "WebIDLGlobalNameHash.h" +#include "js/Class.h" #include "js/GCAPI.h" +#include "js/Id.h" #include "js/Wrapper.h" +#include "jsapi.h" +#include "jsfriendapi.h" #include "mozilla/ErrorResult.h" #include "mozilla/HashFunctions.h" #include "mozilla/Maybe.h" #include "mozilla/dom/DOMJSClass.h" #include "mozilla/dom/DOMJSProxyHandler.h" +#include "mozilla/dom/JSSlots.h" #include "mozilla/dom/PrototypeList.h" #include "mozilla/dom/RegisterBindings.h" #include "nsGlobalWindow.h" @@ -65,14 +70,14 @@ struct WebIDLNameTableEntry : public PLDHashEntryHdr : mNameOffset(0), mNameLength(0), mConstructorId(constructors::id::_ID_Count), - mDefine(nullptr), + mCreate(nullptr), mEnabled(nullptr) {} WebIDLNameTableEntry(WebIDLNameTableEntry&& aEntry) : mNameOffset(aEntry.mNameOffset), mNameLength(aEntry.mNameLength), mConstructorId(aEntry.mConstructorId), - mDefine(aEntry.mDefine), + mCreate(aEntry.mCreate), mEnabled(aEntry.mEnabled) {} ~WebIDLNameTableEntry() @@ -109,7 +114,7 @@ struct WebIDLNameTableEntry : public PLDHashEntryHdr uint16_t mNameOffset; uint16_t mNameLength; constructors::id::ID mConstructorId; - WebIDLGlobalNameHash::DefineGlobalName mDefine; + CreateInterfaceObjectsMethod mCreate; // May be null if enabled unconditionally WebIDLGlobalNameHash::ConstructorEnabled mEnabled; }; @@ -162,7 +167,7 @@ WebIDLGlobalNameHash::Shutdown() /* static */ void WebIDLGlobalNameHash::Register(uint16_t aNameOffset, uint16_t aNameLength, - DefineGlobalName aDefine, + CreateInterfaceObjectsMethod aCreate, ConstructorEnabled aEnabled, constructors::id::ID aConstructorId) { @@ -171,7 +176,7 @@ WebIDLGlobalNameHash::Register(uint16_t aNameOffset, uint16_t aNameLength, WebIDLNameTableEntry* entry = sWebIDLGlobalNames->PutEntry(key); entry->mNameOffset = aNameOffset; entry->mNameLength = aNameLength; - entry->mDefine = aDefine; + entry->mCreate = aCreate; entry->mEnabled = aEnabled; entry->mConstructorId = aConstructorId; } @@ -184,6 +189,35 @@ WebIDLGlobalNameHash::Remove(const char* aName, uint32_t aLength) sWebIDLGlobalNames->RemoveEntry(key); } +static JSObject* +FindNamedConstructorForXray(JSContext* aCx, JS::Handle aId, + const WebIDLNameTableEntry* aEntry) +{ + JSObject* interfaceObject = + GetPerInterfaceObjectHandle(aCx, aEntry->mConstructorId, + aEntry->mCreate, + /* aDefineOnGlobal = */ false); + if (!interfaceObject) { + return nullptr; + } + + // This is a call over Xrays, so we will actually use the return value + // (instead of just having it defined on the global now). Check for named + // constructors with this id, in case that's what the caller is asking for. + for (unsigned slot = DOM_INTERFACE_SLOTS_BASE; + slot < JSCLASS_RESERVED_SLOTS(js::GetObjectClass(interfaceObject)); + ++slot) { + JSObject* constructor = &js::GetReservedSlot(interfaceObject, slot).toObject(); + if (JS_GetFunctionId(JS_GetObjectFunction(constructor)) == JSID_TO_STRING(aId)) { + return constructor; + } + } + + // None of the named constructors match, so the caller must want the + // interface object itself. + return interfaceObject; +} + /* static */ bool WebIDLGlobalNameHash::DefineIfEnabled(JSContext* aCx, @@ -272,24 +306,26 @@ WebIDLGlobalNameHash::DefineIfEnabled(JSContext* aCx, // This all could use some grand refactoring, but for now we just limp // along. if (xpc::WrapperFactory::IsXrayWrapper(aObj)) { - JS::Rooted interfaceObject(aCx); + JS::Rooted constructor(aCx); { JSAutoCompartment ac(aCx, global); - interfaceObject = entry->mDefine(aCx, global, aId, false); + constructor = FindNamedConstructorForXray(aCx, aId, entry); } - if (NS_WARN_IF(!interfaceObject)) { + if (NS_WARN_IF(!constructor)) { return Throw(aCx, NS_ERROR_FAILURE); } - if (!JS_WrapObject(aCx, &interfaceObject)) { + if (!JS_WrapObject(aCx, &constructor)) { return Throw(aCx, NS_ERROR_FAILURE); } - FillPropertyDescriptor(aDesc, aObj, 0, JS::ObjectValue(*interfaceObject)); + FillPropertyDescriptor(aDesc, aObj, 0, JS::ObjectValue(*constructor)); return true; } JS::Rooted interfaceObject(aCx, - entry->mDefine(aCx, aObj, aId, true)); + GetPerInterfaceObjectHandle(aCx, entry->mConstructorId, + entry->mCreate, + /* aDefineOnGlobal = */ true)); if (NS_WARN_IF(!interfaceObject)) { return Throw(aCx, NS_ERROR_FAILURE); } diff --git a/dom/bindings/WebIDLGlobalNameHash.h b/dom/bindings/WebIDLGlobalNameHash.h index 24bab6ec33b7..cf1ae8315c2a 100644 --- a/dom/bindings/WebIDLGlobalNameHash.h +++ b/dom/bindings/WebIDLGlobalNameHash.h @@ -9,6 +9,7 @@ #include "js/RootingAPI.h" #include "nsTArray.h" +#include "mozilla/dom/BindingDeclarations.h" namespace mozilla { namespace dom { @@ -27,10 +28,6 @@ public: static void Init(); static void Shutdown(); - typedef JSObject* - (*DefineGlobalName)(JSContext* cx, JS::Handle global, - JS::Handle id, bool defineOnGlobal); - // Check whether a constructor should be enabled for the given object. // Note that the object should NOT be an Xray, since Xrays will end up // defining constructors on the underlying object. @@ -41,7 +38,8 @@ public: (*ConstructorEnabled)(JSContext* cx, JS::Handle obj); static void Register(uint16_t aNameOffset, uint16_t aNameLength, - DefineGlobalName aDefine, ConstructorEnabled aEnabled, + CreateInterfaceObjectsMethod aCreate, + ConstructorEnabled aEnabled, constructors::id::ID aConstructorId); static void Remove(const char* aName, uint32_t aLength); From b0487a956993fcd27424dc9022aa8b4462782715 Mon Sep 17 00:00:00 2001 From: Paolo Amadini Date: Wed, 4 Apr 2018 18:06:42 +0100 Subject: [PATCH 27/88] Bug 1451406 - Always use type="menu" instead of the type="panel" alias for buttons. r=bgrins MozReview-Commit-ID: CMFd4J4n6rk --HG-- extra : rebase_source : 4a8a0127ba8f34bfe74f5b7471c84ab8c58cd05d --- toolkit/content/tests/chrome/test_button.xul | 6 +----- toolkit/content/tests/chrome/test_panelfrommenu.xul | 4 ++-- toolkit/content/xul.css | 8 +++----- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/toolkit/content/tests/chrome/test_button.xul b/toolkit/content/tests/chrome/test_button.xul index 7b015168f4a5..491d629006ad 100644 --- a/toolkit/content/tests/chrome/test_button.xul +++ b/toolkit/content/tests/chrome/test_button.xul @@ -18,8 +18,7 @@ - + diff --git a/toolkit/content/xul.css b/toolkit/content/xul.css index 7def9b6b3226..e185c107c334 100644 --- a/toolkit/content/xul.css +++ b/toolkit/content/xul.css @@ -110,7 +110,7 @@ button[type="repeat"] { -moz-binding: url("chrome://global/content/bindings/button.xml#button-repeat"); } -button[type="menu"], button[type="panel"] { +button[type="menu"] { -moz-binding: url("chrome://global/content/bindings/button.xml#menu"); } @@ -134,13 +134,11 @@ toolbarbutton.badged-button { display: none; } -toolbarbutton[type="menu"], -toolbarbutton[type="panel"] { +toolbarbutton[type="menu"] { -moz-binding: url("chrome://global/content/bindings/toolbarbutton.xml#menu"); } -toolbarbutton.badged-button[type="menu"], -toolbarbutton.badged-button[type="panel"] { +toolbarbutton.badged-button[type="menu"] { -moz-binding: url("chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton-badged-menu"); } From cffe5c43e56dda25ac8d9d8cc3f126e50d68eb57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Qu=C3=A8ze?= Date: Wed, 4 Apr 2018 21:48:49 +0200 Subject: [PATCH 28/88] Bug 1449925 - follow-up to fix conflict with bug 1450242, rs=bustage-fix, a=bustage-fix on CLOSED TREE --- browser/components/nsBrowserContentHandler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/components/nsBrowserContentHandler.js b/browser/components/nsBrowserContentHandler.js index a3df75f75681..47aac75394c1 100644 --- a/browser/components/nsBrowserContentHandler.js +++ b/browser/components/nsBrowserContentHandler.js @@ -415,7 +415,7 @@ nsBrowserContentHandler.prototype = { // PB builds. if (cmdLine.handleFlag("private", false) && PrivateBrowsingUtils.enabled) { PrivateBrowsingUtils.enterTemporaryAutoStartMode(); - if (cmdLine.state == nsICommandLine.STATE_INITIAL_LAUNCH) { + if (cmdLine.state == Ci.nsICommandLine.STATE_INITIAL_LAUNCH) { let win = Services.wm.getMostRecentWindow("navigator:blank"); if (win) { win.QueryInterface(Ci.nsIInterfaceRequestor) From 202290f6bbdd1b41c06a0bc712a2c1cd37bcbb04 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 3 Apr 2018 22:22:07 -0700 Subject: [PATCH 29/88] Bug 1451215: Run codespell on code. r=aswan MozReview-Commit-ID: HIilZTKcQUY --HG-- extra : rebase_source : 48ba4b4ac06f6d146ce81050da6c60b6f7c3fbfc extra : amend_source : cba3e4c100a57889851eaaffff3696d1285655ea --- .../parent/ext-devtools-inspectedWindow.js | 2 +- .../extensions/parent/ext-devtools-panels.js | 2 +- browser/components/extensions/parent/ext-find.js | 2 +- .../test_ext_chrome_settings_overrides_update.js | 4 ++-- .../test/xpcshell/test_ext_url_overrides_newtab.js | 14 +++++++------- .../test_ext_url_overrides_newtab_update.js | 2 +- toolkit/components/extensions/ExtensionCommon.jsm | 2 +- toolkit/components/extensions/ExtensionParent.jsm | 2 +- .../extensions/ExtensionPreferencesManager.jsm | 2 +- .../components/extensions/ExtensionStorageSync.jsm | 4 ++-- toolkit/components/extensions/ExtensionUtils.jsm | 2 +- toolkit/components/extensions/Schemas.jsm | 2 +- .../extensions/extension-process-script.js | 2 +- .../components/extensions/parent/ext-downloads.js | 2 +- .../extensions/parent/ext-permissions.js | 2 +- .../components/extensions/parent/ext-tabs-base.js | 14 +++++++------- .../extensions/parent/ext-webNavigation.js | 2 +- .../components/extensions/parent/ext-webRequest.js | 2 +- ...st_chrome_ext_webrequest_background_events.html | 2 +- .../mochitest/test_ext_webnavigation_filters.html | 4 ++-- .../test_ext_webrequest_background_events.html | 8 ++++---- .../mochitest/test_ext_webrequest_frameId.html | 2 +- .../extensions/test/xpcshell/test_ext_dns.js | 2 +- .../test/xpcshell/test_ext_downloads_misc.js | 6 +++--- .../test/xpcshell/test_ext_downloads_search.js | 4 ++-- .../test_ext_native_messaging_unresponsive.js | 2 +- .../test/xpcshell/test_ext_permissions.js | 4 ++-- .../xpcshell/test_ext_webRequest_set_cookie.js | 2 +- .../extensions/webrequest/StreamFilterChild.h | 2 +- toolkit/modules/addons/WebNavigation.jsm | 2 +- toolkit/modules/addons/WebRequest.jsm | 2 +- toolkit/modules/subprocess/Subprocess.jsm | 2 +- toolkit/mozapps/extensions/AddonManager.jsm | 6 +++--- .../mozapps/extensions/internal/AddonTestUtils.jsm | 4 ++-- .../extensions/internal/AddonUpdateChecker.jsm | 2 +- toolkit/mozapps/extensions/internal/XPIInstall.jsm | 6 +++--- .../mozapps/extensions/internal/XPIProvider.jsm | 4 ++-- .../extensions/internal/XPIProviderUtils.js | 6 +++--- .../extensions/test/xpcshell/test_bug393285.js | 2 +- .../extensions/test/xpcshell/test_bug570173.js | 2 +- .../test/xpcshell/test_gfxBlacklist_prefs.js | 2 +- .../test/xpcshell/test_json_updatecheck.js | 2 +- .../extensions/test/xpcshell/test_legacy.js | 2 +- .../test/xpcshell/test_overrideblocklist.js | 2 +- .../test/xpcshell/test_permissions_prefs.js | 2 +- .../test/xpcshell/test_strictcompatibility.js | 2 +- .../test/xpcshell/test_webextension_paths.js | 2 +- 47 files changed, 77 insertions(+), 77 deletions(-) diff --git a/browser/components/extensions/parent/ext-devtools-inspectedWindow.js b/browser/components/extensions/parent/ext-devtools-inspectedWindow.js index 74bb81574166..3dc96a6730ab 100644 --- a/browser/components/extensions/parent/ext-devtools-inspectedWindow.js +++ b/browser/components/extensions/parent/ext-devtools-inspectedWindow.js @@ -11,7 +11,7 @@ this.devtools_inspectedWindow = class extends ExtensionAPI { // Lazily retrieved inspectedWindow actor front per child context. let waitForInspectedWindowFront; - // TODO - Bug 1448878: retrive a more detailed callerInfo object, + // TODO - Bug 1448878: retrieve a more detailed callerInfo object, // like the filename and lineNumber of the actual extension called // in the child process. const callerInfo = { diff --git a/browser/components/extensions/parent/ext-devtools-panels.js b/browser/components/extensions/parent/ext-devtools-panels.js index 65eff27b1a8e..0ea4fb18bb37 100644 --- a/browser/components/extensions/parent/ext-devtools-panels.js +++ b/browser/components/extensions/parent/ext-devtools-panels.js @@ -505,7 +505,7 @@ this.devtools_panels = class extends ExtensionAPI { // (used by Sidebar.setExpression). let waitForInspectedWindowFront; - // TODO - Bug 1448878: retrive a more detailed callerInfo object, + // TODO - Bug 1448878: retrieve a more detailed callerInfo object, // like the filename and lineNumber of the actual extension called // in the child process. const callerInfo = { diff --git a/browser/components/extensions/parent/ext-find.js b/browser/components/extensions/parent/ext-find.js index cd9852259b94..0a9dc69f1dda 100644 --- a/browser/components/extensions/parent/ext-find.js +++ b/browser/components/extensions/parent/ext-find.js @@ -98,7 +98,7 @@ this.find = class extends ExtensionAPI { /** * browser.find.removeHighlighting - * Removes all hightlighting from previous search. + * Removes all highlighting from previous search. * * @param {number} tabId optional * Tab to clear highlighting in. Defaults to the active tab. diff --git a/browser/components/extensions/test/xpcshell/test_ext_chrome_settings_overrides_update.js b/browser/components/extensions/test/xpcshell/test_ext_chrome_settings_overrides_update.js index 1a92fd341e59..a1d1b3cefdd5 100644 --- a/browser/components/extensions/test/xpcshell/test_ext_chrome_settings_overrides_update.js +++ b/browser/components/extensions/test/xpcshell/test_ext_chrome_settings_overrides_update.js @@ -73,10 +73,10 @@ add_task(async function test_overrides_update_removal() { equal(extension.version, "1.0", "The installed addon has the expected version."); ok(getHomePageURL().endsWith(HOMEPAGE_URI), - "Home page url is overriden by the extension."); + "Home page url is overridden by the extension."); equal(Services.search.currentEngine.name, "DuckDuckGo", - "Default engine is overriden by the extension"); + "Default engine is overridden by the extension"); extensionInfo.manifest = { "version": "2.0", diff --git a/browser/components/extensions/test/xpcshell/test_ext_url_overrides_newtab.js b/browser/components/extensions/test/xpcshell/test_ext_url_overrides_newtab.js index 9c403f1d6667..4e10efdefb6c 100644 --- a/browser/components/extensions/test/xpcshell/test_ext_url_overrides_newtab.js +++ b/browser/components/extensions/test/xpcshell/test_ext_url_overrides_newtab.js @@ -111,7 +111,7 @@ add_task(async function test_multiple_extensions_overriding_newtab_page() { await ext2.startup(); ok(aboutNewTabService.newTabURL.endsWith(NEWTAB_URI_2), - "newTabURL is overriden by the second extension."); + "newTabURL is overridden by the second extension."); await checkNewTabPageOverride(ext1, NEWTAB_URI_2, CONTROLLED_BY_OTHER); // Verify that calling set and clear do nothing. @@ -137,17 +137,17 @@ add_task(async function test_multiple_extensions_overriding_newtab_page() { addon.userDisabled = false; await enabledPromise; ok(aboutNewTabService.newTabURL.endsWith(NEWTAB_URI_2), - "newTabURL is overriden by the second extension."); + "newTabURL is overridden by the second extension."); await checkNewTabPageOverride(ext2, NEWTAB_URI_2, CONTROLLED_BY_THIS); await ext1.unload(); ok(aboutNewTabService.newTabURL.endsWith(NEWTAB_URI_2), - "newTabURL is still overriden by the second extension."); + "newTabURL is still overridden by the second extension."); await checkNewTabPageOverride(ext2, NEWTAB_URI_2, CONTROLLED_BY_THIS); await ext3.startup(); ok(aboutNewTabService.newTabURL.endsWith(NEWTAB_URI_3), - "newTabURL is overriden by the third extension."); + "newTabURL is overridden by the third extension."); await checkNewTabPageOverride(ext2, NEWTAB_URI_3, CONTROLLED_BY_OTHER); // Disable the second extension. @@ -155,7 +155,7 @@ add_task(async function test_multiple_extensions_overriding_newtab_page() { addon.userDisabled = true; await disabledPromise; ok(aboutNewTabService.newTabURL.endsWith(NEWTAB_URI_3), - "newTabURL is still overriden by the third extension."); + "newTabURL is still overridden by the third extension."); await checkNewTabPageOverride(ext3, NEWTAB_URI_3, CONTROLLED_BY_THIS); // Re-enable the second extension. @@ -163,12 +163,12 @@ add_task(async function test_multiple_extensions_overriding_newtab_page() { addon.userDisabled = false; await enabledPromise; ok(aboutNewTabService.newTabURL.endsWith(NEWTAB_URI_3), - "newTabURL is still overriden by the third extension."); + "newTabURL is still overridden by the third extension."); await checkNewTabPageOverride(ext3, NEWTAB_URI_3, CONTROLLED_BY_THIS); await ext3.unload(); ok(aboutNewTabService.newTabURL.endsWith(NEWTAB_URI_2), - "newTabURL reverts to being overriden by the second extension."); + "newTabURL reverts to being overridden by the second extension."); await checkNewTabPageOverride(ext2, NEWTAB_URI_2, CONTROLLED_BY_THIS); await ext2.unload(); diff --git a/browser/components/extensions/test/xpcshell/test_ext_url_overrides_newtab_update.js b/browser/components/extensions/test/xpcshell/test_ext_url_overrides_newtab_update.js index 5292d278eb18..a260ab993af9 100644 --- a/browser/components/extensions/test/xpcshell/test_ext_url_overrides_newtab_update.js +++ b/browser/components/extensions/test/xpcshell/test_ext_url_overrides_newtab_update.js @@ -97,7 +97,7 @@ add_task(async function test_url_overrides_newtab_update() { equal(extension.version, "1.0", "The installed addon has the expected version."); ok(aboutNewTabService.newTabURL.endsWith(NEWTAB_URI), - "Newtab url is overriden by the extension."); + "Newtab url is overridden by the extension."); let update = await promiseFindAddonUpdates(extension.addon); let install = update.updateAvailable; diff --git a/toolkit/components/extensions/ExtensionCommon.jsm b/toolkit/components/extensions/ExtensionCommon.jsm index abd2a8fb07e9..01becbab386a 100644 --- a/toolkit/components/extensions/ExtensionCommon.jsm +++ b/toolkit/components/extensions/ExtensionCommon.jsm @@ -1763,7 +1763,7 @@ defineLazyGetter(LocaleData.prototype, "availableLocales", function() { * An object representing the extension instance using this event. * @param {string} name * A name used only for debugging. - * @param {functon} register + * @param {function} register * A function called whenever a new listener is added. */ function EventManager(context, name, register) { diff --git a/toolkit/components/extensions/ExtensionParent.jsm b/toolkit/components/extensions/ExtensionParent.jsm index cfa077eaf807..d0f4307fabd3 100644 --- a/toolkit/components/extensions/ExtensionParent.jsm +++ b/toolkit/components/extensions/ExtensionParent.jsm @@ -1438,7 +1438,7 @@ let IconDetails = { let ctx = canvas.getContext("2d"); let dSize = size * browserWindow.devicePixelRatio; - // Scales the image while maintaing width to height ratio. + // Scales the image while maintaining width to height ratio. // If the width and height differ, the image is centered using the // smaller of the two dimensions. let dWidth, dHeight, dx, dy; diff --git a/toolkit/components/extensions/ExtensionPreferencesManager.jsm b/toolkit/components/extensions/ExtensionPreferencesManager.jsm index 6cf672177f0d..da36540884c1 100644 --- a/toolkit/components/extensions/ExtensionPreferencesManager.jsm +++ b/toolkit/components/extensions/ExtensionPreferencesManager.jsm @@ -262,7 +262,7 @@ this.ExtensionPreferencesManager = { /** * Enables all disabled settings for an extension. This can be called when - * an extension has finsihed updating or is being re-enabled, for example. + * an extension has finished updating or is being re-enabled, for example. * * @param {string} id * The id of the extension for which all settings are being enabled. diff --git a/toolkit/components/extensions/ExtensionStorageSync.jsm b/toolkit/components/extensions/ExtensionStorageSync.jsm index 55166642afb3..414367d15a3f 100644 --- a/toolkit/components/extensions/ExtensionStorageSync.jsm +++ b/toolkit/components/extensions/ExtensionStorageSync.jsm @@ -346,7 +346,7 @@ async function storageSyncInit() { return storageSyncInit.promise; } -// Kinto record IDs have two condtions: +// Kinto record IDs have two conditions: // // - They must contain only ASCII alphanumerics plus - and _. To fix // this, we encode all non-letters using _C_, where C is the @@ -1043,7 +1043,7 @@ class ExtensionStorageSync { } if (keyResolution.accepted.uuid != cryptoKeyRecord.uuid) { - log.info(`Detected a new UUID (${keyResolution.accepted.uuid}, was ${cryptoKeyRecord.uuid}). Reseting sync status for everything.`); + log.info(`Detected a new UUID (${keyResolution.accepted.uuid}, was ${cryptoKeyRecord.uuid}). Resetting sync status for everything.`); await this.cryptoCollection.resetSyncStatus(); // Server version is now correct. Return that result. diff --git a/toolkit/components/extensions/ExtensionUtils.jsm b/toolkit/components/extensions/ExtensionUtils.jsm index 975bcb5bc3cd..c21b09750659 100644 --- a/toolkit/components/extensions/ExtensionUtils.jsm +++ b/toolkit/components/extensions/ExtensionUtils.jsm @@ -500,7 +500,7 @@ class MessageManagerProxy { * * @param {nsIMessageSender|MessageManagerProxy|Element} target * The message manager, MessageManagerProxy, or - * element agaisnt which to match. + * element against which to match. * @param {nsIMessageSender} messageManager * The message manager against which to match `target`. * diff --git a/toolkit/components/extensions/Schemas.jsm b/toolkit/components/extensions/Schemas.jsm index 638a8980437b..c6fc16a9fa0f 100644 --- a/toolkit/components/extensions/Schemas.jsm +++ b/toolkit/components/extensions/Schemas.jsm @@ -2576,7 +2576,7 @@ class Namespace extends Map { type.type = "object"; } else if (DEBUG) { if (!targetType) { - throw new Error(`Internal error: Attempt to extend a nonexistant type ${type.$extend}`); + throw new Error(`Internal error: Attempt to extend a nonexistent type ${type.$extend}`); } else if (!(targetType instanceof ChoiceType)) { throw new Error(`Internal error: Attempt to extend a non-extensible type ${type.$extend}`); } diff --git a/toolkit/components/extensions/extension-process-script.js b/toolkit/components/extensions/extension-process-script.js index f2fa0fbab38d..01057e9a951e 100644 --- a/toolkit/components/extensions/extension-process-script.js +++ b/toolkit/components/extensions/extension-process-script.js @@ -346,7 +346,7 @@ ExtensionManager = { policy.debugName = `${JSON.stringify(policy.name)} (ID: ${policy.id}, ${policy.getURL()})`; - // Register any existent dinamically registered content script for the extension + // Register any existent dynamically registered content script for the extension // when a content process is started for the first time (which also cover // a content process that crashed and it has been recreated). const registeredContentScripts = this.registeredContentScripts.get(policy); diff --git a/toolkit/components/extensions/parent/ext-downloads.js b/toolkit/components/extensions/parent/ext-downloads.js index a08d089e7808..3826e7fcdfb1 100644 --- a/toolkit/components/extensions/parent/ext-downloads.js +++ b/toolkit/components/extensions/parent/ext-downloads.js @@ -148,7 +148,7 @@ class DownloadItem { } -// DownloadMap maps back and forth betwen the numeric identifiers used in +// DownloadMap maps back and forth between the numeric identifiers used in // the downloads WebExtension API and a Download object from the Downloads jsm. // TODO Bug 1247794: make id and extension info persistent const DownloadMap = new class extends EventEmitter { diff --git a/toolkit/components/extensions/parent/ext-permissions.js b/toolkit/components/extensions/parent/ext-permissions.js index 27fb51ab97d6..362cb97d935f 100644 --- a/toolkit/components/extensions/parent/ext-permissions.js +++ b/toolkit/components/extensions/parent/ext-permissions.js @@ -59,7 +59,7 @@ this.permissions = class extends ExtensionAPI { } } - // Unfortunatelly, we treat as an API permission as well. + // Unfortunately, we treat as an API permission as well. if (origins.includes("")) { perms.permissions.push(""); } diff --git a/toolkit/components/extensions/parent/ext-tabs-base.js b/toolkit/components/extensions/parent/ext-tabs-base.js index 7e39023a1289..07d5fe2d0c61 100644 --- a/toolkit/components/extensions/parent/ext-tabs-base.js +++ b/toolkit/components/extensions/parent/ext-tabs-base.js @@ -75,7 +75,7 @@ class TabBase { * @param {BaseContext} context * The context through which to send the message. * @param {string} messageName - * The name of the messge to send. + * The name of the message to send. * @param {object} [data = {}] * Arbitrary, structured-clonable message data to send. * @param {object} [options] @@ -567,7 +567,7 @@ class TabBase { /** * Converts this tab object to a JSON-compatible object containing the values * of its properties which the extension is permitted to access, in the format - * requried to be returned by WebExtension APIs. + * required to be returned by WebExtension APIs. * * @param {Tab} [fallbackTab] * A tab to retrieve geometry data from if the lazy geometry data for @@ -824,7 +824,7 @@ class WindowBase { /** * Converts this window object to a JSON-compatible object which may be - * returned to an extension, in the format requried to be returned by + * returned to an extension, in the format required to be returned by * WebExtension APIs. * * @param {object} [getInfo] @@ -1134,7 +1134,7 @@ Object.assign(WindowBase, {WINDOW_ID_NONE, WINDOW_ID_CURRENT}); */ /** - * An object containg basic, extension-independent information about the window + * An object containing basic, extension-independent information about the window * and tab that a XUL belongs to. * * @typedef {Object} BrowserData @@ -1561,7 +1561,7 @@ class WindowTrackerBase extends EventEmitter { } /** - * Add an event listener to be called whenever the given DOM event is recieved + * Add an event listener to be called whenever the given DOM event is received * at the top level of any browser window. * * @param {string} type @@ -1797,7 +1797,7 @@ class TabManagerBase { /** * Converts the given native tab to a JSON-compatible object, in the format - * requried to be returned by WebExtension APIs, which may be safely passed to + * required to be returned by WebExtension APIs, which may be safely passed to * extension code. * * @param {NativeTab} nativeTab @@ -1903,7 +1903,7 @@ class WindowManagerBase { /** * Converts the given browser window to a JSON-compatible object, in the - * format requried to be returned by WebExtension APIs, which may be safely + * format required to be returned by WebExtension APIs, which may be safely * passed to extension code. * * @param {DOMWindow} window diff --git a/toolkit/components/extensions/parent/ext-webNavigation.js b/toolkit/components/extensions/parent/ext-webNavigation.js index 992449833ec6..958473b74fb3 100644 --- a/toolkit/components/extensions/parent/ext-webNavigation.js +++ b/toolkit/components/extensions/parent/ext-webNavigation.js @@ -1,6 +1,6 @@ "use strict"; -// This file expectes tabTracker to be defined in the global scope (e.g. +// This file expects tabTracker to be defined in the global scope (e.g. // by ext-utils.js). /* global tabTracker */ diff --git a/toolkit/components/extensions/parent/ext-webRequest.js b/toolkit/components/extensions/parent/ext-webRequest.js index 7b90a04a6fdb..06519997f1bf 100644 --- a/toolkit/components/extensions/parent/ext-webRequest.js +++ b/toolkit/components/extensions/parent/ext-webRequest.js @@ -1,6 +1,6 @@ "use strict"; -// This file expectes tabTracker to be defined in the global scope (e.g. +// This file expects tabTracker to be defined in the global scope (e.g. // by ext-utils.js). /* global tabTracker */ diff --git a/toolkit/components/extensions/test/mochitest/test_chrome_ext_webrequest_background_events.html b/toolkit/components/extensions/test/mochitest/test_chrome_ext_webrequest_background_events.html index aef07bc0003f..6fb9d3b89d5b 100644 --- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_webrequest_background_events.html +++ b/toolkit/components/extensions/test/mochitest/test_chrome_ext_webrequest_background_events.html @@ -42,7 +42,7 @@ let testExtension = { function listener(name, details) { // If we get anything, we failed. Removing the system principal check // in ext-webrequest triggers this failure. - browser.test.fail(`recieved ${name}`); + browser.test.fail(`received ${name}`); } for (let name of eventNames) { diff --git a/toolkit/components/extensions/test/mochitest/test_ext_webnavigation_filters.html b/toolkit/components/extensions/test/mochitest/test_ext_webnavigation_filters.html index bb4039f5d364..6997363f7bee 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_webnavigation_filters.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_webnavigation_filters.html @@ -104,13 +104,13 @@ add_task(async function test_webnav_unresolved_uri_on_expected_URI_scheme() { failFilter: [{ports: [22, 23, [81, 100]]}], }, // multiple criteria in a single filter: - // if one of the critera is not verified, the event should not be received. + // if one of the criteria is not verified, the event should not be received. { okFilter: [{schemes: ["http"], ports: [80, 22, 443]}], failFilter: [{schemes: ["http"], ports: [81, 82, 83]}], }, // multiple urlFilters on the same listener - // if at least one of the critera is verified, the event should be received. + // if at least one of the criteria is verified, the event should be received. { okFilter: [{schemes: ["https"]}, {ports: [80, 22, 443]}], failFilter: [{schemes: ["https"]}, {ports: [81, 82, 83]}], diff --git a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_background_events.html b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_background_events.html index 09e10dcbf2a3..f0f26bec06e5 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_background_events.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_background_events.html @@ -37,7 +37,7 @@ add_task(async function test_webRequest_serviceworker_events() { ]); function listener(name, details) { - browser.test.assertTrue(eventNames.has(name), `recieved ${name}`); + browser.test.assertTrue(eventNames.has(name), `received ${name}`); eventNames.delete(name); if (name == "onCompleted") { eventNames.delete("onErrorOccurred"); @@ -85,12 +85,12 @@ add_task(async function test_webRequest_background_events() { ]); function listener(name, details) { - browser.test.assertTrue(eventNames.has(name), `recieved ${name}`); + browser.test.assertTrue(eventNames.has(name), `received ${name}`); eventNames.delete(name); if (eventNames.size === 0) { browser.test.assertEq("xmlhttprequest", details.type, "correct type for fetch [see bug 1366710]"); - browser.test.assertEq(0, eventNames.size, "messages recieved"); + browser.test.assertEq(0, eventNames.size, "messages received"); browser.test.sendMessage("done"); } } @@ -105,7 +105,7 @@ add_task(async function test_webRequest_background_events() { fetch("https://example.com/example.txt").then(() => { browser.test.succeed("Fetch succeeded."); }, () => { - browser.test.fail("fetch recieved"); + browser.test.fail("fetch received"); browser.test.sendMessage("done"); }); }, diff --git a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_frameId.html b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_frameId.html index 41044cb0d0ef..b1899b47c0fa 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_frameId.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_webrequest_frameId.html @@ -97,7 +97,7 @@ let expected = { origin: "file_simple_xhr_frame2.html", parent: "file_simple_xhr_frame2.html", }, - // This is loaded in a sandbox iframe. originUrl is not availabe for that, + // This is loaded in a sandbox iframe. originUrl is not available for that, // and requests within a sandboxed iframe will additionally have an empty // url on their immediate parent/ancestor. "file_simple_sandboxed_frame.html": { diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_dns.js b/toolkit/components/extensions/test/xpcshell/test_ext_dns.js index 7a328cfee6c0..c5968238db30 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_dns.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_dns.js @@ -1,6 +1,6 @@ "use strict"; -// Some test machines and android are not returing ipv6, turn it +// Some test machines and android are not returning ipv6, turn it // off to get consistent test results. Services.prefs.setBoolPref("network.dns.disableIPv6", true); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_downloads_misc.js b/toolkit/components/extensions/test/xpcshell/test_ext_downloads_misc.js index db42406dd5cd..2b43190d9039 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_downloads_misc.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_downloads_misc.js @@ -768,7 +768,7 @@ add_task(async function test_erase() { ids.dl3 = await download(); let msg = await runInExtension("search", {}); - equal(msg.status, "success", "search succeded"); + equal(msg.status, "success", "search succeeded"); equal(msg.result.length, 3, "search found 3 downloads"); msg = await runInExtension("clearEvents"); @@ -782,7 +782,7 @@ add_task(async function test_erase() { equal(msg.status, "success", "received onErased event"); msg = await runInExtension("search", {}); - equal(msg.status, "success", "search succeded"); + equal(msg.status, "success", "search succeeded"); equal(msg.result.length, 2, "search found 2 downloads"); msg = await runInExtension("erase", {}); @@ -795,7 +795,7 @@ add_task(async function test_erase() { equal(msg.status, "success", "received 2 onErased events"); msg = await runInExtension("search", {}); - equal(msg.status, "success", "search succeded"); + equal(msg.status, "success", "search succeeded"); equal(msg.result.length, 0, "search found 0 downloads"); }); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_downloads_search.js b/toolkit/components/extensions/test/xpcshell/test_ext_downloads_search.js index d5c44939c540..6bee78b95985 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_downloads_search.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_downloads_search.js @@ -240,7 +240,7 @@ add_task(async function test_search() { await checkSearch({url: TXT_URL}, ["txt1", "txt2"], "url"); // Check that regexp on url works. - const HTML_REGEX = "[downlad]{8}\.html+$"; + const HTML_REGEX = "[download]{8}\.html+$"; await checkSearch({urlRegex: HTML_REGEX}, ["html1", "html2"], "url regexp"); // Check that compatible url+regexp works @@ -273,7 +273,7 @@ add_task(async function test_search() { await checkSearch({query: ["-txt"]}, ["html1", "html2"], "term -txt"); // Check that positive and negative search terms together work. - await checkSearch({query: ["html", "-renamed"]}, ["html1"], "postive and negative terms"); + await checkSearch({query: ["html", "-renamed"]}, ["html1"], "positive and negative terms"); async function checkSearchWithDate(query, expected, description) { const fields = Object.keys(query); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_native_messaging_unresponsive.js b/toolkit/components/extensions/test/xpcshell/test_ext_native_messaging_unresponsive.js index 3e98877e064a..23769dc264a1 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_native_messaging_unresponsive.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_native_messaging_unresponsive.js @@ -78,5 +78,5 @@ add_task(async function test_unresponsive_native_app() { await exitPromise; procCount = await getSubprocessCount(); - equal(procCount, 0, "subprocess was succesfully killed"); + equal(procCount, 0, "subprocess was successfully killed"); }); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_permissions.js b/toolkit/components/extensions/test/xpcshell/test_ext_permissions.js index d8e2cb81b388..73009cd8a725 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_permissions.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_permissions.js @@ -137,7 +137,7 @@ add_task(async function test_permissions() { } for (let origin of OPTIONAL_ORIGINS) { result = await call("contains", {origins: [origin]}); - equal(result, false, `conains() returns false for origin ${origin}`); + equal(result, false, `contains() returns false for origin ${origin}`); } result = await call("contains", { @@ -464,7 +464,7 @@ add_task(async function test_optional_all_urls() { equal(before, false, "captureVisibleTab() unavailable before optional permission request()"); equal(granted, true, "request() for optional permissions granted"); - equal(after, true, "captureVisibleTab() avaiable after optional permission request()"); + equal(after, true, "captureVisibleTab() available after optional permission request()"); }); await extension.unload(); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_set_cookie.js b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_set_cookie.js index f7ccfaee51c1..2fe1193ad265 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_set_cookie.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_set_cookie.js @@ -126,7 +126,7 @@ add_task(async function test_modifying_cookies_from_onHeadersReceived() { // cookie jar. await testCookiesWithFile("data/file_sample.html", ["ext"]); - // Next, preform a request that will set on cookie (reqcookie=reqvalue) + // Next, perform a request that will set on cookie (reqcookie=reqvalue) // and check that two cookies wind up in the cookie jar (the request // set cookie, and the extension set cookie). await testCookiesWithFile("file_webrequestblocking_set_cookie.html", ["ext", "req"]); diff --git a/toolkit/components/extensions/webrequest/StreamFilterChild.h b/toolkit/components/extensions/webrequest/StreamFilterChild.h index 2cd6b3842648..d7ea88a21209 100644 --- a/toolkit/components/extensions/webrequest/StreamFilterChild.h +++ b/toolkit/components/extensions/webrequest/StreamFilterChild.h @@ -66,7 +66,7 @@ public: Closed, // The channel is being disconnected from the parent, and all further events // and data will pass unfiltered. Data received by the child in this state - // will be automatically written ot the output stream listener. No data may + // will be automatically written to the output stream listener. No data may // be explicitly written. Disconnecting, // The channel has been disconnected from the parent, and all further data diff --git a/toolkit/modules/addons/WebNavigation.jsm b/toolkit/modules/addons/WebNavigation.jsm index 2626f66b3d37..267f906446d5 100644 --- a/toolkit/modules/addons/WebNavigation.jsm +++ b/toolkit/modules/addons/WebNavigation.jsm @@ -157,7 +157,7 @@ var Manager = { let action = input._parseActionUrl(value); if (action) { - // Detect keywork and generated and more typed scenarios. + // Detect keyword and generated and more typed scenarios. switch (action.type) { case "keyword": tabTransistionData.keyword = true; diff --git a/toolkit/modules/addons/WebRequest.jsm b/toolkit/modules/addons/WebRequest.jsm index 661556b75e7f..dd913b04eef2 100644 --- a/toolkit/modules/addons/WebRequest.jsm +++ b/toolkit/modules/addons/WebRequest.jsm @@ -475,7 +475,7 @@ class AuthRequestor { } catch (e) { Cu.reportError(`webRequest onAuthAvailable failure ${e}`); } - // At least one addon has responded, so we wont forward to the regular + // At least one addon has responded, so we won't forward to the regular // prompt handlers. wrapper.authPromptForward = null; wrapper.authPromptCallback = null; diff --git a/toolkit/modules/subprocess/Subprocess.jsm b/toolkit/modules/subprocess/Subprocess.jsm index 297eca0f7382..e3ad09901567 100644 --- a/toolkit/modules/subprocess/Subprocess.jsm +++ b/toolkit/modules/subprocess/Subprocess.jsm @@ -55,7 +55,7 @@ var Subprocess = { * An object describing the process to launch. * * @param {string} options.command - * The full path of the execuable to launch. Relative paths are not + * The full path of the executable to launch. Relative paths are not * accepted, and `$PATH` is not searched. * * If a path search is necessary, the {@link Subprocess.pathSearch} method may diff --git a/toolkit/mozapps/extensions/AddonManager.jsm b/toolkit/mozapps/extensions/AddonManager.jsm index 3b4ecf8ca1af..ae68b637ca5d 100644 --- a/toolkit/mozapps/extensions/AddonManager.jsm +++ b/toolkit/mozapps/extensions/AddonManager.jsm @@ -490,7 +490,7 @@ AddonScreenshot.prototype = { * This represents a compatibility override for an addon. * * @param aType - * Overrride type - "compatible" or "incompatible" + * Override type - "compatible" or "incompatible" * @param aMinVersion * Minimum version of the addon to match * @param aMaxVersion @@ -731,7 +731,7 @@ var AddonManagerInternal = { let AMProviderShutdown = () => { // If the provider has been unregistered, it will have been removed from // this.providers. If it hasn't been unregistered, then this is a normal - // shutdown - and we move it to this.pendingProviders incase we're + // shutdown - and we move it to this.pendingProviders in case we're // running in a test that will start AddonManager again. if (this.providers.has(aProvider)) { this.providers.delete(aProvider); @@ -3191,7 +3191,7 @@ var AddonManager = { ["ERROR_INCORRECT_HASH", -2], // The downloaded file seems to be corrupted in some way. ["ERROR_CORRUPT_FILE", -3], - // An error occured trying to write to the filesystem. + // An error occurred trying to write to the filesystem. ["ERROR_FILE_ACCESS", -4], // The add-on must be signed and isn't. ["ERROR_SIGNEDSTATE_REQUIRED", -5], diff --git a/toolkit/mozapps/extensions/internal/AddonTestUtils.jsm b/toolkit/mozapps/extensions/internal/AddonTestUtils.jsm index 9ada061818df..8b1ee8f9a65c 100644 --- a/toolkit/mozapps/extensions/internal/AddonTestUtils.jsm +++ b/toolkit/mozapps/extensions/internal/AddonTestUtils.jsm @@ -104,7 +104,7 @@ AMscope.AsyncShutdown = MockAsyncShutdown; /** - * Escapes any occurances of &, ", < or > with XML entities. + * Escapes any occurrences of &, ", < or > with XML entities. * * @param {string} str * The string to escape. @@ -858,7 +858,7 @@ var AddonTestUtils = { }, /** - * Recursively create all directories upto and including the given + * Recursively create all directories up to and including the given * path, if they do not exist. * * @param {string} path The path of the directory to create. diff --git a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm index 790b27c2ef78..6b791437e6b7 100644 --- a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm +++ b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm @@ -365,7 +365,7 @@ UpdateParser.prototype = { }, /** - * Helper method to notify the observer that an error occured. + * Helper method to notify the observer that an error occurred. */ notifyError(aStatus) { if ("onUpdateCheckError" in this.observer) { diff --git a/toolkit/mozapps/extensions/internal/XPIInstall.jsm b/toolkit/mozapps/extensions/internal/XPIInstall.jsm index 82242d4140c7..721475cb58c0 100644 --- a/toolkit/mozapps/extensions/internal/XPIInstall.jsm +++ b/toolkit/mozapps/extensions/internal/XPIInstall.jsm @@ -191,7 +191,7 @@ var logger = Log.repository.getLogger(LOGGER_ID); * @param aFile * The file or directory to operate on. * @param aPermissions - * The permisions to set + * The permissions to set */ function setFilePermissions(aFile, aPermissions) { try { @@ -1535,7 +1535,7 @@ class AddonInstall { if (isWebExtension(this.existingAddon.type) && !isWebExtension(this.addon.type)) { zipreader.close(); return Promise.reject([AddonManager.ERROR_UNEXPECTED_ADDON_TYPE, - "WebExtensions may not be upated to other extension types"]); + "WebExtensions may not be updated to other extension types"]); } } @@ -2017,7 +2017,7 @@ var LocalAddonInstall = class extends AddonInstall { // file failed (e.g., the hash or signature or manifest contents // were invalid). It doesn't make sense to retry anything in this // case but we have callers who don't know if their AddonInstall - // object is a local file or a download so accomodate them here. + // object is a local file or a download so accommodate them here. AddonManagerPrivate.callInstallListeners("onDownloadFailed", this.listeners, this.wrapper); return; diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm index 1598e86efb5e..ecf769f42716 100644 --- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm +++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm @@ -501,7 +501,7 @@ function isTheme(type) { * @param aFile * The file or directory to operate on. * @param aPermissions - * The permisions to set + * The permissions to set */ function setFilePermissions(aFile, aPermissions) { try { @@ -5780,7 +5780,7 @@ class MutableDirectoryInstallLocation extends DirectoryInstallLocation { if (action == "proxy") { // When permanently installing sideloaded addon, we just put a proxy file - // refering to the addon sources + // referring to the addon sources newFile.append(id); writeStringToFile(newFile, source.path); diff --git a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js index 43a3ac37cdd1..d76d10324093 100644 --- a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js +++ b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js @@ -350,9 +350,9 @@ this.XPIDatabase = { * 1) Perfectly good, up to date database * 2) Out of date JSON database needs to be upgraded => upgrade * 3) JSON database exists but is mangled somehow => build new JSON - * 4) no JSON DB, but a useable SQLITE db we can upgrade from => upgrade + * 4) no JSON DB, but a usable SQLITE db we can upgrade from => upgrade * 5) useless SQLITE DB => build new JSON - * 6) useable RDF DB => upgrade + * 6) usable RDF DB => upgrade * 7) useless RDF DB => build new JSON * 8) Nothing at all => build new JSON * @param aRebuildOnError @@ -1525,7 +1525,7 @@ this.XPIDatabaseReconcile = { let previousVisible = this.getVisibleAddons(previousAddons); let currentVisible = this.flattenByID(currentAddons, hideLocation); - // Pass over the new set of visible add-ons, record any changes that occured + // Pass over the new set of visible add-ons, record any changes that occurred // during startup and call bootstrap install/uninstall scripts as necessary for (let [id, currentAddon] of currentVisible) { let previousAddon = previousVisible.get(id); diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug393285.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug393285.js index be0160ff46e0..dbc50223fb25 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug393285.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug393285.js @@ -310,7 +310,7 @@ function run_test_1() { Assert.ok(Services.blocklist.isAddonBlocklisted(a10, "2", "1.9")); Assert.ok(Services.blocklist.isAddonBlocklisted(a11, "2", "1.9")); - // Doesnt match both os and abi so not blocked + // Doesn't match both os and abi so not blocked Assert.ok(!Services.blocklist.isAddonBlocklisted(a12, "2", "1.9")); Assert.ok(!Services.blocklist.isAddonBlocklisted(a13, "2", "1.9")); Assert.ok(!Services.blocklist.isAddonBlocklisted(a14, "2", "1.9")); diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug570173.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug570173.js index ec5360335026..c6e258c061f6 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug570173.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug570173.js @@ -2,7 +2,7 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -// This verifies that add-on update check failures are propogated correctly +// This verifies that add-on update check failures are propagated correctly // The test extension uses an insecure update url. Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false); diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_gfxBlacklist_prefs.js b/toolkit/mozapps/extensions/test/xpcshell/test_gfxBlacklist_prefs.js index 787ceab29b8c..a4d32d5c9356 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_gfxBlacklist_prefs.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_gfxBlacklist_prefs.js @@ -2,7 +2,7 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -// Test whether the blacklist succesfully adds and removes the prefs that store +// Test whether the blacklist successfully adds and removes the prefs that store // its decisions when the remote blacklist is changed. // Uses test_gfxBlacklist.xml and test_gfxBlacklist2.xml diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_json_updatecheck.js b/toolkit/mozapps/extensions/test/xpcshell/test_json_updatecheck.js index 2a00c700c958..01369c70a10b 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_json_updatecheck.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_json_updatecheck.js @@ -271,7 +271,7 @@ add_task(async function test_update_url_security() { equal(updates[1].updateURL, "http://example.com/update.xpi", "safe update URL was accepted"); messages = messages.filter(msg => /http:\/\/localhost.*\/updates\/.*may not load or link to chrome:/.test(msg.message)); - equal(messages.length, 1, "privileged upate URL generated the expected console message"); + equal(messages.length, 1, "privileged update URL generated the expected console message"); }); diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_legacy.js b/toolkit/mozapps/extensions/test/xpcshell/test_legacy.js index 6f3c11bd511f..6bc37a5093d6 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_legacy.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_legacy.js @@ -81,7 +81,7 @@ add_task(async function test_disable() { // Yuck, the AddonInstall API is atrocious. Installs of incompatible // extensions are detected when the install reaches the DOWNLOADED state // and the install is abandoned at that point. Since this is a local file - // install we just start out in the DONWLOADED state. + // install we just start out in the DOWNLOADED state. for (let install of installs) { Assert.equal(install.state, AddonManager.STATE_DOWNLOADED); Assert.equal(install.addon.appDisabled, true); diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_overrideblocklist.js b/toolkit/mozapps/extensions/test/xpcshell/test_overrideblocklist.js index 4e13c405584d..f095b641f4be 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_overrideblocklist.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_overrideblocklist.js @@ -84,7 +84,7 @@ function run_test() { run_next_test(); } -// On first run whataver is in the app dir should get copied to the profile +// On first run whatever is in the app dir should get copied to the profile add_test(function test_copy() { clearBlocklists(); copyToApp(OLD); diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_permissions_prefs.js b/toolkit/mozapps/extensions/test/xpcshell/test_permissions_prefs.js index 00d4467ffac6..2bb68ca21b58 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_permissions_prefs.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_permissions_prefs.js @@ -50,7 +50,7 @@ function run_test() { do_check_permission_prefs(preferences); - // Import can also be triggerred by an observer notification by any other area + // Import can also be triggered by an observer notification by any other area // of code, such as a permissions management UI. // First, request to flush all permissions diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_strictcompatibility.js b/toolkit/mozapps/extensions/test/xpcshell/test_strictcompatibility.js index 3b84dadbf403..2f5d553a4d99 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_strictcompatibility.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_strictcompatibility.js @@ -106,7 +106,7 @@ const ADDONS = { compatible: [false, false, false, false], }, - // Extremely old addon - maxVersion is less than the mimimum compat version + // Extremely old addon - maxVersion is less than the minimum compat version // set in extensions.minCompatibleVersion "addon6@tests.mozilla.org": { "install.rdf": { diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_webextension_paths.js b/toolkit/mozapps/extensions/test/xpcshell/test_webextension_paths.js index 1f140619bbd1..ccccc47fc0b6 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_webextension_paths.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_webextension_paths.js @@ -9,7 +9,7 @@ add_task(async function setup() { }); // When installing an unpacked addon we derive the ID from the -// directory name. Make sure that if the directoy name is not a valid +// directory name. Make sure that if the directory name is not a valid // addon ID that we reject it. add_task(async function test_bad_unpacked_path() { let MANIFEST_ID = "webext_bad_path@tests.mozilla.org"; From abe47d910cbcd97c883b522ea73e9df4b2d9b9af Mon Sep 17 00:00:00 2001 From: Olli Pettay Date: Wed, 4 Apr 2018 19:19:54 +0300 Subject: [PATCH 30/88] Bug 1449268 - Treat document-level touch event listeners as passive, r=kats --HG-- extra : rebase_source : 0ea948a612dfbd46b80b52985f96685b012e0079 --- dom/events/EventListenerManager.cpp | 28 ++++++- dom/events/EventListenerManager.h | 4 +- dom/webidl/EventTarget.webidl | 2 +- .../mochitest/helper_tap_default_passive.html | 73 +++++++++++++++++++ gfx/layers/apz/test/mochitest/mochitest.ini | 1 + .../mochitest/test_group_touchevents.html | 5 +- 6 files changed, 106 insertions(+), 7 deletions(-) create mode 100644 gfx/layers/apz/test/mochitest/helper_tap_default_passive.html diff --git a/dom/events/EventListenerManager.cpp b/dom/events/EventListenerManager.cpp index bffb52b2a256..f708c3a5bc8d 100644 --- a/dom/events/EventListenerManager.cpp +++ b/dom/events/EventListenerManager.cpp @@ -690,15 +690,32 @@ void EventListenerManager::AddEventListenerByType( EventListenerHolder aListenerHolder, const nsAString& aType, - const EventListenerFlags& aFlags) + const EventListenerFlags& aFlags, + const Optional& aPassive) { RefPtr atom; EventMessage message = mIsMainThreadELM ? nsContentUtils::GetEventMessageAndAtomForListener(aType, getter_AddRefs(atom)) : eUnidentifiedEvent; + + EventListenerFlags flags = aFlags; + if (aPassive.WasPassed()) { + flags.mPassive = aPassive.Value(); + } else if (message == eTouchStart || message == eTouchMove) { + nsCOMPtr node; + nsCOMPtr win; + if ((win = GetTargetAsInnerWindow()) || + ((node = do_QueryInterface(mTarget)) && + (node == node->OwnerDoc() || + node == node->OwnerDoc()->GetRootElement() || + node == node->OwnerDoc()->GetBody()))) { + flags.mPassive = true; + } + } + AddEventListenerInternal(Move(aListenerHolder), - message, atom, aType, aFlags); + message, atom, aType, flags); } void @@ -1365,17 +1382,20 @@ EventListenerManager::AddEventListener( bool aWantsUntrusted) { EventListenerFlags flags; + Optional passive; if (aOptions.IsBoolean()) { flags.mCapture = aOptions.GetAsBoolean(); } else { const auto& options = aOptions.GetAsAddEventListenerOptions(); flags.mCapture = options.mCapture; flags.mInSystemGroup = options.mMozSystemGroup; - flags.mPassive = options.mPassive; flags.mOnce = options.mOnce; + if (options.mPassive.WasPassed()) { + passive.Construct(options.mPassive.Value()); + } } flags.mAllowUntrustedEvents = aWantsUntrusted; - return AddEventListenerByType(Move(aListenerHolder), aType, flags); + return AddEventListenerByType(Move(aListenerHolder), aType, flags, passive); } void diff --git a/dom/events/EventListenerManager.h b/dom/events/EventListenerManager.h index 0fb23a8d6f55..dd8868933cb5 100644 --- a/dom/events/EventListenerManager.h +++ b/dom/events/EventListenerManager.h @@ -317,7 +317,9 @@ public: } void AddEventListenerByType(EventListenerHolder aListener, const nsAString& type, - const EventListenerFlags& aFlags); + const EventListenerFlags& aFlags, + const dom::Optional& aPassive = + dom::Optional()); void RemoveEventListenerByType(nsIDOMEventListener *aListener, const nsAString& type, const EventListenerFlags& aFlags) diff --git a/dom/webidl/EventTarget.webidl b/dom/webidl/EventTarget.webidl index d5eadf58dae9..2d4adcb65c91 100644 --- a/dom/webidl/EventTarget.webidl +++ b/dom/webidl/EventTarget.webidl @@ -19,7 +19,7 @@ dictionary EventListenerOptions { }; dictionary AddEventListenerOptions : EventListenerOptions { - boolean passive = false; + boolean passive; boolean once = false; }; diff --git a/gfx/layers/apz/test/mochitest/helper_tap_default_passive.html b/gfx/layers/apz/test/mochitest/helper_tap_default_passive.html new file mode 100644 index 000000000000..99c570065e7c --- /dev/null +++ b/gfx/layers/apz/test/mochitest/helper_tap_default_passive.html @@ -0,0 +1,73 @@ + + + + + + Ensure APZ doesn't wait for passive listeners + + + + + + + Link to nowhere + + + diff --git a/gfx/layers/apz/test/mochitest/mochitest.ini b/gfx/layers/apz/test/mochitest/mochitest.ini index cb10f1526200..f7cc8cf8d5fd 100644 --- a/gfx/layers/apz/test/mochitest/mochitest.ini +++ b/gfx/layers/apz/test/mochitest/mochitest.ini @@ -41,6 +41,7 @@ helper_subframe_style.css helper_tall.html helper_tap.html + helper_tap_default_passive.html helper_tap_fullzoom.html helper_tap_passive.html helper_touch_action.html diff --git a/gfx/layers/apz/test/mochitest/test_group_touchevents.html b/gfx/layers/apz/test/mochitest/test_group_touchevents.html index 1a1a15bf1fd0..781a5afe20c4 100644 --- a/gfx/layers/apz/test/mochitest/test_group_touchevents.html +++ b/gfx/layers/apz/test/mochitest/test_group_touchevents.html @@ -68,13 +68,16 @@ var subtests = [ // instead. {'file': 'helper_long_tap.html', 'prefs': [["apz.test.fails_with_native_injection", isWindows]]}, - // For the following test, we want to make sure APZ doesn't wait for a content + // For the following tests, we want to make sure APZ doesn't wait for a content // response that is never going to arrive. To detect this we set the content response // timeout to a day, so that the entire test times out and fails if APZ does // end up waiting. {'file': 'helper_tap_passive.html', 'prefs': [["apz.content_response_timeout", 24 * 60 * 60 * 1000], ["apz.test.fails_with_native_injection", isWindows]]}, + {'file': 'helper_tap_default_passive.html', 'prefs': [["apz.content_response_timeout", 24 * 60 * 60 * 1000], + ["apz.test.fails_with_native_injection", isWindows]]}, + // Simple test to exercise touch-action CSS property {'file': 'helper_touch_action.html', 'prefs': touch_action_prefs}, // More complex touch-action tests, with overlapping regions and such From fd9a2235dca740e52b418b9f19e1caaeb5b31733 Mon Sep 17 00:00:00 2001 From: Gijs Kruitbosch Date: Wed, 28 Mar 2018 13:48:09 +0100 Subject: [PATCH 31/88] Bug 1449548, r=mconley,aswan --HG-- extra : rebase_source : da4499ca81e6cfea7fa7185fcc84b7f072368bc8 --- browser/base/content/browser-addons.js | 77 +++++++++++++------------- browser/base/content/content.js | 4 +- 2 files changed, 43 insertions(+), 38 deletions(-) diff --git a/browser/base/content/browser-addons.js b/browser/base/content/browser-addons.js index 1655b0556f4a..e29bf13a9591 100644 --- a/browser/base/content/browser-addons.js +++ b/browser/base/content/browser-addons.js @@ -543,6 +543,8 @@ var LightWeightThemeWebInstaller = { mm.addMessageListener("LightWeightThemeWebInstaller:Install", this); mm.addMessageListener("LightWeightThemeWebInstaller:Preview", this); mm.addMessageListener("LightWeightThemeWebInstaller:ResetPreview", this); + + XPCOMUtils.defineLazyPreferenceGetter(this, "_apiTesting", "extensions.webapi.testing", false); }, receiveMessage(message) { @@ -555,15 +557,15 @@ var LightWeightThemeWebInstaller = { switch (message.name) { case "LightWeightThemeWebInstaller:Install": { - this._installRequest(data.themeData, data.baseURI); + this._installRequest(data.themeData, data.principal, data.baseURI); break; } case "LightWeightThemeWebInstaller:Preview": { - this._preview(data.themeData, data.baseURI); + this._preview(data.themeData, data.principal, data.baseURI); break; } case "LightWeightThemeWebInstaller:ResetPreview": { - this._resetPreview(data && data.baseURI); + this._resetPreview(data && data.principal); break; } } @@ -585,33 +587,24 @@ var LightWeightThemeWebInstaller = { return this._manager = temp.LightweightThemeManager; }, - _installRequest(dataString, baseURI) { + _installRequest(dataString, principal, baseURI) { + // Don't allow installing off null principals. + if (!principal.URI) { + return; + } + let data = this._manager.parseTheme(dataString, baseURI); if (!data) { return; } - let uri = makeURI(baseURI); - // A notification bar with the option to undo is normally shown after a // theme is installed. But the discovery pane served from the url(s) // below has its own toggle switch for quick undos, so don't show the // notification in that case. - let notify = uri.prePath != "https://discovery.addons.mozilla.org"; - if (notify) { - try { - if (Services.prefs.getBoolPref("extensions.webapi.testing") - && (uri.prePath == "https://discovery.addons.allizom.org" - || uri.prePath == "https://discovery.addons-dev.allizom.org")) { - notify = false; - } - } catch (e) { - // getBoolPref() throws if the testing pref isn't set. ignore it. - } - } - - if (this._isAllowed(baseURI)) { + let notify = this._shouldShowUndoPrompt(principal); + if (this._isAllowed(principal)) { this._install(data, notify); return; } @@ -620,7 +613,7 @@ var LightWeightThemeWebInstaller = { header: gNavigatorBundle.getFormattedString("webextPerms.header", ["<>"]), addonName: data.name, text: gNavigatorBundle.getFormattedString("lwthemeInstallRequest.message2", - [uri.host]), + [principal.URI.host]), acceptText: gNavigatorBundle.getString("lwthemeInstallRequest.allowButton2"), acceptKey: gNavigatorBundle.getString("lwthemeInstallRequest.allowButton.accesskey2"), cancelText: gNavigatorBundle.getString("webextPerms.cancel.label"), @@ -649,8 +642,8 @@ var LightWeightThemeWebInstaller = { AddonManager.removeAddonListener(listener); }, - _preview(dataString, baseURI) { - if (!this._isAllowed(baseURI)) + _preview(dataString, principal, baseURI) { + if (!this._isAllowed(principal)) return; let data = this._manager.parseTheme(dataString, baseURI); @@ -662,27 +655,37 @@ var LightWeightThemeWebInstaller = { this._manager.previewTheme(data); }, - _resetPreview(baseURI) { - if (baseURI && !this._isAllowed(baseURI)) + _resetPreview(principal) { + if (!this._isAllowed(principal)) return; gBrowser.tabContainer.removeEventListener("TabSelect", this); this._manager.resetPreview(); }, - _isAllowed(srcURIString) { - let uri; - try { - uri = makeURI(srcURIString); - } catch (e) { - // makeURI fails if srcURIString is a nonsense URI - return false; - } - - if (!uri.schemeIs("https")) { + _isAllowed(principal) { + if (!principal || !principal.URI || !principal.URI.schemeIs("https")) { return false; } let pm = Services.perms; - return pm.testPermission(uri, "install") == pm.ALLOW_ACTION; - } + return pm.testPermission(principal.URI, "install") == pm.ALLOW_ACTION; + }, + + _shouldShowUndoPrompt(principal) { + if (!principal || !principal.URI) { + return true; + } + + let prePath = principal.URI.prePath; + if (prePath == "https://discovery.addons.mozilla.org") { + return false; + } + + if (this._apiTesting && (prePath == "https://discovery.addons.allizom.org" || + prePath == "https://discovery.addons-dev.allizom.org")) { + return false; + } + return true; + }, + }; diff --git a/browser/base/content/content.js b/browser/base/content/content.js index 2a54cf2cb60e..b1d2c17825e5 100644 --- a/browser/base/content/content.js +++ b/browser/base/content/content.js @@ -1008,6 +1008,7 @@ var LightWeightThemeWebInstallListener = { case "InstallBrowserTheme": { sendAsyncMessage("LightWeightThemeWebInstaller:Install", { baseURI: event.target.baseURI, + principal: event.target.nodePrincipal, themeData: event.target.getAttribute("data-browsertheme"), }); break; @@ -1015,6 +1016,7 @@ var LightWeightThemeWebInstallListener = { case "PreviewBrowserTheme": { sendAsyncMessage("LightWeightThemeWebInstaller:Preview", { baseURI: event.target.baseURI, + principal: event.target.nodePrincipal, themeData: event.target.getAttribute("data-browsertheme"), }); this._previewWindow = event.target.ownerGlobal; @@ -1029,7 +1031,7 @@ var LightWeightThemeWebInstallListener = { case "ResetBrowserThemePreview": { if (this._previewWindow) { sendAsyncMessage("LightWeightThemeWebInstaller:ResetPreview", - {baseURI: event.target.baseURI}); + {principal: event.target.nodePrincipal}); this._resetPreviewWindow(); } break; From 59dd18e6c40f8743c0e400c887201c222b5a37ea Mon Sep 17 00:00:00 2001 From: Tom Prince Date: Tue, 20 Mar 2018 11:24:06 -0600 Subject: [PATCH 32/88] Bug 1421062: Configure beetmover workers via global taskgraph config; r=aki Differential Revision: https://phabricator.services.mozilla.com/D781 --HG-- extra : rebase_source : 40bc39af068fc5877a5fd6423739e4248105e089 extra : histedit_source : 77483e68671290e5a2882e681c16f5e0abe79069 --- taskcluster/ci/beetmover-cdns/kind.yml | 5 ----- taskcluster/ci/config.yml | 5 +++++ taskcluster/taskgraph/transforms/beetmover.py | 5 +++-- taskcluster/taskgraph/transforms/beetmover_cdns.py | 11 +++-------- .../taskgraph/transforms/beetmover_checksums.py | 5 +++-- .../taskgraph/transforms/beetmover_repackage.py | 5 +++-- 6 files changed, 17 insertions(+), 19 deletions(-) diff --git a/taskcluster/ci/beetmover-cdns/kind.yml b/taskcluster/ci/beetmover-cdns/kind.yml index 218bb84f61a3..b1d00c885449 100644 --- a/taskcluster/ci/beetmover-cdns/kind.yml +++ b/taskcluster/ci/beetmover-cdns/kind.yml @@ -14,11 +14,6 @@ kind-dependencies: - release-generate-checksums job-defaults: - worker-type: - by-project: - mozilla-release: scriptworker-prov-v1/beetmoverworker-v1 - mozilla-beta: scriptworker-prov-v1/beetmoverworker-v1 - default: scriptworker-prov-v1/beetmoverworker-dev run-on-projects: [] shipping-phase: push diff --git a/taskcluster/ci/config.yml b/taskcluster/ci/config.yml index cedc366cb31e..5d40847c2a24 100755 --- a/taskcluster/ci/config.yml +++ b/taskcluster/ci/config.yml @@ -108,3 +108,8 @@ scriptworker: - 'project:releng:signing:cert:nightly-signing' 'scriptworker-prov-v1/depsigning': - 'project:releng:signing:cert:dep-signing' + 'scriptworker-prov-v1/beetmoverworker-v1': + - 'project:releng:beetmover:bucket:release' + - 'project:releng:beetmover:bucket:nightly' + 'scriptworker-prov-v1/beetmoverworker-dev': + - 'project:releng:beetmover:bucket:dep' diff --git a/taskcluster/taskgraph/transforms/beetmover.py b/taskcluster/taskgraph/transforms/beetmover.py index 1df6cb867299..892253d22bd0 100644 --- a/taskcluster/taskgraph/transforms/beetmover.py +++ b/taskcluster/taskgraph/transforms/beetmover.py @@ -12,7 +12,8 @@ from taskgraph.util.attributes import copy_attributes_from_dependent_job from taskgraph.util.schema import validate_schema, Schema from taskgraph.util.scriptworker import (get_beetmover_bucket_scope, get_beetmover_action_scope, - get_phase) + get_phase, + get_worker_type_for_scope) from taskgraph.transforms.task import task_description_schema from voluptuous import Any, Required, Optional @@ -380,7 +381,7 @@ def make_task_description(config, jobs): task = { 'label': label, 'description': description, - 'worker-type': 'scriptworker-prov-v1/beetmoverworker-v1', + 'worker-type': get_worker_type_for_scope(config, bucket_scope), 'scopes': [bucket_scope, action_scope], 'dependencies': dependencies, 'attributes': attributes, diff --git a/taskcluster/taskgraph/transforms/beetmover_cdns.py b/taskcluster/taskgraph/transforms/beetmover_cdns.py index 7bb35164580d..b5fb73456dda 100644 --- a/taskcluster/taskgraph/transforms/beetmover_cdns.py +++ b/taskcluster/taskgraph/transforms/beetmover_cdns.py @@ -9,10 +9,11 @@ from __future__ import absolute_import, print_function, unicode_literals from taskgraph.transforms.base import TransformSequence from taskgraph.util.schema import ( - optionally_keyed_by, resolve_keyed_by, validate_schema, Schema + validate_schema, Schema, ) from taskgraph.util.scriptworker import ( get_beetmover_bucket_scope, get_beetmover_action_scope, + get_worker_type_for_scope, ) from taskgraph.transforms.job import job_description_schema from taskgraph.transforms.task import task_description_schema @@ -37,7 +38,6 @@ beetmover_cdns_description_schema = Schema({ Optional('job-from'): task_description_schema['job-from'], Optional('run'): {basestring: object}, Optional('run-on-projects'): task_description_schema['run-on-projects'], - Required('worker-type'): optionally_keyed_by('project', basestring), Optional('dependencies'): {basestring: taskref_or_string}, Optional('index'): {basestring: basestring}, Optional('routes'): [basestring], @@ -73,18 +73,13 @@ def make_beetmover_cdns_description(config, jobs): ) ) - resolve_keyed_by( - job, 'worker-type', item_name=job['name'], - project=config.params['project'] - ) - bucket_scope = get_beetmover_bucket_scope(config) action_scope = get_beetmover_action_scope(config) task = { 'label': label, 'description': description, - 'worker-type': job['worker-type'], + 'worker-type': get_worker_type_for_scope(config, bucket_scope), 'scopes': [bucket_scope, action_scope], 'product': job['product'], 'dependencies': job['dependencies'], diff --git a/taskcluster/taskgraph/transforms/beetmover_checksums.py b/taskcluster/taskgraph/transforms/beetmover_checksums.py index edde36dda65a..b3154249e23f 100644 --- a/taskcluster/taskgraph/transforms/beetmover_checksums.py +++ b/taskcluster/taskgraph/transforms/beetmover_checksums.py @@ -12,7 +12,8 @@ from taskgraph.transforms.beetmover import craft_release_properties from taskgraph.util.attributes import copy_attributes_from_dependent_job from taskgraph.util.schema import validate_schema, Schema from taskgraph.util.scriptworker import (get_beetmover_bucket_scope, - get_beetmover_action_scope) + get_beetmover_action_scope, + get_worker_type_for_scope) from taskgraph.transforms.task import task_description_schema from voluptuous import Any, Required, Optional @@ -100,7 +101,7 @@ def make_beetmover_checksums_description(config, jobs): task = { 'label': label, 'description': description, - 'worker-type': 'scriptworker-prov-v1/beetmoverworker-v1', + 'worker-type': get_worker_type_for_scope(config, bucket_scope), 'scopes': [bucket_scope, action_scope], 'dependencies': dependencies, 'attributes': attributes, diff --git a/taskcluster/taskgraph/transforms/beetmover_repackage.py b/taskcluster/taskgraph/transforms/beetmover_repackage.py index f8b1eb34d340..c4bb60eb8e4b 100644 --- a/taskcluster/taskgraph/transforms/beetmover_repackage.py +++ b/taskcluster/taskgraph/transforms/beetmover_repackage.py @@ -16,7 +16,8 @@ from taskgraph.util.partials import (get_balrog_platform_name, from taskgraph.util.schema import validate_schema, Schema from taskgraph.util.scriptworker import (get_beetmover_bucket_scope, get_beetmover_action_scope, - get_phase) + get_phase, + get_worker_type_for_scope) from taskgraph.transforms.task import task_description_schema from voluptuous import Any, Required, Optional @@ -236,7 +237,7 @@ def make_task_description(config, jobs): task = { 'label': label, 'description': description, - 'worker-type': 'scriptworker-prov-v1/beetmoverworker-v1', + 'worker-type': get_worker_type_for_scope(config, bucket_scope), 'scopes': [bucket_scope, action_scope], 'dependencies': dependencies, 'attributes': attributes, From d594fa479b84d1e2f7b57255e64477e143b2911d Mon Sep 17 00:00:00 2001 From: Tom Prince Date: Tue, 20 Mar 2018 11:25:15 -0600 Subject: [PATCH 33/88] Bug 1421062: Use nightly beetmover config by default on try; r=aki Differential Revision: https://phabricator.services.mozilla.com/D782 --HG-- extra : rebase_source : 6bfbdb8a34fb018cf30db5961ea6c4a7986da07f extra : histedit_source : 0cf351793f97f580e7efcb5e7ff5f178d0cca482 --- taskcluster/taskgraph/util/scriptworker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/taskcluster/taskgraph/util/scriptworker.py b/taskcluster/taskgraph/util/scriptworker.py index 1df994ee0786..8e1a0212e30e 100644 --- a/taskcluster/taskgraph/util/scriptworker.py +++ b/taskcluster/taskgraph/util/scriptworker.py @@ -143,7 +143,7 @@ BEETMOVER_ACTION_SCOPES = { 'all-candidates-tasks': 'beetmover:action:push-to-candidates', 'all-push-tasks': 'beetmover:action:push-to-releases', 'all-nightly-tasks': 'beetmover:action:push-to-nightly', - 'default': 'beetmover:action:push-to-staging', + 'default': 'beetmover:action:push-to-nightly', } From 5a1fdd4a2644db24fa98d7048468697e7238c185 Mon Sep 17 00:00:00 2001 From: Tom Prince Date: Thu, 22 Mar 2018 11:44:36 -0600 Subject: [PATCH 34/88] Bug 1421062: Use `Thunderbird` as the product in comm-central beetmover tasks; r=aki Differential Revision: https://phabricator.services.mozilla.com/D783 --HG-- extra : rebase_source : 4c51948a47fb17989c79edf3d26d06c6c9c7fa09 extra : histedit_source : d239554a3e11c03e58acc0612c271726346605ab --- taskcluster/taskgraph/transforms/beetmover.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/taskcluster/taskgraph/transforms/beetmover.py b/taskcluster/taskgraph/transforms/beetmover.py index 892253d22bd0..05c7dc5418ac 100644 --- a/taskcluster/taskgraph/transforms/beetmover.py +++ b/taskcluster/taskgraph/transforms/beetmover.py @@ -453,10 +453,16 @@ def craft_release_properties(config, job): else: build_platform = build_platform.replace('-source', '') - app_name = 'Fennec' if 'android' in job['label'] or 'fennec' in job['label'] else 'Firefox' + # XXX This should be explicitly set via build attributes or something + if 'android' in job['label'] or 'fennec' in job['label']: + app_name = 'Fennec' + elif config.graph_config['trust-domain'] == 'comm': + app_name = 'Thunderbird' + else: + # XXX Even DevEdition is called Firefox + app_name = 'Firefox' return { - # XXX Even DevEdition is called Firefox 'app-name': app_name, 'app-version': str(params['app_version']), 'branch': params['project'], From cc64345766dcf6768be4e5c7d6417bc3cef9d695 Mon Sep 17 00:00:00 2001 From: Dan Minor Date: Wed, 28 Mar 2018 11:07:54 -0400 Subject: [PATCH 35/88] Bug 1432793 - Force screensharing simulcast to one layer and stop generating layers once an odd width and height are found; r=bwc This limits screensharing simulcast to a single layer. When window sharing, our source video can have arbitrary dimensions. If one of those dimensions ends up being odd, the aspect ratio of the smaller layer will not match the aspect ratio of the odd sized layer, causing a runtime assertion failure and crash. It is not sufficient to prevent the creation of odd sized layers in CreateEncoderStreams because the user can resize the window while it is being shared, which will cause a fatal assertion prior to the streams being recreated. When switching back from window sharing to camera, a call to CreateEncoderStreams will occur with resolutions matching the dimensions of the window that was just shared. To prevent a crash, this also adds a check which prevents the creation of layers with odd resolutions. Looking at cricket::GetSimulcastConfig for the version of webrtc.org in tree, the number of simulcast layers is limited to one, or two if a field experiment is enabled. That code also limits resolutions at which screensharing is allowed as well as the number of layers that can be created for each resolution, and ensures that each layer is exactly half the size of the layer above. Adding these new constraints to CreateEncoderStreams makes us more consistent with what the webrtc.org code would do when creating streams, which should help to avoid more assertion failures in the future. Long term, I believe we should just switch to using cricket::GetSimulcastConfig. MozReview-Commit-ID: 8gjdY5GPPjl --HG-- extra : rebase_source : 5a22f6d0a995303e6a4039eafc056631fbb86415 --- .../signaling/src/media-conduit/VideoConduit.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp index 159f4c6571f2..f5344a115dc3 100644 --- a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp +++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp @@ -581,7 +581,20 @@ std::vector WebrtcVideoConduit::VideoStreamFactory::CreateEncoderStreams(int width, int height, const webrtc::VideoEncoderConfig& config) { - auto streamCount = config.number_of_streams; + size_t streamCount = config.number_of_streams; + + // Disallow odd width and height, they will cause aspect ratio checks to + // fail in the webrtc.org code. We can hit transient states after window + // sharing ends where odd resolutions are requested for the camera. + streamCount = std::min(streamCount, + 1UL + std::min(CountTrailingZeroes32(width), + CountTrailingZeroes32(height))); + + // We only allow one layer when screensharing + if (mConduit->mCodecMode == webrtc::VideoCodecMode::kScreensharing) { + streamCount = 1; + } + std::vector streams; streams.reserve(streamCount); MOZ_ASSERT(mConduit); From 5f8fb5e719b44381ef3ddadb537d4acab02f4898 Mon Sep 17 00:00:00 2001 From: Felipe Gomes Date: Wed, 4 Apr 2018 17:47:43 -0300 Subject: [PATCH 36/88] Bug 1450761 - Follow-up, remove check that was added in the previous version of the patch, but is not needed anymore. r=fgomes This check broke the test browser_bug435325.js. I believe that test is wrong, but this should make it pass again. I'll file a bug to look into it --- browser/base/content/content.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/base/content/content.js b/browser/base/content/content.js index b1d2c17825e5..e4b7c82f02ed 100644 --- a/browser/base/content/content.js +++ b/browser/base/content/content.js @@ -739,7 +739,7 @@ var ClickEventHandler = { } // Handle click events from about pages - if (event.button == 0 && !originalTarget.disabled) { + if (event.button == 0) { if (AboutNetAndCertErrorListener.isAboutCertError(ownerDoc)) { this.onCertError(originalTarget, ownerDoc.defaultView); return; From 2e33871511b0d21efc459d1f20b2489b157b9f6a Mon Sep 17 00:00:00 2001 From: Narcis Beleuzu Date: Thu, 5 Apr 2018 00:16:14 +0300 Subject: [PATCH 37/88] Backed out changeset 847e9f622eb7 (bug 1432793) for build bustages on VideoConduit.cpp. CLOSED TREE --- .../signaling/src/media-conduit/VideoConduit.cpp | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp index f5344a115dc3..159f4c6571f2 100644 --- a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp +++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp @@ -581,20 +581,7 @@ std::vector WebrtcVideoConduit::VideoStreamFactory::CreateEncoderStreams(int width, int height, const webrtc::VideoEncoderConfig& config) { - size_t streamCount = config.number_of_streams; - - // Disallow odd width and height, they will cause aspect ratio checks to - // fail in the webrtc.org code. We can hit transient states after window - // sharing ends where odd resolutions are requested for the camera. - streamCount = std::min(streamCount, - 1UL + std::min(CountTrailingZeroes32(width), - CountTrailingZeroes32(height))); - - // We only allow one layer when screensharing - if (mConduit->mCodecMode == webrtc::VideoCodecMode::kScreensharing) { - streamCount = 1; - } - + auto streamCount = config.number_of_streams; std::vector streams; streams.reserve(streamCount); MOZ_ASSERT(mConduit); From 38a7560378d055391b236b1f1bb89311fd56289c Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Wed, 4 Apr 2018 14:45:34 -0500 Subject: [PATCH 38/88] Bug 1450307 - Paper over a crash in WebRenderCommandBuilder::GenerateFallbackData. r=kats --HG-- extra : rebase_source : 0423b6dd01a39118b35e399f2af3bf190c6ff9c4 extra : amend_source : 256fc6ea4e213546be4ae909c63d90037c2e6d57 --- gfx/layers/wr/WebRenderCommandBuilder.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gfx/layers/wr/WebRenderCommandBuilder.cpp b/gfx/layers/wr/WebRenderCommandBuilder.cpp index 27185fd83a31..a55882138721 100644 --- a/gfx/layers/wr/WebRenderCommandBuilder.cpp +++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp @@ -1613,6 +1613,13 @@ WebRenderCommandBuilder::GenerateFallbackData(nsDisplayItem* aItem, scaledBounds.Scale(scale.width, scale.height); LayerIntSize dtSize = RoundedToInt(scaledBounds).Size(); + // TODO Rounding a rect to integers and then taking the size gives a different behavior than + // just rounding the size of the rect to integers. This can cause a crash, but fixing the + // difference causes some test failures so this is a quick fix + if (dtSize.width <= 0 || dtSize.height <= 0) { + return nullptr; + } + bool needPaint = true; LayoutDeviceIntPoint offset = RoundedToInt(bounds.TopLeft()); aImageRect = LayoutDeviceRect(offset, LayoutDeviceSize(RoundedToInt(bounds).Size())); From 7068793c783343b9110a5ab20e2543e5315f9c07 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 4 Apr 2018 14:19:31 -0700 Subject: [PATCH 39/88] Bug 1437998 - Remove SimpleGestureEvent and OfflineResourceList from kInterfaceShims. r=bz MozReview-Commit-ID: HRQ2rux6tcT --- dom/base/nsGlobalWindowInner.cpp | 2 -- js/xpconnect/tests/mochitest/test_bug790732.html | 4 ---- 2 files changed, 6 deletions(-) diff --git a/dom/base/nsGlobalWindowInner.cpp b/dom/base/nsGlobalWindowInner.cpp index 79931210690e..e451ede77135 100644 --- a/dom/base/nsGlobalWindowInner.cpp +++ b/dom/base/nsGlobalWindowInner.cpp @@ -2848,10 +2848,8 @@ const InterfaceShimEntry kInterfaceShimMap[] = { "nsIDOMMouseEvent", "MouseEvent" }, { "nsIDOMMouseScrollEvent", "MouseScrollEvent" }, { "nsIDOMMutationEvent", "MutationEvent" }, - { "nsIDOMSimpleGestureEvent", "SimpleGestureEvent" }, { "nsIDOMUIEvent", "UIEvent" }, { "nsIDOMHTMLMediaElement", "HTMLMediaElement" }, - { "nsIDOMOfflineResourceList", "OfflineResourceList" }, { "nsIDOMRange", "Range" }, { "nsIDOMSVGLength", "SVGLength" }, // Think about whether Ci.nsINodeFilter can just go away for websites! diff --git a/js/xpconnect/tests/mochitest/test_bug790732.html b/js/xpconnect/tests/mochitest/test_bug790732.html index 34f70f665f9a..4d6995ebdd7a 100644 --- a/js/xpconnect/tests/mochitest/test_bug790732.html +++ b/js/xpconnect/tests/mochitest/test_bug790732.html @@ -33,12 +33,8 @@ async function doTest() { is(Ci.nsIDOMMouseEvent, MouseEvent); is(Ci.nsIDOMMouseScrollEvent, MouseScrollEvent); is(Ci.nsIDOMMutationEvent, MutationEvent); - // XXX We can't test this here because it's only exposed to chrome - //is(Ci.nsIDOMSimpleGestureEvent, SimpleGestureEvent); is(Ci.nsIDOMUIEvent, UIEvent); is(Ci.nsIDOMHTMLMediaElement, HTMLMediaElement); - // We can't test this here as it's been restricted to secure contexts in non release - //is(Ci.nsIDOMOfflineResourceList, OfflineResourceList); is(Ci.nsIDOMRange, Range); is(Ci.nsIDOMNodeFilter, NodeFilter); is(Ci.nsIDOMXPathResult, XPathResult); From 17366b0162285800206a2f1e267e0461521169e9 Mon Sep 17 00:00:00 2001 From: Ekanan Ketunuti Date: Tue, 3 Apr 2018 11:42:28 +0700 Subject: [PATCH 40/88] Bug 1450620 - Add words to en-US dictionary. r=ehsan --- .../locales/en-US/hunspell/en-US.dic | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/extensions/spellcheck/locales/en-US/hunspell/en-US.dic b/extensions/spellcheck/locales/en-US/hunspell/en-US.dic index 19decaf5ea8d..7ac2234e9605 100644 --- a/extensions/spellcheck/locales/en-US/hunspell/en-US.dic +++ b/extensions/spellcheck/locales/en-US/hunspell/en-US.dic @@ -1,4 +1,4 @@ -52568 +52579 0/nm 0th/pt 1/n1 @@ -23075,6 +23075,7 @@ discourage/LGDS discouragement/SM discouraging/Y discover/ABSDG +discoverability discovered/U discoverer/MS discovery/ASM @@ -23494,6 +23495,8 @@ doorstepping doorstop/MS doorway/SM dooryard/MS +doozie +doozy dopa/M dopamine dope/MZGDRS @@ -23900,7 +23903,7 @@ duper/M duple duplex/MS duplicate's -duplicate/AGNDS +duplicate/AGNDSV duplication/AM duplicator/MS duplicitous @@ -27777,6 +27780,7 @@ germicide/MS germinal/M germinate/GNDS germination/M +gerontocracy gerontological gerontologist/MS gerontology/M @@ -32154,6 +32158,7 @@ kaffeeklatch/MS kaffeeklatsch/MS kahuna/S kaiser/MS +kakistocracy kale/M kaleidoscope/MS kaleidoscopic @@ -36962,6 +36967,7 @@ nympho/S nymphomania/M nymphomaniac/SM nymphs +nystagmus née o o'clock @@ -39636,7 +39642,7 @@ playtime/M playwright/SM plaza/MS plea/MS -plead/DRZGSJ +plead/DRZGSJA pleader/M pleading/MY pleasant/UTYP @@ -40194,6 +40200,7 @@ practice/DSMGB practiced/U practicum/SM practitioner/SM +praecipe praetor/SM praetorian pragmatic/MS @@ -42086,6 +42093,7 @@ registrant/MS registrar/MS registration/SM registry/SM +reglet regnant regress/MDSGV regression/MS @@ -43585,7 +43593,7 @@ schedule's schedule/ADSG scheduled/U scheduler/S -schema +schema/S schemata schematic/SM schematically @@ -46721,6 +46729,7 @@ stopper/GSMD stopping/U stopple/DSMG stopwatch/MS +stopword/S storage/M store's store/ADSG @@ -51814,6 +51823,7 @@ wickedness/M wicker/M wickerwork/M wicket/SM +wicking/S wide/YTRP widemouthed widen/SDRZG @@ -52299,6 +52309,7 @@ xcix xcvi xcvii xenon/M +xenophile/S xenophobe/MS xenophobia/M xenophobic From 66569d7e3785a836aeb13dec78090b3689029298 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Thu, 5 Apr 2018 08:08:30 +1000 Subject: [PATCH 41/88] Bug 1447056 part 1 - Move eWindowType_sheet to be before eWindowType_popup. r=mstange nsBaseWidget::BoundsUseDesktopPixels() states that window types before eWindowType_sheet take desktop pixels rather than device pixels for parameters of Move and Resize. Cocoa widget seems to treat all of them as desktop pixels, and sheet is one of the window types that it can actually open, so it should be put before popup so that BoundsUseDesktopPixels() is correct on that. MozReview-Commit-ID: FPqOoUQlQCy --HG-- extra : rebase_source : cf625c6bf75888abfdf2393b3c3937a073c3b613 extra : source : e2080039ee9e7270b87a5512927bb151a1154b3f --- widget/nsWidgetInitData.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/widget/nsWidgetInitData.h b/widget/nsWidgetInitData.h index 94cdb9c96c91..0eda097dc383 100644 --- a/widget/nsWidgetInitData.h +++ b/widget/nsWidgetInitData.h @@ -16,6 +16,7 @@ enum nsWindowType { eWindowType_toplevel, // default top level window eWindowType_dialog, // top level window but usually handled differently // by the OS + eWindowType_sheet, // MacOSX sheet (special dialog class) eWindowType_popup, // used for combo boxes, etc eWindowType_child, // child windows (contained inside a window on the // desktop (has no border)) @@ -23,7 +24,6 @@ enum nsWindowType { eWindowType_plugin, // plugin window eWindowType_plugin_ipc_chrome, // chrome side native widget for plugins (e10s) eWindowType_plugin_ipc_content, // content side puppet widget for plugins (e10s) - eWindowType_sheet, // MacOSX sheet (special dialog class) }; /** From 0b8abfb678dd4d4930044aea057f274a1e4e17e8 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Thu, 5 Apr 2018 08:08:30 +1000 Subject: [PATCH 42/88] Bug 1447056 part 2 - Invoke Resize in SetSizeConstraints with the current size to apply the new constraints. r=bz MozReview-Commit-ID: 9kRcDHTPCqt --HG-- extra : rebase_source : 767c063284685f5e2b5a9af873c5ed2b3e99e3d1 extra : source : 5dbfc09ffece8bf2fcaeaa5a248e5fd3fe65d911 --- toolkit/content/tests/chrome/chrome.ini | 2 + .../chrome/test_window_intrinsic_size.xul | 44 +++++++++++++++++++ .../tests/chrome/window_intrinsic_size.xul | 7 +++ widget/nsBaseWidget.cpp | 31 ++++++++++++- 4 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 toolkit/content/tests/chrome/test_window_intrinsic_size.xul create mode 100644 toolkit/content/tests/chrome/window_intrinsic_size.xul diff --git a/toolkit/content/tests/chrome/chrome.ini b/toolkit/content/tests/chrome/chrome.ini index f14fbc876449..15bc6cf55a68 100644 --- a/toolkit/content/tests/chrome/chrome.ini +++ b/toolkit/content/tests/chrome/chrome.ini @@ -185,6 +185,8 @@ skip-if = (os == 'mac' && os_version == '10.10') || (os == 'win') # Bug 1141245, [test_tree_hier_cell.xul] [test_tree_single.xul] [test_tree_view.xul] +[test_window_intrinsic_size.xul] +support-files = window_intrinsic_size.xul # test_panel_focus.xul won't work if the Full Keyboard Access preference is set to # textboxes and lists only, so skip this test on Mac [test_panel_focus.xul] diff --git a/toolkit/content/tests/chrome/test_window_intrinsic_size.xul b/toolkit/content/tests/chrome/test_window_intrinsic_size.xul new file mode 100644 index 000000000000..5bb6cca27bb7 --- /dev/null +++ b/toolkit/content/tests/chrome/test_window_intrinsic_size.xul @@ -0,0 +1,44 @@ + + + + + + +

+

+ +
+
+ +
diff --git a/toolkit/content/tests/chrome/window_intrinsic_size.xul b/toolkit/content/tests/chrome/window_intrinsic_size.xul new file mode 100644 index 000000000000..08bad28e9bf0 --- /dev/null +++ b/toolkit/content/tests/chrome/window_intrinsic_size.xul @@ -0,0 +1,7 @@ + + + +
+
diff --git a/widget/nsBaseWidget.cpp b/widget/nsBaseWidget.cpp index 8a195ad14a59..87aee3c4e137 100644 --- a/widget/nsBaseWidget.cpp +++ b/widget/nsBaseWidget.cpp @@ -1761,8 +1761,35 @@ nsBaseWidget::ResolveIconName(const nsAString &aIconName, void nsBaseWidget::SetSizeConstraints(const SizeConstraints& aConstraints) { mSizeConstraints = aConstraints; - // We can't ensure that the size is honored at this point because we're - // probably in the middle of a reflow. + + // Popups are constrained during layout, and we don't want to synchronously + // paint from reflow, so bail out... This is not great, but it's no worse than + // what we used to do. + // + // The right fix here is probably making constraint changes go through the + // view manager and such. + if (mWindowType == eWindowType_popup) { + return; + } + + // If the current size doesn't meet the new constraints, trigger a + // resize to apply it. Note that, we don't want to invoke Resize if + // the new constraints don't affect the current size, because Resize + // implementation on some platforms may touch other geometry even if + // the size don't need to change. + LayoutDeviceIntSize curSize = mBounds.Size(); + LayoutDeviceIntSize clampedSize = + Max(aConstraints.mMinSize, Min(aConstraints.mMaxSize, curSize)); + if (clampedSize != curSize) { + gfx::Size size; + if (BoundsUseDesktopPixels()) { + DesktopSize desktopSize = clampedSize / GetDesktopToDeviceScale(); + size = desktopSize.ToUnknownSize(); + } else { + size = gfx::Size(clampedSize.ToUnknownSize()); + } + Resize(size.width, size.height, true); + } } const widget::SizeConstraints nsBaseWidget::GetSizeConstraints() From 055220511d15c11e38b9f47714b7913ab9693a5f Mon Sep 17 00:00:00 2001 From: Aki Sasaki Date: Wed, 4 Apr 2018 15:28:23 -0700 Subject: [PATCH 43/88] bug 1451531 - beetmover-cdns should depend on release-generate-checksums-beetmover. r=nthomas --HG-- extra : rebase_source : 032f56ae77969c80d425a0a465b525b2aa24b8f5 --- taskcluster/ci/beetmover-cdns/kind.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/taskcluster/ci/beetmover-cdns/kind.yml b/taskcluster/ci/beetmover-cdns/kind.yml index b1d00c885449..127e96b003da 100644 --- a/taskcluster/ci/beetmover-cdns/kind.yml +++ b/taskcluster/ci/beetmover-cdns/kind.yml @@ -11,7 +11,7 @@ transforms: - taskgraph.transforms.task:transforms kind-dependencies: - - release-generate-checksums + - release-generate-checksums-beetmover job-defaults: run-on-projects: [] From eb32c7230c214bf48351903dbcd8d538e0e12876 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Wed, 4 Apr 2018 16:05:11 -0400 Subject: [PATCH 44/88] Bug 1450162. Use an Entry type instead of tuples. r=mstange This will make things a bit cleaner when interacting with the upcoming cache. --- gfx/webrender_bindings/src/moz2d_renderer.rs | 68 +++++++++++--------- 1 file changed, 38 insertions(+), 30 deletions(-) diff --git a/gfx/webrender_bindings/src/moz2d_renderer.rs b/gfx/webrender_bindings/src/moz2d_renderer.rs index 81b07b72f041..2708c2c56c03 100644 --- a/gfx/webrender_bindings/src/moz2d_renderer.rs +++ b/gfx/webrender_bindings/src/moz2d_renderer.rs @@ -2,7 +2,8 @@ use webrender::api::*; use bindings::{ByteSlice, MutByteSlice, wr_moz2d_render_cb, ArcVecU8}; use rayon::ThreadPool; -use std::collections::hash_map::{HashMap, Entry}; +use std::collections::hash_map::HashMap; +use std::collections::hash_map; use std::mem; use std::os::raw::c_void; use std::ptr; @@ -131,6 +132,13 @@ struct BlobReader<'a> { begin: usize, } +struct Entry { + bounds: Box2d, + begin: usize, + end: usize, + extra_end: usize, +} + impl<'a> BlobReader<'a> { fn new(buf: &'a[u8]) -> BlobReader<'a> { // The offset of the index is at the end of the buffer. @@ -140,11 +148,11 @@ impl<'a> BlobReader<'a> { BlobReader { reader: BufReader::new(&buf[index_offset..index_offset_pos]), begin: 0 } } - fn read_entry(&mut self) -> (usize, usize, usize, Box2d) { + fn read_entry(&mut self) -> Entry { let end = self.reader.read(); let extra_end = self.reader.read(); let bounds = self.reader.read(); - let ret = (self.begin, end, extra_end, bounds); + let ret = Entry { begin: self.begin, end, extra_end, bounds }; self.begin = extra_end; ret } @@ -214,9 +222,9 @@ impl From for Box2d { fn dump_blob_index(blob: &[u8], dirty_rect: Box2d) { let mut index = BlobReader::new(blob); while index.reader.has_more() { - let (_, _, _, bounds) = index.read_entry(); - dlog!(" {:?} {}", bounds, - if bounds.contained_by(&dirty_rect) { + let e = index.read_entry(); + dlog!(" {:?} {}", e.bounds, + if e.bounds.contained_by(&dirty_rect) { "*" } else { "" @@ -229,8 +237,8 @@ fn check_result(result: &[u8]) -> () { let mut index = BlobReader::new(result); assert!(index.reader.has_more(), "Unexpectedly empty result. This blob should just have been deleted"); while index.reader.has_more() { - let (_, end, extra, bounds) = index.read_entry(); - dlog!("result bounds: {} {} {:?}", end, extra, bounds); + let e = index.read_entry(); + dlog!("result bounds: {} {} {:?}", e.end, e.extra_end, e.bounds); } } @@ -241,38 +249,38 @@ fn check_result(result: &[u8]) -> () { Old items contained in the dirty_rect are dropped and new items are retained. */ -fn merge_blob_images(old: &[u8], new: &[u8], dirty_rect: Box2d) -> Vec { +fn merge_blob_images(old_buf: &[u8], new_buf: &[u8], dirty_rect: Box2d) -> Vec { let mut result = BlobWriter::new(); dlog!("dirty rect: {:?}", dirty_rect); dlog!("old:"); - dump_blob_index(old, dirty_rect); + dump_blob_index(old_buf, dirty_rect); dlog!("new:"); - dump_blob_index(new, dirty_rect); + dump_blob_index(new_buf, dirty_rect); - let mut old_reader = BlobReader::new(old); - let mut new_reader = BlobReader::new(new); + let mut old_reader = BlobReader::new(old_buf); + let mut new_reader = BlobReader::new(new_buf); // Loop over both new and old entries merging them. // Both new and old must have the same number of entries that // overlap but are not contained by the dirty rect, and they // must be in the same order. while new_reader.reader.has_more() { - let (new_begin, new_end, new_extra, new_bounds) = new_reader.read_entry(); - dlog!("bounds: {} {} {:?}", new_end, new_extra, new_bounds); - if new_bounds.contained_by(&dirty_rect) { - result.new_entry(new_extra - new_end, new_bounds, &new[new_begin..new_extra]); + let new = new_reader.read_entry(); + dlog!("bounds: {} {} {:?}", new.end, new.extra_end, new.bounds); + if new.bounds.contained_by(&dirty_rect) { + result.new_entry(new.extra_end - new.end, new.bounds, &new_buf[new.begin..new.extra_end]); } else { loop { assert!(old_reader.reader.has_more()); - let (old_begin, old_end, old_extra, old_bounds) = old_reader.read_entry(); - dlog!("new bounds: {} {} {:?}", old_end, old_extra, old_bounds); - if old_bounds.contained_by(&dirty_rect) { + let old = old_reader.read_entry(); + dlog!("new bounds: {} {} {:?}", old.end, old.extra_end, old.bounds); + if old.bounds.contained_by(&dirty_rect) { // fully contained items will be discarded or replaced } else { - assert_eq!(old_bounds, new_bounds); + assert_eq!(old.bounds, new.bounds); // we found a matching item use the old data - result.new_entry(old_extra - old_end, old_bounds, &old[old_begin..old_extra]); + result.new_entry(old.extra_end - old.end, old.bounds, &old_buf[old.begin..old.extra_end]); break; } } @@ -281,9 +289,9 @@ fn merge_blob_images(old: &[u8], new: &[u8], dirty_rect: Box2d) -> Vec { // Include any remaining old items. while old_reader.reader.has_more() { - let (_, old_end, old_extra, old_bounds) = old_reader.read_entry(); - dlog!("new bounds: {} {} {:?}", old_end, old_extra, old_bounds); - assert!(old_bounds.contained_by(&dirty_rect)); + let old = old_reader.read_entry(); + dlog!("new bounds: {} {} {:?}", old.end, old.extra_end, old.bounds); + assert!(old.bounds.contained_by(&dirty_rect)); } let result = result.finish(); @@ -302,7 +310,7 @@ impl BlobImageRenderer for Moz2dImageRenderer { fn update(&mut self, key: ImageKey, data: BlobImageData, dirty_rect: Option) { match self.blob_commands.entry(key) { - Entry::Occupied(mut e) => { + hash_map::Entry::Occupied(mut e) => { let old_data = &mut e.get_mut().0; *old_data = Arc::new(merge_blob_images(&old_data, &data, dirty_rect.unwrap().into())); @@ -374,8 +382,8 @@ impl BlobImageRenderer for Moz2dImageRenderer { let mut index = BlobReader::new(&commands); assert!(index.reader.pos < index.reader.buf.len()); while index.reader.pos < index.reader.buf.len() { - let (_, end, extra_end, _) = index.read_entry(); - process_fonts(BufReader::new(&commands[end..extra_end]), resources); + let e = index.read_entry(); + process_fonts(BufReader::new(&commands[e.end..e.extra_end]), resources); } } @@ -413,10 +421,10 @@ impl BlobImageRenderer for Moz2dImageRenderer { fn resolve(&mut self, request: BlobImageRequest) -> BlobImageResult { match self.rendered_images.entry(request) { - Entry::Vacant(_) => { + hash_map::Entry::Vacant(_) => { return Err(BlobImageError::InvalidKey); } - Entry::Occupied(entry) => { + hash_map::Entry::Occupied(entry) => { // None means we haven't yet received the result. if entry.get().is_some() { let result = entry.remove(); From a3330d16d628eaea67e9ee540dd1bf1468440fa8 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Wed, 4 Apr 2018 18:46:27 -0400 Subject: [PATCH 45/88] Bug 1450162. Correctly merge in the presence of reorderings. r=mstange Previously we were assuming that we'd always get the display list in a canonical ordering. With retained display lists this assumption is false. --- gfx/webrender_bindings/src/moz2d_renderer.rs | 75 +++++++++++++++----- 1 file changed, 57 insertions(+), 18 deletions(-) diff --git a/gfx/webrender_bindings/src/moz2d_renderer.rs b/gfx/webrender_bindings/src/moz2d_renderer.rs index 2708c2c56c03..c74a86c975cc 100644 --- a/gfx/webrender_bindings/src/moz2d_renderer.rs +++ b/gfx/webrender_bindings/src/moz2d_renderer.rs @@ -4,11 +4,14 @@ use rayon::ThreadPool; use std::collections::hash_map::HashMap; use std::collections::hash_map; +use std::collections::btree_map::BTreeMap; +use std::collections::Bound::Included; use std::mem; use std::os::raw::c_void; use std::ptr; use std::sync::mpsc::{channel, Sender, Receiver}; use std::sync::Arc; +use std; #[cfg(target_os = "windows")] use dwrote; @@ -196,7 +199,7 @@ impl BlobWriter { // XXX: Do we want to allow negative values here or clamp to the image bounds? -#[derive(Debug, Eq, PartialEq, Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Clone, Copy, Ord, PartialOrd)] struct Box2d { x1: u32, y1: u32, @@ -242,6 +245,51 @@ fn check_result(result: &[u8]) -> () { } } +// We use a BTree as a kind of multi-map, by appending an integer "cache_order" to the key. +// This lets us use multiple items with matching bounds in the map and allows +// us to fetch and remove them while retaining the ordering of the original list. + +struct CachedReader<'a> { + reader: BlobReader<'a>, + cache: BTreeMap<(Box2d, u32), Entry>, + cache_index_counter: u32 +} + +impl<'a> CachedReader<'a> { + fn new(buf: &'a[u8]) -> CachedReader { + CachedReader{reader:BlobReader::new(buf), cache: BTreeMap::new(), cache_index_counter: 0 } + } + + fn take_entry_with_bounds_from_cache(&mut self, bounds: &Box2d) -> Option { + if self.cache.is_empty() { + return None; + } + + let key_to_delete = match self.cache. range((Included((*bounds, 0u32)), Included((*bounds, std::u32::MAX)))).next() { + Some((&key, _)) => key, + None => return None, + }; + + Some(self.cache.remove(&key_to_delete).expect("We just got this key from range, it needs to be present")) + } + + fn next_entry_with_bounds(&mut self, bounds: &Box2d, ignore_rect: &Box2d) -> Entry { + if let Some(entry) = self.take_entry_with_bounds_from_cache(bounds) { + return entry; + } + + loop { + let old = self.reader.read_entry(); + if old.bounds == *bounds { + return old; + } else if !old.bounds.contained_by(&ignore_rect) { + self.cache.insert((old.bounds, self.cache_index_counter), old); + self.cache_index_counter += 1; + } + } + } +} + /* Merge a new partial blob image into an existing complete blob image. All of the items not fully contained in the dirty_rect should match in both new and old lists. @@ -258,7 +306,7 @@ fn merge_blob_images(old_buf: &[u8], new_buf: &[u8], dirty_rect: Box2d) -> Vec Vec Date: Wed, 4 Apr 2018 17:57:32 -0400 Subject: [PATCH 46/88] Bug 1451562 - Update pdf.js to version 2.0.480. r=bdahl --HG-- extra : rebase_source : a5e631e0475f6a7d544f3d6d02e2210b6a3ae494 extra : amend_source : fb964f584ad495bf9a230f019adbd08dd5507ad5 --- browser/extensions/pdfjs/README.mozilla | 4 ++-- browser/extensions/pdfjs/content/build/pdf.js | 12 +++++------ .../pdfjs/content/build/pdf.worker.js | 20 +++++++++---------- .../extensions/pdfjs/content/web/viewer.js | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/browser/extensions/pdfjs/README.mozilla b/browser/extensions/pdfjs/README.mozilla index f8c379cea701..7a61abb4bb06 100644 --- a/browser/extensions/pdfjs/README.mozilla +++ b/browser/extensions/pdfjs/README.mozilla @@ -1,5 +1,5 @@ This is the PDF.js project output, https://github.com/mozilla/pdf.js -Current extension version is: 2.0.466 +Current extension version is: 2.0.480 -Taken from upstream commit: a8e9f6cc +Taken from upstream commit: a7a034d8 diff --git a/browser/extensions/pdfjs/content/build/pdf.js b/browser/extensions/pdfjs/content/build/pdf.js index f9230aa10cc2..639c2d71b4b6 100644 --- a/browser/extensions/pdfjs/content/build/pdf.js +++ b/browser/extensions/pdfjs/content/build/pdf.js @@ -1650,8 +1650,8 @@ exports.GlobalWorkerOptions = GlobalWorkerOptions; "use strict"; -var pdfjsVersion = '2.0.466'; -var pdfjsBuild = 'a8e9f6cc'; +var pdfjsVersion = '2.0.480'; +var pdfjsBuild = 'a7a034d8'; var pdfjsSharedUtil = __w_pdfjs_require__(0); var pdfjsDisplayAPI = __w_pdfjs_require__(9); var pdfjsDisplayTextLayer = __w_pdfjs_require__(17); @@ -4929,7 +4929,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { } return worker.messageHandler.sendWithPromise('GetDocRequest', { docId, - apiVersion: '2.0.466', + apiVersion: '2.0.480', source: { data: source.data, url: source.url, @@ -6252,8 +6252,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() { }(); var version, build; { - exports.version = version = '2.0.466'; - exports.build = build = 'a8e9f6cc'; + exports.version = version = '2.0.480'; + exports.build = build = 'a7a034d8'; } exports.getDocument = getDocument; exports.LoopbackPort = LoopbackPort; @@ -8013,7 +8013,7 @@ var CanvasGraphics = function CanvasGraphicsClosure() { d = currentTransform[3]; var heightScale = Math.max(Math.sqrt(c * c + d * d), 1); var imgToPaint, tmpCanvas; - if (imgData instanceof HTMLElement || !imgData.data) { + if (typeof HTMLElement === 'function' && imgData instanceof HTMLElement || !imgData.data) { imgToPaint = imgData; } else { tmpCanvas = this.cachedCanvases.getCanvas('inlineImage', width, height); diff --git a/browser/extensions/pdfjs/content/build/pdf.worker.js b/browser/extensions/pdfjs/content/build/pdf.worker.js index 5bd10f0da394..6d94b0b1cc0c 100644 --- a/browser/extensions/pdfjs/content/build/pdf.worker.js +++ b/browser/extensions/pdfjs/content/build/pdf.worker.js @@ -12939,7 +12939,7 @@ var JpxImage = function JpxImageClosure() { cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1); cod.resetContextProbabilities = !!(blockStyle & 2); cod.terminationOnEachCodingPass = !!(blockStyle & 4); - cod.verticalyStripe = !!(blockStyle & 8); + cod.verticallyStripe = !!(blockStyle & 8); cod.predictableTermination = !!(blockStyle & 16); cod.segmentationSymbolUsed = !!(blockStyle & 32); cod.reversibleTransformation = data[j++]; @@ -12964,8 +12964,8 @@ var JpxImage = function JpxImageClosure() { if (cod.terminationOnEachCodingPass) { unsupported.push('terminationOnEachCodingPass'); } - if (cod.verticalyStripe) { - unsupported.push('verticalyStripe'); + if (cod.verticallyStripe) { + unsupported.push('verticallyStripe'); } if (cod.predictableTermination) { unsupported.push('predictableTermination'); @@ -21112,8 +21112,8 @@ exports.PostScriptCompiler = PostScriptCompiler; "use strict"; -var pdfjsVersion = '2.0.466'; -var pdfjsBuild = 'a8e9f6cc'; +var pdfjsVersion = '2.0.480'; +var pdfjsBuild = 'a7a034d8'; var pdfjsCoreWorker = __w_pdfjs_require__(20); exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler; @@ -21314,7 +21314,7 @@ var WorkerMessageHandler = { var cancelXHRs = null; var WorkerTasks = []; let apiVersion = docParams.apiVersion; - let workerVersion = '2.0.466'; + let workerVersion = '2.0.480'; if (apiVersion !== null && apiVersion !== workerVersion) { throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`); } @@ -32357,7 +32357,7 @@ var CMapFactory = function CMapFactoryClosure() { } function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) { var previous; - var embededUseCMap; + var embeddedUseCMap; objLoop: while (true) { try { var obj = lexer.getObj(); @@ -32376,7 +32376,7 @@ var CMapFactory = function CMapFactoryClosure() { break objLoop; case 'usecmap': if ((0, _primitives.isName)(previous)) { - embededUseCMap = previous.name; + embeddedUseCMap = previous.name; } break; case 'begincodespacerange': @@ -32404,8 +32404,8 @@ var CMapFactory = function CMapFactoryClosure() { continue; } } - if (!useCMap && embededUseCMap) { - useCMap = embededUseCMap; + if (!useCMap && embeddedUseCMap) { + useCMap = embeddedUseCMap; } if (useCMap) { return extendCMap(cMap, fetchBuiltInCMap, useCMap); diff --git a/browser/extensions/pdfjs/content/web/viewer.js b/browser/extensions/pdfjs/content/web/viewer.js index 3a0644c87b2d..070e00681edd 100644 --- a/browser/extensions/pdfjs/content/web/viewer.js +++ b/browser/extensions/pdfjs/content/web/viewer.js @@ -426,7 +426,7 @@ const WaitOnType = { }; function waitOnEventOrTimeout({ target, name, delay = 0 }) { if (typeof target !== 'object' || !(name && typeof name === 'string') || !(Number.isInteger(delay) && delay >= 0)) { - return Promise.reject(new Error('waitOnEventOrTimeout - invalid paramaters.')); + return Promise.reject(new Error('waitOnEventOrTimeout - invalid parameters.')); } let capability = (0, _pdfjsLib.createPromiseCapability)(); function handler(type) { From 1145d6396923d2ae712b1b3474236dcfd07db4ec Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 12:26:38 -0700 Subject: [PATCH 47/88] Bug 1449255: Part 1 - Fold test_bug335238 into test_update. r=aswan MozReview-Commit-ID: KLODBGSOR37 --HG-- extra : rebase_source : e2568a67d53ef1051616cf7ad02a79ac067514a6 --- .../extensions/internal/AddonTestUtils.jsm | 109 +++++++-- .../test/xpcshell/test_bug335238.js | 227 ------------------ .../extensions/test/xpcshell/test_update.js | 60 +++++ .../extensions/test/xpcshell/xpcshell.ini | 4 - 4 files changed, 143 insertions(+), 257 deletions(-) delete mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_bug335238.js diff --git a/toolkit/mozapps/extensions/internal/AddonTestUtils.jsm b/toolkit/mozapps/extensions/internal/AddonTestUtils.jsm index 8b1ee8f9a65c..232b19e88a20 100644 --- a/toolkit/mozapps/extensions/internal/AddonTestUtils.jsm +++ b/toolkit/mozapps/extensions/internal/AddonTestUtils.jsm @@ -10,8 +10,6 @@ var EXPORTED_SYMBOLS = ["AddonTestUtils", "MockAsyncShutdown"]; const CERTDB_CONTRACTID = "@mozilla.org/security/x509certdb;1"; -const CERTDB_CID = Components.ID("{fb0bbc5c-452e-4783-b32c-80124693d871}"); - Cu.importGlobalProperties(["fetch", "TextEncoder"]); @@ -35,6 +33,8 @@ ChromeUtils.defineModuleGetter(this, "FileTestUtils", "resource://testing-common/FileTestUtils.jsm"); ChromeUtils.defineModuleGetter(this, "HttpServer", "resource://testing-common/httpd.js"); +ChromeUtils.defineModuleGetter(this, "MockRegistrar", + "resource://testing-common/MockRegistrar.jsm"); XPCOMUtils.defineLazyServiceGetters(this, { aomStartup: ["@mozilla.org/addons/addon-manager-startup;1", "amIAddonManagerStartup"], @@ -102,6 +102,53 @@ var MockAsyncShutdown = { AMscope.AsyncShutdown = MockAsyncShutdown; +class MockBlocklist { + constructor(addons) { + if (ChromeUtils.getClassName(addons) === "Object") { + addons = new Map(Object.entries(addons)); + } + this.addons = addons; + } + + get contractID() { + return "@mozilla.org/extensions/blocklist;1"; + } + + register() { + this.originalCID = MockRegistrar.register(this.contractID, this); + } + + unregister() { + MockRegistrar.unregister(this.originalCID); + } + + getAddonBlocklistState(addon, appVersion, toolkitVersion) { + return this.addons.get(addon.id, Ci.nsIBlocklistService.STATE_NOT_BLOCKED); + } + + getAddonBlocklistEntry(addon, appVersion, toolkitVersion) { + let state = this.getAddonBlocklistState(addon, appVersion, toolkitVersion); + if (state != Ci.nsIBlocklistService.STATE_NOT_BLOCKED) { + return { + state, + url: "http://example.com/", + }; + } + return null; + } + + getPluginBlocklistState(plugin, version, appVersion, toolkitVersion) { + return Ci.nsIBlocklistService.STATE_NOT_BLOCKED; + } + + isAddonBlocklisted(addon, appVersion, toolkitVersion) { + return this.getAddonBlocklistState(addon, appVersion, toolkitVersion) == + Ci.nsIBlocklistService.STATE_BLOCKED; + } +} + +MockBlocklist.prototype.QueryInterface = XPCOMUtils.generateQI(["nsIBlocklistService"]); + /** * Escapes any occurrences of &, ", < or > with XML entities. @@ -575,16 +622,6 @@ var AddonTestUtils = { }, overrideCertDB() { - // Unregister the real database. This only works because the add-ons manager - // hasn't started up and grabbed the certificate database yet. - let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); - let factory = registrar.getClassObject(CERTDB_CID, Ci.nsIFactory); - registrar.unregisterFactory(CERTDB_CID, factory); - - // Get the real DB - let realCertDB = factory.createInstance(null, Ci.nsIX509CertDB); - - let verifyCert = async (file, result, cert, callback) => { if (result == Cr.NS_ERROR_SIGNED_JAR_NOT_SIGNED && !this.useRealCertChecks && callback.wrappedJSObject) { @@ -618,20 +655,20 @@ var AddonTestUtils = { return [callback, result, cert]; }; + let FakeCertDB = { + init() { + for (let property of Object.keys(this._genuine.QueryInterface(Ci.nsIX509CertDB))) { + if (property in this) + continue; - function FakeCertDB() { - for (let property of Object.keys(realCertDB)) { - if (property in this) - continue; + if (typeof this._genuine[property] == "function") + this[property] = this._genuine[property].bind(this._genuine); + } + }, - if (typeof realCertDB[property] == "function") - this[property] = realCertDB[property].bind(realCertDB); - } - } - FakeCertDB.prototype = { openSignedAppFileAsync(root, file, callback) { // First try calling the real cert DB - realCertDB.openSignedAppFileAsync(root, file, (result, zipReader, cert) => { + this._genuine.openSignedAppFileAsync(root, file, (result, zipReader, cert) => { verifyCert(file.clone(), result, cert, callback) .then(([callback, result, cert]) => { callback.openSignedAppFileFinished(result, zipReader, cert); @@ -641,7 +678,7 @@ var AddonTestUtils = { verifySignedDirectoryAsync(root, dir, callback) { // First try calling the real cert DB - realCertDB.verifySignedDirectoryAsync(root, dir, (result, cert) => { + this._genuine.verifySignedDirectoryAsync(root, dir, (result, cert) => { verifyCert(dir.clone(), result, cert, callback) .then(([callback, result, cert]) => { callback.verifySignedDirectoryFinished(result, cert); @@ -652,9 +689,29 @@ var AddonTestUtils = { QueryInterface: XPCOMUtils.generateQI([Ci.nsIX509CertDB]), }; - let certDBFactory = XPCOMUtils.generateSingletonFactory(FakeCertDB); - registrar.registerFactory(CERTDB_CID, "CertDB", - CERTDB_CONTRACTID, certDBFactory); + // Unregister the real database. This only works because the add-ons manager + // hasn't started up and grabbed the certificate database yet. + MockRegistrar.register(CERTDB_CONTRACTID, FakeCertDB); + + // Initialize the mock service. + Cc[CERTDB_CONTRACTID].getService(); + FakeCertDB.init(); + }, + + /** + * Overrides the blocklist service, and returns the given blocklist + * states for the given add-ons. + * + * @param {object|Map} addons + * A mapping of add-on IDs to their blocklist states. + * @returns {MockBlocklist} + * A mock blocklist service, which should be unregistered when + * the test is complete. + */ + overrideBlocklist(addons) { + let mock = new MockBlocklist(addons); + mock.register(); + return mock; }, /** diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug335238.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug335238.js deleted file mode 100644 index f036e294685e..000000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug335238.js +++ /dev/null @@ -1,227 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -// Disables security checking our updates which haven't been signed -Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false); - -ChromeUtils.import("resource://testing-common/MockRegistrar.jsm"); - -// This is the data we expect to see sent as part of the update url. -var EXPECTED = [ - { - id: "bug335238_1@tests.mozilla.org", - version: "1.3.4", - maxAppVersion: "5", - status: "userEnabled", - appId: "xpcshell@tests.mozilla.org", - appVersion: "1", - appOs: "XPCShell", - appAbi: "noarch-spidermonkey", - locale: "en-US", - reqVersion: "2" - }, - { - id: "bug335238_2@tests.mozilla.org", - version: "28at", - maxAppVersion: "7", - status: "userDisabled", - appId: "xpcshell@tests.mozilla.org", - appVersion: "1", - appOs: "XPCShell", - appAbi: "noarch-spidermonkey", - locale: "en-US", - reqVersion: "2" - }, - { - id: "bug335238_3@tests.mozilla.org", - version: "58", - maxAppVersion: "*", - status: "userDisabled,softblocked", - appId: "xpcshell@tests.mozilla.org", - appVersion: "1", - appOs: "XPCShell", - appAbi: "noarch-spidermonkey", - locale: "en-US", - reqVersion: "2" - }, - { - id: "bug335238_4@tests.mozilla.org", - version: "4", - maxAppVersion: "2+", - status: "userEnabled,blocklisted", - appId: "xpcshell@tests.mozilla.org", - appVersion: "1", - appOs: "XPCShell", - appAbi: "noarch-spidermonkey", - locale: "en-US", - reqVersion: "2" - } -]; - -const MANIFESTS = [ - { - id: "bug335238_1@tests.mozilla.org", - version: "1.3.4", - name: "Bug 335238", - updateURL: "http://example.com/0?id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appId=%APP_ID%&appVersion=%APP_VERSION%&appOs=%APP_OS%&appAbi=%APP_ABI%&locale=%APP_LOCALE%&reqVersion=%REQ_VERSION%", - bootstrap: true, - - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "5"}], - }, - { - id: "bug335238_2@tests.mozilla.org", - version: "28at", - name: "Bug 335238", - updateURL: "http://example.com/1?id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appId=%APP_ID%&appVersion=%APP_VERSION%&appOs=%APP_OS%&appAbi=%APP_ABI%&locale=%APP_LOCALE%&reqVersion=%REQ_VERSION%", - bootstrap: true, - - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "7"}], - }, - { - id: "bug335238_3@tests.mozilla.org", - version: "58", - name: "Bug 335238", - updateURL: "http://example.com/2?id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appId=%APP_ID%&appVersion=%APP_VERSION%&appOs=%APP_OS%&appAbi=%APP_ABI%&locale=%APP_LOCALE%&reqVersion=%REQ_VERSION%", - bootstrap: true, - - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "*"}], - }, - { - id: "bug335238_4@tests.mozilla.org", - version: "4", - name: "Bug 335238", - updateURL: "http://example.com/3?id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appId=%APP_ID%&appVersion=%APP_VERSION%&appOs=%APP_OS%&appAbi=%APP_ABI%&locale=%APP_LOCALE%&reqVersion=%REQ_VERSION%", - bootstrap: true, - - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "2+"}], - }, -]; - -const XPIS = MANIFESTS.map(manifest => createTempXPIFile(manifest)); - -var ADDONS = [ - {id: "bug335238_1@tests.mozilla.org", - addon: XPIS[0]}, - {id: "bug335238_2@tests.mozilla.org", - addon: XPIS[1]}, - {id: "bug335238_3@tests.mozilla.org", - addon: XPIS[2]}, - {id: "bug335238_4@tests.mozilla.org", - addon: XPIS[3]} -]; - -// This is a replacement for the blocklist service -var BlocklistService = { - getAddonBlocklistState(aAddon, aAppVersion, aToolkitVersion) { - if (aAddon.id == "bug335238_3@tests.mozilla.org") - return Ci.nsIBlocklistService.STATE_SOFTBLOCKED; - if (aAddon.id == "bug335238_4@tests.mozilla.org") - return Ci.nsIBlocklistService.STATE_BLOCKED; - return Ci.nsIBlocklistService.STATE_NOT_BLOCKED; - }, - - getAddonBlocklistEntry(aAddon, aAppVersion, aToolkitVersion) { - let state = this.getAddonBlocklistState(aAddon, aAppVersion, aToolkitVersion); - if (state != Ci.nsIBlocklistService.STATE_NOT_BLOCKED) { - return { - state, - url: "http://example.com/", - }; - } - return null; - }, - - getPluginBlocklistState(aPlugin, aVersion, aAppVersion, aToolkitVersion) { - return Ci.nsIBlocklistService.STATE_NOT_BLOCKED; - }, - - isAddonBlocklisted(aAddon, aAppVersion, aToolkitVersion) { - return this.getAddonBlocklistState(aAddon, aAppVersion, aToolkitVersion) == - Ci.nsIBlocklistService.STATE_BLOCKED; - }, - - QueryInterface(iid) { - if (iid.equals(Ci.nsIBlocklistService) - || iid.equals(Ci.nsISupports)) - return this; - - throw Cr.NS_ERROR_NO_INTERFACE; - } -}; - -MockRegistrar.register("@mozilla.org/extensions/blocklist;1", BlocklistService); - -var server; - -var updateListener = { - pendingCount: 0, - - onUpdateAvailable(aAddon) { - do_throw("Should not have seen an update for " + aAddon.id); - }, - - onUpdateFinished() { - if (--this.pendingCount == 0) - do_test_finished(); - } -}; - -var requestHandler = { - handle(metadata, response) { - var expected = EXPECTED[metadata.path.substring(1)]; - var params = metadata.queryString.split("&"); - Assert.equal(params.length, 10); - for (var k in params) { - var pair = params[k].split("="); - var name = decodeURIComponent(pair[0]); - var value = decodeURIComponent(pair[1]); - Assert.equal(expected[name], value); - } - response.setStatusLine(metadata.httpVersion, 404, "Not Found"); - } -}; - -function run_test() { - do_test_pending(); - createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9"); - - server = AddonTestUtils.createHttpServer({hosts: ["example.com"]}); - server.registerPathHandler("/0", requestHandler); - server.registerPathHandler("/1", requestHandler); - server.registerPathHandler("/2", requestHandler); - server.registerPathHandler("/3", requestHandler); - - Services.locale.setRequestedLocales(["en-US"]); - - startupManager(); - installAllFiles(ADDONS.map(a => a.addon), function() { - - restartManager(); - AddonManager.getAddonByID(ADDONS[1].id, callback_soon(function(addon) { - Assert.ok(!(!addon)); - addon.userDisabled = true; - restartManager(); - - AddonManager.getAddonsByIDs(ADDONS.map(a => a.id), function(installedItems) { - installedItems.forEach(function(item) { - updateListener.pendingCount++; - item.findUpdates(updateListener, AddonManager.UPDATE_WHEN_USER_REQUESTED); - }); - }); - })); - }); -} diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_update.js b/toolkit/mozapps/extensions/test/xpcshell/test_update.js index eae9603ff804..76a284ff59a5 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_update.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_update.js @@ -557,12 +557,70 @@ const PARAM_ADDONS = { }, updateType: [AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED], }, + + "blocklist1@tests.mozilla.org": { + "install.rdf": { + id: "blocklist1@tests.mozilla.org", + version: "5.0", + bootstrap: true, + updateURL: "http://example.com/data/param_test.json" + PARAMS, + targetApplications: [{ + id: appId, + minVersion: "1", + maxVersion: "2" + }], + name: "Test Addon 1", + }, + params: { + item_version: "5.0", + item_maxappversion: "2", + item_status: "userDisabled,softblocked", + app_version: "1", + update_type: "97", + }, + updateType: [AddonManager.UPDATE_WHEN_USER_REQUESTED], + blocklistState: "STATE_SOFTBLOCKED", + }, + + "blocklist2@tests.mozilla.org": { + "install.rdf": { + id: "blocklist2@tests.mozilla.org", + version: "5.0", + bootstrap: true, + updateURL: "http://example.com/data/param_test.json" + PARAMS, + targetApplications: [{ + id: appId, + minVersion: "1", + maxVersion: "2" + }], + name: "Test Addon 1", + }, + params: { + item_version: "5.0", + item_maxappversion: "2", + item_status: "userEnabled,blocklisted", + app_version: "1", + update_type: "97", + }, + updateType: [AddonManager.UPDATE_WHEN_USER_REQUESTED], + blocklistState: "STATE_BLOCKED", + }, }; const PARAM_IDS = Object.keys(PARAM_ADDONS); // Verify the parameter escaping in update urls. add_task(async function test_8() { + let blocklistAddons = new Map(); + for (let [id, options] of Object.entries(PARAM_ADDONS)) { + if (options.blocklistState) { + blocklistAddons.set(id, Ci.nsIBlocklistService[options.blocklistState]); + } + } + let mockBlocklist = await AddonTestUtils.overrideBlocklist(blocklistAddons); + + await promiseRestartManager(); + for (let [id, options] of Object.entries(PARAM_ADDONS)) { await promiseInstallXPI(options["install.rdf"], profileDir); @@ -623,6 +681,8 @@ add_task(async function test_8() { for (let [, addon] of await getAddons(PARAM_IDS)) { addon.uninstall(); } + + await mockBlocklist.unregister(); }); // Tests that if an install.rdf claims compatibility then the add-on will be diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index 8e1fc1332ec2..ac8e062fce45 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -43,10 +43,6 @@ skip-if = true # Bug 1358846 Bug 1365021 Bug 676992 [test_bootstrap_globals.js] [test_bug1180901_2.js] skip-if = os != "win" -[test_bug335238.js] -# Bug 676992: test consistently hangs on Android -skip-if = os == "android" -tags = blocklist [test_bug371495.js] # Bug 676992: test consistently hangs on Android skip-if = os == "android" From 0c88734cd9c1e0187313a078abb0b6d3c712a03d Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 12:32:51 -0700 Subject: [PATCH 48/88] Bug 1449255: Part 2 - Fold test_bug371495 into test_manifest. r=aswan MozReview-Commit-ID: 69LtwXgwBT0 --HG-- extra : rebase_source : 5c2a206cd6e8549d744a3f11b7f448957bbb9bb6 --- .../test/addons/test_bug371495/install.rdf | 26 ---------------- .../test/xpcshell/test_bug371495.js | 31 ------------------- .../extensions/test/xpcshell/test_manifest.js | 22 +++++++++++++ .../extensions/test/xpcshell/xpcshell.ini | 3 -- 4 files changed, 22 insertions(+), 60 deletions(-) delete mode 100644 toolkit/mozapps/extensions/test/addons/test_bug371495/install.rdf delete mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_bug371495.js diff --git a/toolkit/mozapps/extensions/test/addons/test_bug371495/install.rdf b/toolkit/mozapps/extensions/test/addons/test_bug371495/install.rdf deleted file mode 100644 index c60caf5941e0..000000000000 --- a/toolkit/mozapps/extensions/test/addons/test_bug371495/install.rdf +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - bug371495@tests.mozilla.org - 1.0 - - - - xpcshell@tests.mozilla.org - 1 - 1 - - - - - Test theme - 4 - test/1.0 - chrome://foo/content/bar.xul - chrome://foo/content/bar.xul - - - diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug371495.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug371495.js deleted file mode 100644 index 490c45287622..000000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug371495.js +++ /dev/null @@ -1,31 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -const ADDON = "test_bug371495"; -const ID = "bug371495@tests.mozilla.org"; - -function run_test() { - // Setup for test - do_test_pending(); - createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1"); - - // Install test add-on - startupManager(); - installAllFiles([do_get_addon(ADDON)], function() { - AddonManager.getAddonByID(ID, callback_soon(function(addon) { - Assert.notEqual(addon, null); - Assert.equal(addon.name, "Test theme"); - restartManager(); - - AddonManager.getAddonByID(ID, callback_soon(function(addon2) { - Assert.notEqual(addon2, null); - Assert.equal(addon2.optionsURL, null); - Assert.equal(addon2.aboutURL, null); - - executeSoon(do_test_finished); - })); - })); - }); -} diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_manifest.js b/toolkit/mozapps/extensions/test/xpcshell/test_manifest.js index c6de23894256..070990ce91ad 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_manifest.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_manifest.js @@ -602,6 +602,28 @@ const ADDONS = [ expected: null, }, + // Theme manifests should ignore aboutURL and optionsURL. + { + "install.rdf": { + id: "bug371495@tests.mozilla.org", + version: "1.0", + type: "4", + internalName: "test/1.0", + optionsURL: "chrome://foo/content/bar.xul", + aboutURL: "chrome://foo/content/bar.xul", + name: "Test theme", + targetApplications: [{ + id: "xpcshell@tests.mozilla.org", + minVersion: "1", + maxVersion: "1", + }], + }, + + expected: { + aboutURL: null, + optionsURL: null, + } + }, // Tests compatibility based on target platforms. diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index ac8e062fce45..9adc679d4849 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -43,9 +43,6 @@ skip-if = true # Bug 1358846 Bug 1365021 Bug 676992 [test_bootstrap_globals.js] [test_bug1180901_2.js] skip-if = os != "win" -[test_bug371495.js] -# Bug 676992: test consistently hangs on Android -skip-if = os == "android" [test_bug384052.js] # Bug 676992: test consistently hangs on Android skip-if = os == "android" From 562ba9124845dac1ee497099780ab35fa23f962a Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 12:51:45 -0700 Subject: [PATCH 49/88] Bug 1449255: Part 3a - Delete test_bug384052 and the functionality it tests. r=aswan This is all dead code now that legacy extensions are gone. WebExtensions have no way to implement this. MozReview-Commit-ID: IDoH6HATKcc --HG-- extra : rebase_source : 2dc0fca457ab125dcc50c3b311df74886c4f78c1 --- toolkit/mozapps/extensions/AddonManager.jsm | 19 ---- .../test/xpcshell/test_bug384052.js | 97 ------------------- .../extensions/test/xpcshell/xpcshell.ini | 3 - 3 files changed, 119 deletions(-) delete mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_bug384052.js diff --git a/toolkit/mozapps/extensions/AddonManager.jsm b/toolkit/mozapps/extensions/AddonManager.jsm index ae68b637ca5d..7655e63a401b 100644 --- a/toolkit/mozapps/extensions/AddonManager.jsm +++ b/toolkit/mozapps/extensions/AddonManager.jsm @@ -38,7 +38,6 @@ const PREF_WEBAPI_TESTING = "extensions.webapi.testing"; const PREF_WEBEXT_PERM_PROMPTS = "extensions.webextPermissionPrompts"; const UPDATE_REQUEST_VERSION = 2; -const CATEGORY_UPDATE_PARAMS = "extension-update-params"; const XMLURI_BLOCKLIST = "http://www.mozilla.org/2006/addons-blocklist"; @@ -1277,24 +1276,6 @@ var AddonManagerInternal = { uri = uri.replace(/%APP_LOCALE%/g, getLocale()); uri = uri.replace(/%CURRENT_APP_VERSION%/g, Services.appinfo.version); - // Replace custom parameters (names of custom parameters must have at - // least 3 characters to prevent lookups for something like %D0%C8) - var catMan = null; - uri = uri.replace(/%(\w{3,})%/g, function(aMatch, aParam) { - if (!catMan) { - catMan = Cc["@mozilla.org/categorymanager;1"]. - getService(Ci.nsICategoryManager); - } - - try { - var contractID = catMan.getCategoryEntry(CATEGORY_UPDATE_PARAMS, aParam); - var paramHandler = Cc[contractID].getService(Ci.nsIPropertyBag2); - return paramHandler.getPropertyAsAString(aParam); - } catch (e) { - return aMatch; - } - }); - // escape() does not properly encode + symbols in any embedded FVF strings. return uri.replace(/\+/g, "%2B"); }, diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug384052.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug384052.js deleted file mode 100644 index 9505dd9ad72f..000000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug384052.js +++ /dev/null @@ -1,97 +0,0 @@ -const CLASS_ID = Components.ID("{12345678-1234-1234-1234-123456789abc}"); -const CONTRACT_ID = "@mozilla.org/test-parameter-source;1"; - -var testserver = AddonTestUtils.createHttpServer({hosts: ["example.com"]}); - -var gTestURL = "http://example.com/update.json?itemID=%ITEM_ID%&custom1=%CUSTOM1%&custom2=%CUSTOM2%"; -var gExpectedQuery = "itemID=test@mozilla.org&custom1=custom_parameter_1&custom2=custom_parameter_2"; -var gSeenExpectedURL = false; - -var gComponentRegistrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); -var gCategoryManager = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager); - -// Factory for our parameter handler -var paramHandlerFactory = { - QueryInterface(iid) { - if (iid.equals(Ci.nsIFactory) || iid.equals(Ci.nsISupports)) - return this; - - throw Cr.NS_ERROR_NO_INTERFACE; - }, - - createInstance(outer, iid) { - var bag = Cc["@mozilla.org/hash-property-bag;1"]. - createInstance(Ci.nsIWritablePropertyBag); - bag.setProperty("CUSTOM1", "custom_parameter_1"); - bag.setProperty("CUSTOM2", "custom_parameter_2"); - return bag.QueryInterface(iid); - } -}; - -function initTest() { - do_test_pending(); - // Setup extension manager - createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9"); - - // Configure the HTTP server. - testserver.registerPathHandler("/update.json", function(aRequest, aResponse) { - gSeenExpectedURL = aRequest.queryString == gExpectedQuery; - aResponse.setStatusLine(null, 404, "Not Found"); - }); - - // Register our parameter handlers - gComponentRegistrar.registerFactory(CLASS_ID, "Test component", CONTRACT_ID, paramHandlerFactory); - gCategoryManager.addCategoryEntry("extension-update-params", "CUSTOM1", CONTRACT_ID, false, false); - gCategoryManager.addCategoryEntry("extension-update-params", "CUSTOM2", CONTRACT_ID, false, false); - - // Install a test extension into the profile - let dir = gProfD.clone(); - dir.append("extensions"); - writeInstallRDFForExtension({ - id: "test@mozilla.org", - version: "1.0", - name: "Test extension", - bootstrap: true, - updateURL: gTestURL, - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "1" - }], - }, dir); - - startupManager(); -} - -function shutdownTest() { - shutdownManager(); - - gComponentRegistrar.unregisterFactory(CLASS_ID, paramHandlerFactory); - gCategoryManager.deleteCategoryEntry("extension-update-params", "CUSTOM1", false); - gCategoryManager.deleteCategoryEntry("extension-update-params", "CUSTOM2", false); - - do_test_finished(); -} - -function run_test() { - initTest(); - - AddonManager.getAddonByID("test@mozilla.org", function(item) { - // Initiate update - item.findUpdates({ - onCompatibilityUpdateAvailable(addon) { - do_throw("Should not have seen a compatibility update"); - }, - - onUpdateAvailable(addon, install) { - do_throw("Should not have seen an available update"); - }, - - onUpdateFinished(addon, error) { - Assert.equal(error, AddonManager.UPDATE_STATUS_DOWNLOAD_ERROR); - Assert.ok(gSeenExpectedURL); - executeSoon(shutdownTest); - } - }, AddonManager.UPDATE_WHEN_USER_REQUESTED); - }); -} diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index 9adc679d4849..64874aacc409 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -43,9 +43,6 @@ skip-if = true # Bug 1358846 Bug 1365021 Bug 676992 [test_bootstrap_globals.js] [test_bug1180901_2.js] skip-if = os != "win" -[test_bug384052.js] -# Bug 676992: test consistently hangs on Android -skip-if = os == "android" [test_bug393285.js] # Bug 676992: test consistently hangs on Android skip-if = os == "android" From b7c0137087cc3db52f996fcf86a0065105b4b0db Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 13:03:50 -0700 Subject: [PATCH 50/88] Bug 1449255: Part 3b - Cleanup update URL parameter interpolation. r=aswan MozReview-Commit-ID: FTLC5WFGYj7 --HG-- extra : rebase_source : 2a6f3bd9867d712c4adab94eca02bf3eff34487e --- toolkit/mozapps/extensions/AddonManager.jsm | 36 ++++++++++----------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/toolkit/mozapps/extensions/AddonManager.jsm b/toolkit/mozapps/extensions/AddonManager.jsm index 7655e63a401b..9b27078bb451 100644 --- a/toolkit/mozapps/extensions/AddonManager.jsm +++ b/toolkit/mozapps/extensions/AddonManager.jsm @@ -31,7 +31,6 @@ const PREF_EM_STRICT_COMPATIBILITY = "extensions.strictCompatibility"; const PREF_EM_CHECK_UPDATE_SECURITY = "extensions.checkUpdateSecurity"; const PREF_APP_UPDATE_ENABLED = "app.update.enabled"; const PREF_APP_UPDATE_AUTO = "app.update.auto"; -const UNKNOWN_XPCOM_ABI = "unknownABI"; const PREF_MIN_WEBEXT_PLATFORM_VERSION = "extensions.webExtensionsMinPlatformVersion"; const PREF_WEBAPI_TESTING = "extensions.webapi.testing"; @@ -1253,28 +1252,27 @@ var AddonManagerInternal = { if (!aAddon.isCompatible) addonStatus += ",incompatible"; - if (aAddon.blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED) + + let {blocklistState} = aAddon; + if (blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED) addonStatus += ",blocklisted"; - if (aAddon.blocklistState == Ci.nsIBlocklistService.STATE_SOFTBLOCKED) + if (blocklistState == Ci.nsIBlocklistService.STATE_SOFTBLOCKED) addonStatus += ",softblocked"; - try { - var xpcomABI = Services.appinfo.XPCOMABI; - } catch (ex) { - xpcomABI = UNKNOWN_XPCOM_ABI; - } + let params = new Map(Object.entries({ + ITEM_ID: aAddon.id, + ITEM_VERSION: aAddon.version, + ITEM_STATUS: addonStatus, + APP_ID: Services.appinfo.ID, + APP_VERSION: aAppVersion ? aAppVersion : Services.appinfo.version, + REQ_VERSION: UPDATE_REQUEST_VERSION, + APP_OS: Services.appinfo.OS, + APP_ABI: Services.appinfo.XPCOMABI, + APP_LOCALE: getLocale(), + CURRENT_APP_VERSION: Services.appinfo.version, + })); - let uri = aUri.replace(/%ITEM_ID%/g, aAddon.id); - uri = uri.replace(/%ITEM_VERSION%/g, aAddon.version); - uri = uri.replace(/%ITEM_STATUS%/g, addonStatus); - uri = uri.replace(/%APP_ID%/g, Services.appinfo.ID); - uri = uri.replace(/%APP_VERSION%/g, aAppVersion ? aAppVersion : - Services.appinfo.version); - uri = uri.replace(/%REQ_VERSION%/g, UPDATE_REQUEST_VERSION); - uri = uri.replace(/%APP_OS%/g, Services.appinfo.OS); - uri = uri.replace(/%APP_ABI%/g, xpcomABI); - uri = uri.replace(/%APP_LOCALE%/g, getLocale()); - uri = uri.replace(/%CURRENT_APP_VERSION%/g, Services.appinfo.version); + let uri = aUri.replace(/%([A-Z_]+)%/g, (m0, m1) => params.get(m1) || m0); // escape() does not properly encode + symbols in any embedded FVF strings. return uri.replace(/\+/g, "%2B"); From c7ba28342b12ee1b56f5ac7f087346a2851dda24 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 13:23:31 -0700 Subject: [PATCH 51/88] Bug 1449255: Part 4a - Rename test_bug393285 to test_blocklist_osabi.js and modernize. r=aswan MozReview-Commit-ID: FPdc1y88ZXu --HG-- rename : toolkit/mozapps/extensions/test/xpcshell/test_bug393285.js => toolkit/mozapps/extensions/test/xpcshell/test_blocklist_osabi.js extra : rebase_source : d46ff670128a85c645fe6213aa429014a59c5745 --- .../extensions/test/xpcshell/head_addons.js | 2 + .../test/xpcshell/test_blocklist_osabi.js | 299 ++++++++++++++++ .../test/xpcshell/test_bug393285.js | 323 ------------------ .../extensions/test/xpcshell/xpcshell.ini | 8 +- 4 files changed, 305 insertions(+), 327 deletions(-) create mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_blocklist_osabi.js delete mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_bug393285.js diff --git a/toolkit/mozapps/extensions/test/xpcshell/head_addons.js b/toolkit/mozapps/extensions/test/xpcshell/head_addons.js index 55859db32b15..8de43fae4288 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/head_addons.js +++ b/toolkit/mozapps/extensions/test/xpcshell/head_addons.js @@ -60,6 +60,8 @@ ChromeUtils.defineModuleGetter(this, "MockRegistrar", "resource://testing-common/MockRegistrar.jsm"); ChromeUtils.defineModuleGetter(this, "MockRegistry", "resource://testing-common/MockRegistry.jsm"); +ChromeUtils.defineModuleGetter(this, "TestUtils", + "resource://testing-common/TestUtils.jsm"); XPCOMUtils.defineLazyServiceGetter(this, "aomStartup", "@mozilla.org/addons/addon-manager-startup;1", diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_osabi.js b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_osabi.js new file mode 100644 index 000000000000..90a4aa9ef8b3 --- /dev/null +++ b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_osabi.js @@ -0,0 +1,299 @@ +/* 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/. + */ + +var testserver = AddonTestUtils.createHttpServer({hosts: ["example.com"]}); +gPort = testserver.identity.primaryPort; + +testserver.registerDirectory("/data/", do_get_file("data")); + +const profileDir = gProfD.clone(); +profileDir.append("extensions"); + +const ADDONS = { + "test_bug393285_1@tests.mozilla.org": { + "install.rdf": { + id: "test_bug393285_1@tests.mozilla.org", + name: "extension 1", + bootstrap: true, + version: "1.0", + targetApplications: [{ + id: "xpcshell@tests.mozilla.org", + minVersion: "1", + maxVersion: "3" + }] + }, + // No info in blocklist, shouldn't be blocked + notBlocklisted: ["1", "1.9"], + }, + + "test_bug393285_2@tests.mozilla.org": { + "install.rdf": { + id: "test_bug393285_2@tests.mozilla.org", + name: "extension 2", + bootstrap: true, + version: "1.0", + targetApplications: [{ + id: "xpcshell@tests.mozilla.org", + minVersion: "1", + maxVersion: "3" + }] + }, + // Should always be blocked + blocklisted: ["1", "1.9"], + }, + + "test_bug393285_3a@tests.mozilla.org": { + "install.rdf": { + id: "test_bug393285_3a@tests.mozilla.org", + name: "extension 3a", + bootstrap: true, + version: "1.0", + targetApplications: [{ + id: "xpcshell@tests.mozilla.org", + minVersion: "1", + maxVersion: "3" + }] + }, + // Only version 1 should be blocked + blocklisted: ["1", "1.9"], + }, + + "test_bug393285_3b@tests.mozilla.org": { + "install.rdf": { + id: "test_bug393285_3b@tests.mozilla.org", + name: "extension 3b", + bootstrap: true, + version: "2.0", + targetApplications: [{ + id: "xpcshell@tests.mozilla.org", + minVersion: "1", + maxVersion: "3" + }] + }, + // Only version 1 should be blocked + notBlocklisted: ["1", "1.9"], + }, + + "test_bug393285_4@tests.mozilla.org": { + "install.rdf": { + id: "test_bug393285_4@tests.mozilla.org", + name: "extension 4", + bootstrap: true, + version: "1.0", + targetApplications: [{ + id: "xpcshell@tests.mozilla.org", + minVersion: "1", + maxVersion: "3" + }] + }, + // Should be blocked for app version 1 + blocklisted: ["1", "1.9"], + notBlocklisted: ["2", "1.9"], + }, + + "test_bug393285_5@tests.mozilla.org": { + "install.rdf": { + id: "test_bug393285_5@tests.mozilla.org", + name: "extension 5", + bootstrap: true, + version: "1.0", + targetApplications: [{ + id: "xpcshell@tests.mozilla.org", + minVersion: "1", + maxVersion: "3" + }] + }, + // Not blocklisted because we are a different OS + notBlocklisted: ["2", "1.9"], + }, + + "test_bug393285_6@tests.mozilla.org": { + "install.rdf": { + id: "test_bug393285_6@tests.mozilla.org", + name: "extension 6", + bootstrap: true, + version: "1.0", + targetApplications: [{ + id: "xpcshell@tests.mozilla.org", + minVersion: "1", + maxVersion: "3" + }] + }, + // Blocklisted based on OS + blocklisted: ["2", "1.9"], + }, + + "test_bug393285_7@tests.mozilla.org": { + "install.rdf": { + id: "test_bug393285_7@tests.mozilla.org", + name: "extension 7", + bootstrap: true, + version: "1.0", + targetApplications: [{ + id: "xpcshell@tests.mozilla.org", + minVersion: "1", + maxVersion: "3" + }] + }, + // Blocklisted based on OS + blocklisted: ["2", "1.9"], + }, + + "test_bug393285_8@tests.mozilla.org": { + "install.rdf": { + id: "test_bug393285_8@tests.mozilla.org", + name: "extension 8", + bootstrap: true, + version: "1.0", + targetApplications: [{ + id: "xpcshell@tests.mozilla.org", + minVersion: "1", + maxVersion: "3" + }] + }, + // Not blocklisted because we are a different ABI + notBlocklisted: ["2", "1.9"], + }, + + "test_bug393285_9@tests.mozilla.org": { + "install.rdf": { + id: "test_bug393285_9@tests.mozilla.org", + name: "extension 9", + bootstrap: true, + version: "1.0", + targetApplications: [{ + id: "xpcshell@tests.mozilla.org", + minVersion: "1", + maxVersion: "3" + }] + }, + // Blocklisted based on ABI + blocklisted: ["2", "1.9"], + }, + + "test_bug393285_10@tests.mozilla.org": { + "install.rdf": { + id: "test_bug393285_10@tests.mozilla.org", + name: "extension 10", + bootstrap: true, + version: "1.0", + targetApplications: [{ + id: "xpcshell@tests.mozilla.org", + minVersion: "1", + maxVersion: "3" + }] + }, + // Blocklisted based on ABI + blocklisted: ["2", "1.9"], + }, + + "test_bug393285_11@tests.mozilla.org": { + "install.rdf": { + id: "test_bug393285_11@tests.mozilla.org", + name: "extension 11", + bootstrap: true, + version: "1.0", + targetApplications: [{ + id: "xpcshell@tests.mozilla.org", + minVersion: "1", + maxVersion: "3" + }] + }, + // Doesn't match both os and abi so not blocked + notBlocklisted: ["2", "1.9"], + }, + + "test_bug393285_12@tests.mozilla.org": { + "install.rdf": { + id: "test_bug393285_12@tests.mozilla.org", + name: "extension 12", + bootstrap: true, + version: "1.0", + targetApplications: [{ + id: "xpcshell@tests.mozilla.org", + minVersion: "1", + maxVersion: "3" + }] + }, + // Doesn't match both os and abi so not blocked + notBlocklisted: ["2", "1.9"], + }, + + "test_bug393285_13@tests.mozilla.org": { + "install.rdf": { + id: "test_bug393285_13@tests.mozilla.org", + name: "extension 13", + bootstrap: true, + version: "1.0", + targetApplications: [{ + id: "xpcshell@tests.mozilla.org", + minVersion: "1", + maxVersion: "3" + }] + }, + // Doesn't match both os and abi so not blocked + notBlocklisted: ["2", "1.9"], + }, + + "test_bug393285_14@tests.mozilla.org": { + "install.rdf": { + id: "test_bug393285_14@tests.mozilla.org", + name: "extension 14", + bootstrap: true, + version: "1.0", + targetApplications: [{ + id: "xpcshell@tests.mozilla.org", + minVersion: "1", + maxVersion: "3" + }] + }, + // Matches both os and abi so blocked + blocklisted: ["2", "1.9"], + }, +}; + +const ADDON_IDS = Object.keys(ADDONS); + +async function loadBlocklist(file) { + let blocklistUpdated = TestUtils.topicObserved("blocklist-updated"); + + Services.prefs.setCharPref("extensions.blocklist.url", + "http://example.com/data/" + file); + Services.blocklist.QueryInterface(Ci.nsITimerCallback).notify(null); + + return blocklistUpdated; +} + + +add_task(async function setup() { + createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9"); + await promiseStartupManager(); + + for (let addon of Object.values(ADDONS)) { + await promiseInstallXPI(addon["install.rdf"]); + } + + let addons = await getAddons(ADDON_IDS); + for (let id of ADDON_IDS) { + equal(addons.get(id).blocklistState, Ci.nsIBlocklistService.STATE_NOT_BLOCKED, + `Add-on ${id} should not initially be blocked`); + } +}); + +add_task(async function test_1() { + await loadBlocklist("test_bug393285.xml"); + + let addons = await getAddons(ADDON_IDS); + for (let [id, options] of Object.entries(ADDONS)) { + if (options.blocklisted) { + ok(Services.blocklist.isAddonBlocklisted(addons.get(id), ...options.blocklisted), + `Add-on ${id} should be blocklisted in app/platform version ${options.blocklisted}`); + } + if (options.notBlocklisted) { + ok(!Services.blocklist.isAddonBlocklisted(addons.get(id), ...options.notBlocklisted), + `Add-on ${id} should not be blocklisted in app/platform version ${options.notBlocklisted}`); + } + } +}); diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug393285.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug393285.js deleted file mode 100644 index dbc50223fb25..000000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug393285.js +++ /dev/null @@ -1,323 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -const URI_EXTENSION_BLOCKLIST_DIALOG = "chrome://mozapps/content/extensions/blocklist.xul"; - -ChromeUtils.import("resource://testing-common/MockRegistrar.jsm"); -var testserver = AddonTestUtils.createHttpServer({hosts: ["example.com"]}); -gPort = testserver.identity.primaryPort; - -testserver.registerDirectory("/data/", do_get_file("data")); - -const profileDir = gProfD.clone(); -profileDir.append("extensions"); - -var addonIDs = ["test_bug393285_1@tests.mozilla.org", - "test_bug393285_2@tests.mozilla.org", - "test_bug393285_3a@tests.mozilla.org", - "test_bug393285_3b@tests.mozilla.org", - "test_bug393285_4@tests.mozilla.org", - "test_bug393285_5@tests.mozilla.org", - "test_bug393285_6@tests.mozilla.org", - "test_bug393285_7@tests.mozilla.org", - "test_bug393285_8@tests.mozilla.org", - "test_bug393285_9@tests.mozilla.org", - "test_bug393285_10@tests.mozilla.org", - "test_bug393285_11@tests.mozilla.org", - "test_bug393285_12@tests.mozilla.org", - "test_bug393285_13@tests.mozilla.org", - "test_bug393285_14@tests.mozilla.org"]; - -// A window watcher to deal with the blocklist UI dialog. -var WindowWatcher = { - openWindow(parent, url, name, features, args) { - // Should be called to list the newly blocklisted items - Assert.equal(url, URI_EXTENSION_BLOCKLIST_DIALOG); - - // Simulate auto-disabling any softblocks - var list = args.wrappedJSObject.list; - list.forEach(function(aItem) { - if (!aItem.blocked) - aItem.disable = true; - }); - - // run the code after the blocklist is closed - Services.obs.notifyObservers(null, "addon-blocklist-closed"); - - }, - - QueryInterface(iid) { - if (iid.equals(Ci.nsIWindowWatcher) - || iid.equals(Ci.nsISupports)) - return this; - - throw Cr.NS_ERROR_NO_INTERFACE; - } -}; - -MockRegistrar.register("@mozilla.org/embedcomp/window-watcher;1", WindowWatcher); - - -function load_blocklist(aFile, aCallback) { - Services.obs.addObserver(function observer() { - Services.obs.removeObserver(observer, "blocklist-updated"); - - executeSoon(aCallback); - }, "blocklist-updated"); - - Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:" + - gPort + "/data/" + aFile); - var blocklist = Cc["@mozilla.org/extensions/blocklist;1"]. - getService(Ci.nsITimerCallback); - blocklist.notify(null); -} - - -function end_test() { - do_test_finished(); -} - -function run_test() { - do_test_pending(); - - createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9"); - - writeInstallRDFForExtension({ - id: "test_bug393285_1@tests.mozilla.org", - name: "extension 1", - bootstrap: true, - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - - writeInstallRDFForExtension({ - id: "test_bug393285_2@tests.mozilla.org", - name: "extension 2", - bootstrap: true, - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - writeInstallRDFForExtension({ - id: "test_bug393285_3a@tests.mozilla.org", - name: "extension 3a", - bootstrap: true, - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - writeInstallRDFForExtension({ - id: "test_bug393285_3b@tests.mozilla.org", - name: "extension 3b", - bootstrap: true, - version: "2.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - writeInstallRDFForExtension({ - id: "test_bug393285_4@tests.mozilla.org", - name: "extension 4", - bootstrap: true, - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - writeInstallRDFForExtension({ - id: "test_bug393285_5@tests.mozilla.org", - name: "extension 5", - bootstrap: true, - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - writeInstallRDFForExtension({ - id: "test_bug393285_6@tests.mozilla.org", - name: "extension 6", - bootstrap: true, - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - writeInstallRDFForExtension({ - id: "test_bug393285_7@tests.mozilla.org", - name: "extension 7", - bootstrap: true, - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - writeInstallRDFForExtension({ - id: "test_bug393285_8@tests.mozilla.org", - name: "extension 8", - bootstrap: true, - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - writeInstallRDFForExtension({ - id: "test_bug393285_9@tests.mozilla.org", - name: "extension 9", - bootstrap: true, - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - writeInstallRDFForExtension({ - id: "test_bug393285_10@tests.mozilla.org", - name: "extension 10", - bootstrap: true, - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - writeInstallRDFForExtension({ - id: "test_bug393285_11@tests.mozilla.org", - name: "extension 11", - bootstrap: true, - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - writeInstallRDFForExtension({ - id: "test_bug393285_12@tests.mozilla.org", - name: "extension 12", - bootstrap: true, - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - writeInstallRDFForExtension({ - id: "test_bug393285_13@tests.mozilla.org", - name: "extension 13", - bootstrap: true, - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - writeInstallRDFForExtension({ - id: "test_bug393285_14@tests.mozilla.org", - name: "extension 14", - bootstrap: true, - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - startupManager(); - - AddonManager.getAddonsByIDs(addonIDs, function(addons) { - for (let addon of addons) { - Assert.equal(addon.blocklistState, Ci.nsIBlocklistService.STATE_NOT_BLOCKED); - } - run_test_1(); - }); -} - -function run_test_1() { - load_blocklist("test_bug393285.xml", function() { - restartManager(); - - AddonManager.getAddonsByIDs(addonIDs, - function([a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, - a11, a12, a13, a14, a15]) { - // No info in blocklist, shouldn't be blocked - Assert.ok(!Services.blocklist.isAddonBlocklisted(a1, "1", "1.9")); - - // Should always be blocked - Assert.ok(Services.blocklist.isAddonBlocklisted(a2, "1", "1.9")); - - // Only version 1 should be blocked - Assert.ok(Services.blocklist.isAddonBlocklisted(a3, "1", "1.9")); - Assert.ok(!Services.blocklist.isAddonBlocklisted(a4, "1", "1.9")); - - // Should be blocked for app version 1 - Assert.ok(Services.blocklist.isAddonBlocklisted(a5, "1", "1.9")); - Assert.ok(!Services.blocklist.isAddonBlocklisted(a5, "2", "1.9")); - - // Not blocklisted because we are a different OS - Assert.ok(!Services.blocklist.isAddonBlocklisted(a6, "2", "1.9")); - - // Blocklisted based on OS - Assert.ok(Services.blocklist.isAddonBlocklisted(a7, "2", "1.9")); - Assert.ok(Services.blocklist.isAddonBlocklisted(a8, "2", "1.9")); - - // Not blocklisted because we are a different ABI - Assert.ok(!Services.blocklist.isAddonBlocklisted(a9, "2", "1.9")); - - // Blocklisted based on ABI - Assert.ok(Services.blocklist.isAddonBlocklisted(a10, "2", "1.9")); - Assert.ok(Services.blocklist.isAddonBlocklisted(a11, "2", "1.9")); - - // Doesn't match both os and abi so not blocked - Assert.ok(!Services.blocklist.isAddonBlocklisted(a12, "2", "1.9")); - Assert.ok(!Services.blocklist.isAddonBlocklisted(a13, "2", "1.9")); - Assert.ok(!Services.blocklist.isAddonBlocklisted(a14, "2", "1.9")); - - // Matches both os and abi so blocked - Assert.ok(Services.blocklist.isAddonBlocklisted(a15, "2", "1.9")); - end_test(); - }); - }); -} diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index 64874aacc409..98a1a19001fd 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -28,6 +28,10 @@ tags = blocklist # Bug 676992: test consistently hangs on Android skip-if = os == "android" tags = blocklist +[test_blocklist_osabi.js] +# Bug 676992: test consistently hangs on Android +skip-if = os == "android" +tags = blocklist [test_blocklist_prefs.js] tags = blocklist [test_blocklist_regexp.js] @@ -43,10 +47,6 @@ skip-if = true # Bug 1358846 Bug 1365021 Bug 676992 [test_bootstrap_globals.js] [test_bug1180901_2.js] skip-if = os != "win" -[test_bug393285.js] -# Bug 676992: test consistently hangs on Android -skip-if = os == "android" -tags = blocklist [test_bug397778.js] # Bug 676992: test consistently hangs on Android skip-if = os == "android" From 5e0d5d3116bd314472c333460e93aece596227ab Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 13:41:23 -0700 Subject: [PATCH 52/88] Bug 1449255: Part 4b - Fold test_bug406118 into test_blocklist_osabi.js. r=aswan MozReview-Commit-ID: IzXQQCi0NJA --HG-- extra : rebase_source : f612a028988feb971637309e7a17a1b9a5a6a92f --- .../test/xpcshell/test_blocklist_osabi.js | 44 ++--- .../test/xpcshell/test_bug406118.js | 151 ------------------ .../extensions/test/xpcshell/xpcshell.ini | 4 - 3 files changed, 22 insertions(+), 177 deletions(-) delete mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_bug406118.js diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_osabi.js b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_osabi.js index 90a4aa9ef8b3..2704d69ba6be 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_osabi.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_osabi.js @@ -25,7 +25,7 @@ const ADDONS = { }] }, // No info in blocklist, shouldn't be blocked - notBlocklisted: ["1", "1.9"], + notBlocklisted: [["1", "1.9"], [null, null]], }, "test_bug393285_2@tests.mozilla.org": { @@ -41,7 +41,7 @@ const ADDONS = { }] }, // Should always be blocked - blocklisted: ["1", "1.9"], + blocklisted: [["1", "1.9"], [null, null]], }, "test_bug393285_3a@tests.mozilla.org": { @@ -57,7 +57,7 @@ const ADDONS = { }] }, // Only version 1 should be blocked - blocklisted: ["1", "1.9"], + blocklisted: [["1", "1.9"], [null, null]], }, "test_bug393285_3b@tests.mozilla.org": { @@ -73,7 +73,7 @@ const ADDONS = { }] }, // Only version 1 should be blocked - notBlocklisted: ["1", "1.9"], + notBlocklisted: [["1", "1.9"]], }, "test_bug393285_4@tests.mozilla.org": { @@ -89,8 +89,8 @@ const ADDONS = { }] }, // Should be blocked for app version 1 - blocklisted: ["1", "1.9"], - notBlocklisted: ["2", "1.9"], + blocklisted: [["1", "1.9"], [null, null]], + notBlocklisted: [["2", "1.9"]], }, "test_bug393285_5@tests.mozilla.org": { @@ -106,7 +106,7 @@ const ADDONS = { }] }, // Not blocklisted because we are a different OS - notBlocklisted: ["2", "1.9"], + notBlocklisted: [["2", "1.9"]], }, "test_bug393285_6@tests.mozilla.org": { @@ -122,7 +122,7 @@ const ADDONS = { }] }, // Blocklisted based on OS - blocklisted: ["2", "1.9"], + blocklisted: [["2", "1.9"]], }, "test_bug393285_7@tests.mozilla.org": { @@ -138,7 +138,7 @@ const ADDONS = { }] }, // Blocklisted based on OS - blocklisted: ["2", "1.9"], + blocklisted: [["2", "1.9"]], }, "test_bug393285_8@tests.mozilla.org": { @@ -154,7 +154,7 @@ const ADDONS = { }] }, // Not blocklisted because we are a different ABI - notBlocklisted: ["2", "1.9"], + notBlocklisted: [["2", "1.9"]], }, "test_bug393285_9@tests.mozilla.org": { @@ -170,7 +170,7 @@ const ADDONS = { }] }, // Blocklisted based on ABI - blocklisted: ["2", "1.9"], + blocklisted: [["2", "1.9"]], }, "test_bug393285_10@tests.mozilla.org": { @@ -186,7 +186,7 @@ const ADDONS = { }] }, // Blocklisted based on ABI - blocklisted: ["2", "1.9"], + blocklisted: [["2", "1.9"]], }, "test_bug393285_11@tests.mozilla.org": { @@ -202,7 +202,7 @@ const ADDONS = { }] }, // Doesn't match both os and abi so not blocked - notBlocklisted: ["2", "1.9"], + notBlocklisted: [["2", "1.9"]], }, "test_bug393285_12@tests.mozilla.org": { @@ -218,7 +218,7 @@ const ADDONS = { }] }, // Doesn't match both os and abi so not blocked - notBlocklisted: ["2", "1.9"], + notBlocklisted: [["2", "1.9"]], }, "test_bug393285_13@tests.mozilla.org": { @@ -234,7 +234,7 @@ const ADDONS = { }] }, // Doesn't match both os and abi so not blocked - notBlocklisted: ["2", "1.9"], + notBlocklisted: [["2", "1.9"]], }, "test_bug393285_14@tests.mozilla.org": { @@ -250,7 +250,7 @@ const ADDONS = { }] }, // Matches both os and abi so blocked - blocklisted: ["2", "1.9"], + blocklisted: [["2", "1.9"]], }, }; @@ -287,13 +287,13 @@ add_task(async function test_1() { let addons = await getAddons(ADDON_IDS); for (let [id, options] of Object.entries(ADDONS)) { - if (options.blocklisted) { - ok(Services.blocklist.isAddonBlocklisted(addons.get(id), ...options.blocklisted), - `Add-on ${id} should be blocklisted in app/platform version ${options.blocklisted}`); + for (let blocklisted of options.blocklisted || []) { + ok(Services.blocklist.isAddonBlocklisted(addons.get(id), ...blocklisted), + `Add-on ${id} should be blocklisted in app/platform version ${blocklisted}`); } - if (options.notBlocklisted) { - ok(!Services.blocklist.isAddonBlocklisted(addons.get(id), ...options.notBlocklisted), - `Add-on ${id} should not be blocklisted in app/platform version ${options.notBlocklisted}`); + for (let notBlocklisted of options.notBlocklisted || []) { + ok(!Services.blocklist.isAddonBlocklisted(addons.get(id), ...notBlocklisted), + `Add-on ${id} should not be blocklisted in app/platform version ${notBlocklisted}`); } } }); diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug406118.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug406118.js deleted file mode 100644 index 8c05c4ee12b5..000000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug406118.js +++ /dev/null @@ -1,151 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -var addonIDs = ["test_bug393285_1@tests.mozilla.org", - "test_bug393285_2@tests.mozilla.org", - "test_bug393285_3a@tests.mozilla.org", - "test_bug393285_4@tests.mozilla.org"]; - -const URI_EXTENSION_BLOCKLIST_DIALOG = "chrome://mozapps/content/extensions/blocklist.xul"; - -ChromeUtils.import("resource://testing-common/MockRegistrar.jsm"); -var testserver = AddonTestUtils.createHttpServer({hosts: ["example.com"]}); -gPort = testserver.identity.primaryPort; - -testserver.registerDirectory("/data/", do_get_file("data")); - -const profileDir = gProfD.clone(); -profileDir.append("extensions"); - -// A window watcher to deal with the blocklist UI dialog. -var WindowWatcher = { - openWindow(parent, url, name, features, args) { - // Should be called to list the newly blocklisted items - Assert.equal(url, URI_EXTENSION_BLOCKLIST_DIALOG); - - // Simulate auto-disabling any softblocks - var list = args.wrappedJSObject.list; - list.forEach(function(aItem) { - if (!aItem.blocked) - aItem.disable = true; - }); - - // run the code after the blocklist is closed - Services.obs.notifyObservers(null, "addon-blocklist-closed"); - - }, - - QueryInterface(iid) { - if (iid.equals(Ci.nsIWindowWatcher) - || iid.equals(Ci.nsISupports)) - return this; - - throw Cr.NS_ERROR_NO_INTERFACE; - } -}; - -MockRegistrar.register("@mozilla.org/embedcomp/window-watcher;1", WindowWatcher); - -function load_blocklist(aFile, aCallback) { - Services.obs.addObserver(function observer() { - Services.obs.removeObserver(observer, "blocklist-updated"); - - executeSoon(aCallback); - }, "blocklist-updated"); - - Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:" + - gPort + "/data/" + aFile); - var blocklist = Cc["@mozilla.org/extensions/blocklist;1"]. - getService(Ci.nsITimerCallback); - blocklist.notify(null); -} - - -function end_test() { - do_test_finished(); -} - -function run_test() { - do_test_pending(); - - createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9"); - - writeInstallRDFForExtension({ - id: "test_bug393285_1@tests.mozilla.org", - name: "extension 1", - bootstrap: true, - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - - writeInstallRDFForExtension({ - id: "test_bug393285_2@tests.mozilla.org", - name: "extension 2", - bootstrap: true, - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - writeInstallRDFForExtension({ - id: "test_bug393285_3a@tests.mozilla.org", - name: "extension 3a", - bootstrap: true, - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - writeInstallRDFForExtension({ - id: "test_bug393285_4@tests.mozilla.org", - name: "extension 4", - bootstrap: true, - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - startupManager(); - - AddonManager.getAddonsByIDs(addonIDs, function(addons) { - for (let addon of addons) { - Assert.equal(addon.blocklistState, Ci.nsIBlocklistService.STATE_NOT_BLOCKED); - } - run_test_1(); - }); -} - -function run_test_1() { - load_blocklist("test_bug393285.xml", function() { - restartManager(); - - AddonManager.getAddonsByIDs(addonIDs, - function([a1, a2, a3, a4]) { - // No info in blocklist, shouldn't be blocked - Assert.ok(!Services.blocklist.isAddonBlocklisted(a1, null, null)); - - // All these should be blocklisted for the current app. - Assert.ok(Services.blocklist.isAddonBlocklisted(a2, null, null)); - Assert.ok(Services.blocklist.isAddonBlocklisted(a3, null, null)); - Assert.ok(Services.blocklist.isAddonBlocklisted(a4, null, null)); - - end_test(); - }); - }); -} diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index 98a1a19001fd..0ca634b97699 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -50,10 +50,6 @@ skip-if = os != "win" [test_bug397778.js] # Bug 676992: test consistently hangs on Android skip-if = os == "android" -[test_bug406118.js] -# Bug 676992: test consistently hangs on Android -skip-if = os == "android" -tags = blocklist [test_bug430120.js] # Bug 676992: test consistently hangs on Android skip-if = os == "android" From 82bc727924dca9cc64964c81802ab0823bb5816f Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 13:31:59 -0700 Subject: [PATCH 53/88] Bug 1449255: Part 5 - Rename test_bug397778 to test_manifest_locales.js and modernize. r=aswan MozReview-Commit-ID: 6PyCcBfSofu --HG-- rename : toolkit/mozapps/extensions/test/xpcshell/test_bug397778.js => toolkit/mozapps/extensions/test/xpcshell/test_manifest_locales.js extra : rebase_source : eae39c7a210cbb960a96a6837f477962b4b0fa83 --- .../test/xpcshell/test_bug397778.js | 168 ------------------ .../test/xpcshell/test_manifest_locales.js | 140 +++++++++++++++ .../extensions/test/xpcshell/xpcshell.ini | 6 +- 3 files changed, 143 insertions(+), 171 deletions(-) delete mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_bug397778.js create mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_manifest_locales.js diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug397778.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug397778.js deleted file mode 100644 index 2a4ee03e1320..000000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug397778.js +++ /dev/null @@ -1,168 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -const ID = "bug397778@tests.mozilla.org"; - -const ADDON = { - id: "bug397778@tests.mozilla.org", - version: "1.0", - name: "Fallback Name", - description: "Fallback Description", - bootstrap: true, - - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "1"}], - - localized: [ - { - locale: ["fr"], - name: "fr Name", - description: "fr Description", - }, - { - locale: ["de-DE"], - name: "Deutsches W\u00f6rterbuch", - }, - { - locale: ["es-ES"], - name: "es-ES Name", - description: "es-ES Description", - }, - { - locale: ["zh-TW"], - name: "zh-TW Name", - description: "zh-TW Description", - }, - { - locale: ["zh-CN"], - name: "zh-CN Name", - description: "zh-CN Description", - }, - { - locale: ["en-GB"], - name: "en-GB Name", - description: "en-GB Description", - }, - { - locale: ["en"], - name: "en Name", - description: "en Description", - }, - { - locale: ["en-CA"], - name: "en-CA Name", - description: "en-CA Description", - }, - ], -}; - -const XPI = createTempXPIFile(ADDON); - -function run_test() { - // Setup for test - do_test_pending(); - createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1"); - Services.locale.setRequestedLocales(["fr-FR"]); - - // Install test add-on - startupManager(); - installAllFiles([XPI], function() { - restartManager(); - - run_test_1(); - }); -} - -function run_test_1() { - AddonManager.getAddonByID(ID, callback_soon(function(addon) { - Assert.notEqual(addon, null); - Assert.equal(addon.name, "fr Name"); - Assert.equal(addon.description, "fr Description"); - - // Disable item - addon.userDisabled = true; - restartManager(); - - AddonManager.getAddonByID(ID, function(newAddon) { - Assert.notEqual(newAddon, null); - Assert.equal(newAddon.name, "fr Name"); - - executeSoon(run_test_2); - }); - })); -} - -function run_test_2() { - // Change locale. The more specific de-DE is the best match - Services.locale.setRequestedLocales(["de"]); - restartManager(); - - AddonManager.getAddonByID(ID, function(addon) { - Assert.notEqual(addon, null); - Assert.equal(addon.name, "Deutsches W\u00f6rterbuch"); - Assert.equal(addon.description, null); - - executeSoon(run_test_3); - }); -} - -function run_test_3() { - // Change locale. Locale case should have no effect - Services.locale.setRequestedLocales(["DE-de"]); - restartManager(); - - AddonManager.getAddonByID(ID, function(addon) { - Assert.notEqual(addon, null); - Assert.equal(addon.name, "Deutsches W\u00f6rterbuch"); - Assert.equal(addon.description, null); - - executeSoon(run_test_4); - }); -} - -function run_test_4() { - // Change locale. es-ES should closely match - Services.locale.setRequestedLocales(["es-AR"]); - restartManager(); - - AddonManager.getAddonByID(ID, function(addon) { - Assert.notEqual(addon, null); - Assert.equal(addon.name, "es-ES Name"); - Assert.equal(addon.description, "es-ES Description"); - - executeSoon(run_test_5); - }); -} - -function run_test_5() { - // Change locale. Either zh-CN or zh-TW could match - Services.locale.setRequestedLocales(["zh"]); - restartManager(); - - AddonManager.getAddonByID(ID, function(addon) { - Assert.notEqual(addon, null); - if (addon.name != "zh-TW Name" && addon.name != "zh-CN Name") - do_throw("zh matched to " + addon.name); - - executeSoon(run_test_6); - }); -} - -function run_test_6() { - // Unknown locale should try to match against en-US as well. Of en,en-GB - // en should match as being less specific - Services.locale.setRequestedLocales(["nl-NL"]); - restartManager(); - - AddonManager.getAddonByID(ID, function(addon) { - Assert.notEqual(addon, null); - Assert.equal(addon.name, "en Name"); - Assert.equal(addon.description, "en Description"); - - executeSoon(do_test_finished); - }); -} diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_manifest_locales.js b/toolkit/mozapps/extensions/test/xpcshell/test_manifest_locales.js new file mode 100644 index 000000000000..3bac50a20cd2 --- /dev/null +++ b/toolkit/mozapps/extensions/test/xpcshell/test_manifest_locales.js @@ -0,0 +1,140 @@ +/* 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/. + */ + +const ID = "bug397778@tests.mozilla.org"; + +const ADDON = { + id: "bug397778@tests.mozilla.org", + version: "1.0", + name: "Fallback Name", + description: "Fallback Description", + bootstrap: true, + + targetApplications: [{ + id: "xpcshell@tests.mozilla.org", + minVersion: "1", + maxVersion: "1"}], + + localized: [ + { + locale: ["fr"], + name: "fr Name", + description: "fr Description", + }, + { + locale: ["de-DE"], + name: "Deutsches W\u00f6rterbuch", + }, + { + locale: ["es-ES"], + name: "es-ES Name", + description: "es-ES Description", + }, + { + locale: ["zh-TW"], + name: "zh-TW Name", + description: "zh-TW Description", + }, + { + locale: ["zh-CN"], + name: "zh-CN Name", + description: "zh-CN Description", + }, + { + locale: ["en-GB"], + name: "en-GB Name", + description: "en-GB Description", + }, + { + locale: ["en"], + name: "en Name", + description: "en Description", + }, + { + locale: ["en-CA"], + name: "en-CA Name", + description: "en-CA Description", + }, + ], +}; + +function changeLocales(locales) { + Services.locale.setRequestedLocales(locales); + return promiseRestartManager(); +} + +add_task(async function setup() { + createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1"); + Services.locale.setRequestedLocales(["fr-FR"]); + + await promiseStartupManager(); + await promiseInstallXPI(ADDON); +}); + +add_task(async function test_1() { + let addon = await AddonManager.getAddonByID(ID); + Assert.notEqual(addon, null); + Assert.equal(addon.name, "fr Name"); + Assert.equal(addon.description, "fr Description"); + + // Disable item + addon.userDisabled = true; + restartManager(); + + let newAddon = await AddonManager.getAddonByID(ID); + Assert.notEqual(newAddon, null); + Assert.equal(newAddon.name, "fr Name"); +}); + +add_task(async function test_2() { + // Change locale. The more specific de-DE is the best match + await changeLocales(["de"]); + + let addon = await AddonManager.getAddonByID(ID); + Assert.notEqual(addon, null); + Assert.equal(addon.name, "Deutsches W\u00f6rterbuch"); + Assert.equal(addon.description, null); +}); + +add_task(async function test_3() { + // Change locale. Locale case should have no effect + await changeLocales(["DE-de"]); + + let addon = await AddonManager.getAddonByID(ID); + Assert.notEqual(addon, null); + Assert.equal(addon.name, "Deutsches W\u00f6rterbuch"); + Assert.equal(addon.description, null); +}); + +add_task(async function test_4() { + // Change locale. es-ES should closely match + await changeLocales(["es-AR"]); + + let addon = await AddonManager.getAddonByID(ID); + Assert.notEqual(addon, null); + Assert.equal(addon.name, "es-ES Name"); + Assert.equal(addon.description, "es-ES Description"); +}); + +add_task(async function test_5() { + // Change locale. Either zh-CN or zh-TW could match + await changeLocales(["zh"]); + + let addon = await AddonManager.getAddonByID(ID); + Assert.notEqual(addon, null); + ok(addon.name == "zh-TW Name" || addon.name == "zh-CN Name", + `Add-on name mismatch: ${addon.name}`); +}); + +add_task(async function test_6() { + // Unknown locale should try to match against en-US as well. Of en,en-GB + // en should match as being less specific + await changeLocales(["nl-NL"]); + + let addon = await AddonManager.getAddonByID(ID); + Assert.notEqual(addon, null); + Assert.equal(addon.name, "en Name"); + Assert.equal(addon.description, "en Description"); +}); diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index 0ca634b97699..9836d0b5704e 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -47,9 +47,6 @@ skip-if = true # Bug 1358846 Bug 1365021 Bug 676992 [test_bootstrap_globals.js] [test_bug1180901_2.js] skip-if = os != "win" -[test_bug397778.js] -# Bug 676992: test consistently hangs on Android -skip-if = os == "android" [test_bug430120.js] # Bug 676992: test consistently hangs on Android skip-if = os == "android" @@ -180,6 +177,9 @@ skip-if = os == "android" skip-if = !allow_legacy_extensions || appname == "thunderbird" [test_locale.js] [test_manifest.js] +[test_manifest_locales.js] +# Bug 676992: test consistently hangs on Android +skip-if = os == "android" [test_migrate_state_prefs.js] [test_no_addons.js] [test_nodisable_hidden.js] From 90cc046fd2290913ddbd86a47b6322dcd8e3e689 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 14:11:46 -0700 Subject: [PATCH 54/88] Bug 1449255: Part 6 - Rename test_bug430120 to test_blocklist_url_parameters.js and modernize. r=aswan MozReview-Commit-ID: 9f3RyR6jt4b --HG-- rename : toolkit/mozapps/extensions/test/xpcshell/test_bug430120.js => toolkit/mozapps/extensions/test/xpcshell/test_blocklist_url_parameters.js extra : rebase_source : 4c67938a5726e7c3b5cfaf43d5ba0744925dac1c --- .../xpcshell/test_blocklist_url_parameters.js | 105 +++++++++++++++ .../test/xpcshell/test_bug430120.js | 126 ------------------ .../extensions/test/xpcshell/xpcshell.ini | 8 +- 3 files changed, 109 insertions(+), 130 deletions(-) create mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_blocklist_url_parameters.js delete mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_bug430120.js diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_url_parameters.js b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_url_parameters.js new file mode 100644 index 000000000000..abc283833d37 --- /dev/null +++ b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_url_parameters.js @@ -0,0 +1,105 @@ +/* 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/. + */ + +const PREF_BLOCKLIST_URL = "extensions.blocklist.url"; +const PREF_BLOCKLIST_ENABLED = "extensions.blocklist.enabled"; +const PREF_APP_DISTRIBUTION = "distribution.id"; +const PREF_APP_DISTRIBUTION_VERSION = "distribution.version"; +const PREF_APP_UPDATE_CHANNEL = "app.update.channel"; + +Cu.importGlobalProperties(["URLSearchParams"]); + +// Get the HTTP server. +var testserver = AddonTestUtils.createHttpServer({hosts: ["example.com"]}); + +async function updateBlocklist(file) { + let blocklistUpdated = TestUtils.topicObserved("blocklist-updated"); + Services.blocklist.QueryInterface(Ci.nsITimerCallback).notify(null); + return blocklistUpdated; +} + +add_task(async function setup() { + createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9"); + + await promiseStartupManager(); +}); + +add_task(async function test_blocklist_disabled() { + testserver.registerPathHandler("/1", () => { + ok(false, "Should not have attempted to retrieve the blocklist when it is disabled"); + }); + + // This should have no effect as the blocklist is disabled + Services.prefs.setCharPref(PREF_BLOCKLIST_URL, "http://example.com/1"); + Services.prefs.setBoolPref(PREF_BLOCKLIST_ENABLED, false); + + // No await here. We're not expecting it to resolve until the + // blocklist is re-enabled. + updateBlocklist(); +}); + +add_task(async function test_blocklist_disabled() { + var ABI = "noarch-spidermonkey"; + // the blacklist service special-cases ABI for Universal binaries, + // so do the same here. + const CONTRACT = "@mozilla.org/xpcom/mac-utils;1"; + if (CONTRACT in Cc) { + let macutils = Cc[CONTRACT].getService(Ci.nsIMacUtils); + if (macutils.isUniversalBinary) { + ABI += "-u-" + macutils.architecturesInBinary; + } + } + + let osVersion; + try { + osVersion = Services.sysinfo.getProperty("name") + " " + Services.sysinfo.getProperty("version"); + if (osVersion) { + osVersion += " (" + Services.sysinfo.getProperty("secondaryLibrary") + ")"; + } + } catch (e) {} + + const EXPECTED = { + app_id: "xpcshell@tests.mozilla.org", + app_version: 1, + product: "XPCShell", + version: 1, + build_id: gAppInfo.appBuildID, + build_target: "XPCShell_" + ABI, + locale: "locale", + channel: "updatechannel", + os_version: osVersion, + platform_version: "1.9", + distribution: "distribution", + distribution_version: "distribution-version", + }; + + const PARAMS = Object.keys(EXPECTED).map(key => `${key}=%${key.toUpperCase()}%`).join("&"); + + let gotRequest = new Promise(resolve => { + testserver.registerPathHandler("/2", (request, response) => { + let params = new URLSearchParams(request.queryString); + for (let [key, val] of Object.entries(EXPECTED)) { + equal(String(params.get(key)), val, `Expected value for ${key} parameter`); + } + + resolve(); + }); + }); + + // Some values have to be on the default branch to work + var defaults = Services.prefs.QueryInterface(Ci.nsIPrefService) + .getDefaultBranch(null); + defaults.setCharPref(PREF_APP_UPDATE_CHANNEL, EXPECTED.channel); + defaults.setCharPref(PREF_APP_DISTRIBUTION, EXPECTED.distribution); + defaults.setCharPref(PREF_APP_DISTRIBUTION_VERSION, EXPECTED.distribution_version); + Services.locale.setRequestedLocales([EXPECTED.locale]); + + // This should correctly escape everything + Services.prefs.setCharPref(PREF_BLOCKLIST_URL, "http://example.com/2?" + PARAMS); + Services.prefs.setBoolPref(PREF_BLOCKLIST_ENABLED, true); + + await updateBlocklist(); + await gotRequest; +}); diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug430120.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug430120.js deleted file mode 100644 index 161f04081067..000000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug430120.js +++ /dev/null @@ -1,126 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -const BLOCKLIST_TIMER = "blocklist-background-update-timer"; -const PREF_BLOCKLIST_URL = "extensions.blocklist.url"; -const PREF_BLOCKLIST_ENABLED = "extensions.blocklist.enabled"; -const PREF_APP_DISTRIBUTION = "distribution.id"; -const PREF_APP_DISTRIBUTION_VERSION = "distribution.version"; -const PREF_APP_UPDATE_CHANNEL = "app.update.channel"; -const CATEGORY_UPDATE_TIMER = "update-timer"; - -// Get the HTTP server. -ChromeUtils.import("resource://testing-common/httpd.js"); -ChromeUtils.import("resource://testing-common/MockRegistrar.jsm"); -var testserver; -var gOSVersion; -var gBlocklist; - -// This is a replacement for the timer service so we can trigger timers -var timerService = { - - hasTimer(id) { - var catMan = Cc["@mozilla.org/categorymanager;1"] - .getService(Ci.nsICategoryManager); - var entries = catMan.enumerateCategory(CATEGORY_UPDATE_TIMER); - while (entries.hasMoreElements()) { - var entry = entries.getNext().QueryInterface(Ci.nsISupportsCString).data; - var value = catMan.getCategoryEntry(CATEGORY_UPDATE_TIMER, entry); - var timerID = value.split(",")[2]; - if (id == timerID) { - return true; - } - } - return false; - }, - - fireTimer(id) { - gBlocklist.QueryInterface(Ci.nsITimerCallback).notify(null); - }, - - QueryInterface(iid) { - if (iid.equals(Ci.nsIUpdateTimerManager) - || iid.equals(Ci.nsISupports)) - return this; - - throw Cr.NS_ERROR_NO_INTERFACE; - } -}; - -MockRegistrar.register("@mozilla.org/updates/timer-manager;1", timerService); - -function failHandler(metadata, response) { - do_throw("Should not have attempted to retrieve the blocklist when it is disabled"); -} - -function pathHandler(metadata, response) { - var ABI = "noarch-spidermonkey"; - // the blacklist service special-cases ABI for Universal binaries, - // so do the same here. - if ("@mozilla.org/xpcom/mac-utils;1" in Cc) { - var macutils = Cc["@mozilla.org/xpcom/mac-utils;1"] - .getService(Ci.nsIMacUtils); - if (macutils.isUniversalBinary) - ABI += "-u-" + macutils.architecturesInBinary; - } - Assert.equal(metadata.queryString, - "xpcshell@tests.mozilla.org&1&XPCShell&1&" + - gAppInfo.appBuildID + "&" + - "XPCShell_" + ABI + "&locale&updatechannel&" + - gOSVersion + "&1.9&distribution&distribution-version"); - gBlocklist.observe(null, "quit-application", ""); - gBlocklist.observe(null, "xpcom-shutdown", ""); - do_test_finished(); -} - -function run_test() { - var osVersion; - try { - osVersion = Services.sysinfo.getProperty("name") + " " + Services.sysinfo.getProperty("version"); - if (osVersion) { - try { - osVersion += " (" + Services.sysinfo.getProperty("secondaryLibrary") + ")"; - } catch (e) { - } - gOSVersion = encodeURIComponent(osVersion); - } - } catch (e) { - } - - createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9"); - - testserver = AddonTestUtils.createHttpServer({hosts: ["example.com"]}); - testserver.registerPathHandler("/1", failHandler); - testserver.registerPathHandler("/2", pathHandler); - - // Initialise the blocklist service - gBlocklist = Services.blocklist.QueryInterface(Ci.nsIObserver); - gBlocklist.observe(null, "profile-after-change", ""); - - Assert.ok(timerService.hasTimer(BLOCKLIST_TIMER)); - - do_test_pending(); - - // This should have no effect as the blocklist is disabled - Services.prefs.setCharPref(PREF_BLOCKLIST_URL, "http://example.com/1"); - Services.prefs.setBoolPref(PREF_BLOCKLIST_ENABLED, false); - timerService.fireTimer(BLOCKLIST_TIMER); - - // Some values have to be on the default branch to work - var defaults = Services.prefs.QueryInterface(Ci.nsIPrefService) - .getDefaultBranch(null); - defaults.setCharPref(PREF_APP_UPDATE_CHANNEL, "updatechannel"); - defaults.setCharPref(PREF_APP_DISTRIBUTION, "distribution"); - defaults.setCharPref(PREF_APP_DISTRIBUTION_VERSION, "distribution-version"); - Services.locale.setRequestedLocales(["locale"]); - - // This should correctly escape everything - Services.prefs.setCharPref(PREF_BLOCKLIST_URL, "http://example.com/2?" + - "%APP_ID%&%APP_VERSION%&%PRODUCT%&%VERSION%&%BUILD_ID%&" + - "%BUILD_TARGET%&%LOCALE%&%CHANNEL%&" + - "%OS_VERSION%&%PLATFORM_VERSION%&%DISTRIBUTION%&%DISTRIBUTION_VERSION%"); - Services.prefs.setBoolPref(PREF_BLOCKLIST_ENABLED, true); - timerService.fireTimer(BLOCKLIST_TIMER); -} diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index 9836d0b5704e..6e31e00194a1 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -37,6 +37,10 @@ tags = blocklist [test_blocklist_regexp.js] skip-if = os == "android" tags = blocklist +[test_blocklist_url_parameters.js] +# Bug 676992: test consistently hangs on Android +skip-if = os == "android" +tags = blocklist [test_blocklistchange.js] # Times out during parallel runs on desktop requesttimeoutfactor = 2 @@ -47,10 +51,6 @@ skip-if = true # Bug 1358846 Bug 1365021 Bug 676992 [test_bootstrap_globals.js] [test_bug1180901_2.js] skip-if = os != "win" -[test_bug430120.js] -# Bug 676992: test consistently hangs on Android -skip-if = os == "android" -tags = blocklist [test_bug449027.js] # Bug 676992: test consistently hangs on Android skip-if = os == "android" From e0114e8572cfb4c89dd49dc7463c6885175771d7 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 14:47:47 -0700 Subject: [PATCH 55/88] Bug 1449255: Part 7 - Rename test_bug449027 to test_blocklist_appversion.js and modernize. r=aswan MozReview-Commit-ID: EUsLNs9WaOI --HG-- rename : toolkit/mozapps/extensions/test/xpcshell/test_bug449027.js => toolkit/mozapps/extensions/test/xpcshell/test_blocklist_appversion.js extra : rebase_source : 6789415ed84aafadc5a81751ef8ec56f804e5583 --- ...449027.js => test_blocklist_appversion.js} | 228 ++++++------------ .../extensions/test/xpcshell/xpcshell.ini | 8 +- 2 files changed, 82 insertions(+), 154 deletions(-) rename toolkit/mozapps/extensions/test/xpcshell/{test_bug449027.js => test_blocklist_appversion.js} (56%) diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug449027.js b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_appversion.js similarity index 56% rename from toolkit/mozapps/extensions/test/xpcshell/test_bug449027.js rename to toolkit/mozapps/extensions/test/xpcshell/test_blocklist_appversion.js index 13d8771f0c73..059b7412af1d 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug449027.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_appversion.js @@ -2,10 +2,11 @@ * 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/. */ -const URI_EXTENSION_BLOCKLIST_DIALOG = "chrome://mozapps/content/extensions/blocklist.xul"; -ChromeUtils.import("resource://testing-common/httpd.js"); -ChromeUtils.import("resource://testing-common/MockRegistrar.jsm"); +const Cm = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); + +var testserver = AddonTestUtils.createHttpServer({hosts: ["example.com"]}); +testserver.registerDirectory("/data/", do_get_file("data")); var ADDONS = [{ id: "test_bug449027_1@tests.mozilla.org", @@ -225,8 +226,6 @@ var PLUGINS = [ new MockPluginTag("test_bug449027_25", "5", false, true, true) ]; -var gCallback = null; -var gTestserver = null; var gNewBlocks = []; // A fake plugin host for the blocklist service to use @@ -236,75 +235,46 @@ var PluginHost = { return PLUGINS; }, - QueryInterface(iid) { - if (iid.equals(Ci.nsIPluginHost) - || iid.equals(Ci.nsISupports)) - return this; - - throw Cr.NS_ERROR_NO_INTERFACE; - } + QueryInterface: XPCOMUtils.generateQI(["nsIPluginHost"]), }; -// Don't need the full interface, attempts to call other methods will just -// throw which is just fine -var WindowWatcher = { - openWindow(parent, url, name, features, args) { - // Should be called to list the newly blocklisted items - Assert.equal(url, URI_EXTENSION_BLOCKLIST_DIALOG); - Assert.notEqual(gCallback, null); - - args = args.wrappedJSObject; - - gNewBlocks = []; - var list = args.list; - for (let listItem of list) - gNewBlocks.push(listItem.name + " " + listItem.version); - - // Call the callback after the blocklist has finished up - do_timeout(0, gCallback); +var BlocklistPrompt = { + prompt(list) { + gNewBlocks = list.map(item => `${item.name} ${item.version}`); }, - QueryInterface(iid) { - if (iid.equals(Ci.nsIWindowWatcher) - || iid.equals(Ci.nsISupports)) - return this; - - throw Cr.NS_ERROR_NO_INTERFACE; - } + QueryInterface: XPCOMUtils.generateQI(["nsIBlocklistPrompt"]), }; -MockRegistrar.register("@mozilla.org/plugin/host;1", PluginHost); -MockRegistrar.register("@mozilla.org/embedcomp/window-watcher;1", WindowWatcher); -function create_addon(addon) { - var installrdf = "\n" + - "\n" + - "\n" + - " \n" + - " " + addon.id + "\n" + - " " + addon.version + "\n" + - " true\n" + - " \n" + - " \n" + - " xpcshell@tests.mozilla.org\n" + - " 3\n" + - " 3\n" + - " \n" + - " \n" + - " " + addon.name + "\n" + - " \n" + - "\n"; - var target = gProfD.clone(); - target.append("extensions"); - target.append(addon.id); - target.append("install.rdf"); - target.create(target.NORMAL_FILE_TYPE, 0o644); - var stream = Cc["@mozilla.org/network/file-output-stream;1"] - .createInstance(Ci.nsIFileOutputStream); - stream.init(target, 0x04 | 0x08 | 0x20, 0o664, 0); // write, create, truncate - stream.write(installrdf, installrdf.length); - stream.close(); +async function loadBlocklist(file) { + let blocklistUpdated = TestUtils.topicObserved("blocklist-updated"); + + Services.prefs.setCharPref("extensions.blocklist.url", + "http://example.com/data/" + file); + Services.blocklist.QueryInterface(Ci.nsITimerCallback).notify(null); + + await blocklistUpdated; +} + +MockRegistrar.register("@mozilla.org/plugin/host;1", PluginHost); + +let factory = XPCOMUtils.generateSingletonFactory(function() { return BlocklistPrompt; }); +Cm.registerFactory(Components.ID("{26d32654-30c7-485d-b983-b4d2568aebba}"), + "Blocklist Prompt", + "@mozilla.org/addons/blocklist-prompt;1", factory); + +function createAddon(addon) { + return promiseInstallXPI({ + name: addon.name, + id: addon.id, + version: addon.version, + bootstrap: true, + targetApplications: [{ + id: "xpcshell@tests.mozilla.org", + minVersion: "3", + maxVersion: "3"}], + }); } /** @@ -312,106 +282,64 @@ function create_addon(addon) { * If a lastTest is provided checks that the notification dialog got passed * the newly blocked items compared to the previous test. */ -function check_state(test, lastTest, callback) { - AddonManager.getAddonsByIDs(ADDONS.map(a => a.id), function(addons) { - for (var i = 0; i < ADDONS.length; i++) { - var blocked = addons[i].blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED; - if (blocked != ADDONS[i][test]) - do_throw("Blocklist state did not match expected for extension " + (i + 1) + ", test " + test); - } +async function checkState(test, lastTest, callback) { + let addons = await AddonManager.getAddonsByIDs(ADDONS.map(a => a.id)); + for (var i = 0; i < ADDONS.length; i++) { + var blocked = addons[i].blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED; + equal(blocked, ADDONS[i][test], + `Blocklist state should match expected for extension ${i + 1}, test ${test}`); + } + + for (i = 0; i < PLUGINS.length; i++) { + equal(PLUGINS[i].blocklisted, PLUGINS[i][test], + `Blocklist state should match expected for plugin ${i + 1}, test ${test}`); + } + + if (lastTest) { + var expected = 0; for (i = 0; i < PLUGINS.length; i++) { - if (PLUGINS[i].blocklisted != PLUGINS[i][test]) - do_throw("Blocklist state did not match expected for plugin " + (i + 1) + ", test " + test); - } - - if (lastTest) { - var expected = 0; - for (i = 0; i < PLUGINS.length; i++) { - if (PLUGINS[i][test] && !PLUGINS[i][lastTest]) { - if (!gNewBlocks.includes(PLUGINS[i].name + " " + PLUGINS[i].version)) - do_throw("Plugin " + (i + 1) + " should have been listed in the blocklist notification for test " + test); - expected++; - } + if (PLUGINS[i][test] && !PLUGINS[i][lastTest]) { + ok(gNewBlocks.includes(`${PLUGINS[i].name} ${PLUGINS[i].version}`), + `Plugin ${i + 1} should have been listed in the blocklist notification for test ${test}`); + expected++; } - - Assert.equal(expected, gNewBlocks.length); } - executeSoon(callback); - }); + + Assert.equal(expected, gNewBlocks.length); + } } -function load_blocklist(file) { - Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:" + gPort + "/data/" + file); - var blocklist = Cc["@mozilla.org/extensions/blocklist;1"] - .getService(Ci.nsITimerCallback); - blocklist.notify(null); -} - -function run_test() { - // Setup for test - dump("Setting up tests\n"); - // Rather than keeping lots of identical add-ons in version control, just - // write them into the profile. - for (let addon of ADDONS) - create_addon(addon); - +add_task(async function test() { createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8"); - startupManager(); + await promiseStartupManager(); - gTestserver = new HttpServer(); - gTestserver.registerDirectory("/data/", do_get_file("data")); - gTestserver.start(-1); - gPort = gTestserver.identity.primaryPort; + for (let addon of ADDONS) { + await createAddon(addon); + } - do_test_pending(); - check_test_pt1(); -} + let addons = await AddonManager.getAddonsByIDs(ADDONS.map(a => a.id)); + for (var i = 0; i < ADDONS.length; i++) { + ok(addons[i], `Addon ${i + 1} should have been correctly installed`); + } -/** - * Checks the initial state is correct - */ -function check_test_pt1() { - dump("Checking pt 1\n"); - - AddonManager.getAddonsByIDs(ADDONS.map(a => a.id), function(addons) { - for (var i = 0; i < ADDONS.length; i++) { - if (!addons[i]) - do_throw("Addon " + (i + 1) + " did not get installed correctly"); - } - - executeSoon(function checkstate1() { check_state("start", null, run_test_pt2); }); - }); -} + await checkState("start"); +}); /** * Load the toolkit based blocks */ -function run_test_pt2() { - dump("Running test pt 2\n"); - gCallback = check_test_pt2; - load_blocklist("test_bug449027_toolkit.xml"); -} +add_task(async function test_pt2() { + await loadBlocklist("test_bug449027_toolkit.xml"); -function check_test_pt2() { - dump("Checking pt 2\n"); - check_state("toolkitBlocks", "start", run_test_pt3); -} + await checkState("toolkitBlocks", "start"); +}); /** * Load the application based blocks */ -function run_test_pt3() { - dump("Running test pt 3\n"); - gCallback = check_test_pt3; - load_blocklist("test_bug449027_app.xml"); -} +add_task(async function test_pt3() { + await loadBlocklist("test_bug449027_app.xml"); -function check_test_pt3() { - dump("Checking pt 3\n"); - check_state("appBlocks", "toolkitBlocks", end_test); -} - -function end_test() { - gTestserver.stop(do_test_finished); -} + await checkState("appBlocks", "toolkitBlocks"); +}); diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index 6e31e00194a1..21144572ec4f 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -22,6 +22,10 @@ tags = blocklist [test_backgroundupdate.js] [test_bad_json.js] [test_badschema.js] +[test_blocklist_appversion.js] +# Bug 676992: test consistently hangs on Android +skip-if = os == "android" +tags = blocklist [test_blocklist_gfx.js] tags = blocklist [test_blocklist_metadata_filters.js] @@ -51,10 +55,6 @@ skip-if = true # Bug 1358846 Bug 1365021 Bug 676992 [test_bootstrap_globals.js] [test_bug1180901_2.js] skip-if = os != "win" -[test_bug449027.js] -# Bug 676992: test consistently hangs on Android -skip-if = os == "android" -tags = blocklist [test_bug455906.js] # Bug 676992: test consistently hangs on Android skip-if = os == "android" From 7262f6ef875256a320e9c6eb79cbcc30d3713ebd Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 15:18:51 -0700 Subject: [PATCH 56/88] Bug 1449255: Part 8 - Rename test_bug455906 to test_blocklist_severities.js and modernize a bit. r=aswan MozReview-Commit-ID: 515VqigTDK6 --HG-- rename : toolkit/mozapps/extensions/test/xpcshell/test_bug455906.js => toolkit/mozapps/extensions/test/xpcshell/test_blocklist_severities.js extra : rebase_source : be478c5fce0b1bc26bad8c9cd0c4e7f4deb1b4b8 --- .../xpcshell/test_blocklist_severities.js | 425 +++++++++++++++ .../test/xpcshell/test_bug455906.js | 505 ------------------ .../extensions/test/xpcshell/xpcshell.ini | 8 +- 3 files changed, 429 insertions(+), 509 deletions(-) create mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_blocklist_severities.js delete mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_bug455906.js diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_severities.js b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_severities.js new file mode 100644 index 000000000000..d240a1a5e85f --- /dev/null +++ b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_severities.js @@ -0,0 +1,425 @@ +/* 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/. + */ + +const URI_EXTENSION_BLOCKLIST_DIALOG = "chrome://mozapps/content/extensions/blocklist.xul"; + +ChromeUtils.import("resource://testing-common/MockRegistrar.jsm"); + +var gTestserver = AddonTestUtils.createHttpServer({hosts: ["example.com"]}); +gTestserver.registerDirectory("/data/", do_get_file("data")); + +// Workaround for Bug 658720 - URL formatter can leak during xpcshell tests +const PREF_BLOCKLIST_ITEM_URL = "extensions.blocklist.itemURL"; +Services.prefs.setCharPref(PREF_BLOCKLIST_ITEM_URL, "http://example.com/blocklist/%blockID%"); + +var ADDONS = [{ + // Tests how the blocklist affects a disabled add-on + id: "test_bug455906_1@tests.mozilla.org", + name: "Bug 455906 Addon Test 1", + version: "5", + appVersion: "3" +}, { + // Tests how the blocklist affects an enabled add-on + id: "test_bug455906_2@tests.mozilla.org", + name: "Bug 455906 Addon Test 2", + version: "5", + appVersion: "3" +}, { + // Tests how the blocklist affects an enabled add-on, to be disabled by the notification + id: "test_bug455906_3@tests.mozilla.org", + name: "Bug 455906 Addon Test 3", + version: "5", + appVersion: "3" +}, { + // Tests how the blocklist affects a disabled add-on that was already warned about + id: "test_bug455906_4@tests.mozilla.org", + name: "Bug 455906 Addon Test 4", + version: "5", + appVersion: "3" +}, { + // Tests how the blocklist affects an enabled add-on that was already warned about + id: "test_bug455906_5@tests.mozilla.org", + name: "Bug 455906 Addon Test 5", + version: "5", + appVersion: "3" +}, { + // Tests how the blocklist affects an already blocked add-on + id: "test_bug455906_6@tests.mozilla.org", + name: "Bug 455906 Addon Test 6", + version: "5", + appVersion: "3" +}, { + // Tests how the blocklist affects an incompatible add-on + id: "test_bug455906_7@tests.mozilla.org", + name: "Bug 455906 Addon Test 7", + version: "5", + appVersion: "2" +}, { + // Spare add-on used to ensure we get a notification when switching lists + id: "dummy_bug455906_1@tests.mozilla.org", + name: "Dummy Addon 1", + version: "5", + appVersion: "3" +}, { + // Spare add-on used to ensure we get a notification when switching lists + id: "dummy_bug455906_2@tests.mozilla.org", + name: "Dummy Addon 2", + version: "5", + appVersion: "3" +}]; + +class MockPlugin { + constructor(name, version, enabledState) { + this.name = name; + this.version = version; + this.enabledState = enabledState; + } + get blocklisted() { + return Services.blocklist.getPluginBlocklistState(this) == Services.blocklist.STATE_BLOCKED; + } + get disabled() { + return this.enabledState == Ci.nsIPluginTag.STATE_DISABLED; + } +} + +var PLUGINS = [ + // Tests how the blocklist affects a disabled plugin + new MockPlugin("test_bug455906_1", "5", Ci.nsIPluginTag.STATE_DISABLED), + // Tests how the blocklist affects an enabled plugin + new MockPlugin("test_bug455906_2", "5", Ci.nsIPluginTag.STATE_ENABLED), + // Tests how the blocklist affects an enabled plugin, to be disabled by the notification + new MockPlugin("test_bug455906_3", "5", Ci.nsIPluginTag.STATE_ENABLED), + // Tests how the blocklist affects a disabled plugin that was already warned about + new MockPlugin("test_bug455906_4", "5", Ci.nsIPluginTag.STATE_DISABLED), + // Tests how the blocklist affects an enabled plugin that was already warned about + new MockPlugin("test_bug455906_5", "5", Ci.nsIPluginTag.STATE_ENABLED), + // Tests how the blocklist affects an already blocked plugin + new MockPlugin("test_bug455906_6", "5", Ci.nsIPluginTag.STATE_ENABLED) +]; + +var gNotificationCheck = null; + +// A fake plugin host for the blocklist service to use +var PluginHost = { + getPluginTags(countRef) { + countRef.value = PLUGINS.length; + return PLUGINS; + }, + + QueryInterface: XPCOMUtils.generateQI(["nsIPluginHost"]), +}; + +// Don't need the full interface, attempts to call other methods will just +// throw which is just fine +var WindowWatcher = { + openWindow(parent, url, name, features, windowArguments) { + // Should be called to list the newly blocklisted items + equal(url, URI_EXTENSION_BLOCKLIST_DIALOG); + + if (gNotificationCheck) { + gNotificationCheck(windowArguments.wrappedJSObject); + } + + // run the code after the blocklist is closed + Services.obs.notifyObservers(null, "addon-blocklist-closed"); + }, + + QueryInterface: XPCOMUtils.generateQI(["nsIWindowWatcher"]), +}; + +MockRegistrar.register("@mozilla.org/plugin/host;1", PluginHost); +MockRegistrar.register("@mozilla.org/embedcomp/window-watcher;1", WindowWatcher); + +function createAddon(addon) { + return promiseInstallXPI({ + name: addon.name, + id: addon.id, + version: addon.version, + bootstrap: true, + targetApplications: [{ + id: "xpcshell@tests.mozilla.org", + minVersion: addon.appVersion, + maxVersion: addon.appVersion}], + }); +} + +async function loadBlocklist(file, callback) { + let blocklistUpdated = TestUtils.topicObserved("blocklist-updated"); + + gNotificationCheck = callback; + + Services.prefs.setCharPref("extensions.blocklist.url", + "http://example.com/data/" + file); + Services.blocklist.QueryInterface(Ci.nsITimerCallback).notify(null); + + await blocklistUpdated; +} + +function check_plugin_state(plugin) { + return plugin.disabled + "," + plugin.blocklisted; +} + +function create_blocklistURL(blockID) { + let url = Services.urlFormatter.formatURLPref(PREF_BLOCKLIST_ITEM_URL); + url = url.replace(/%blockID%/g, blockID); + return url; +} + +// Before every main test this is the state the add-ons are meant to be in +async function checkInitialState() { + let addons = await AddonManager.getAddonsByIDs(ADDONS.map(a => a.id)); + + checkAddonState(addons[0], {userDisabled: true, softDisabled: false, appDisabled: false}); + checkAddonState(addons[1], {userDisabled: false, softDisabled: false, appDisabled: false}); + checkAddonState(addons[2], {userDisabled: false, softDisabled: false, appDisabled: false}); + checkAddonState(addons[3], {userDisabled: true, softDisabled: true, appDisabled: false}); + checkAddonState(addons[4], {userDisabled: false, softDisabled: false, appDisabled: false}); + checkAddonState(addons[5], {userDisabled: false, softDisabled: false, appDisabled: true}); + checkAddonState(addons[6], {userDisabled: false, softDisabled: false, appDisabled: true}); + + equal(check_plugin_state(PLUGINS[0]), "true,false"); + equal(check_plugin_state(PLUGINS[1]), "false,false"); + equal(check_plugin_state(PLUGINS[2]), "false,false"); + equal(check_plugin_state(PLUGINS[3]), "true,false"); + equal(check_plugin_state(PLUGINS[4]), "false,false"); + equal(check_plugin_state(PLUGINS[5]), "false,true"); +} + +function checkAddonState(addon, state) { + return checkAddon(addon.id, addon, state); +} + +add_task(async function setup() { + // Copy the initial blocklist into the profile to check add-ons start in the + // right state. + copyBlocklistToProfile(do_get_file("data/bug455906_start.xml")); + + createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8"); + await promiseStartupManager(); + + for (let addon of ADDONS) + await createAddon(addon); +}); + +add_task(async function test_1() { + // Tests the add-ons were installed and the initial blocklist applied as expected + + let addons = await AddonManager.getAddonsByIDs(ADDONS.map(a => a.id)); + for (var i = 0; i < ADDONS.length; i++) { + ok(addons[i], `Addon ${i + 1} should be installed correctly`); + } + + checkAddonState(addons[0], {userDisabled: false, softDisabled: false, appDisabled: false}); + checkAddonState(addons[1], {userDisabled: false, softDisabled: false, appDisabled: false}); + checkAddonState(addons[2], {userDisabled: false, softDisabled: false, appDisabled: false}); + + // Warn add-ons should be soft disabled automatically + checkAddonState(addons[3], {userDisabled: true, softDisabled: true, appDisabled: false}); + checkAddonState(addons[4], {userDisabled: true, softDisabled: true, appDisabled: false}); + + // Blocked and incompatible should be app disabled only + checkAddonState(addons[5], {userDisabled: false, softDisabled: false, appDisabled: true}); + checkAddonState(addons[6], {userDisabled: false, softDisabled: false, appDisabled: true}); + + // We've overridden the plugin host so we cannot tell what that would have + // initialised the plugins as + + // Put the add-ons into the base state + addons[0].userDisabled = true; + addons[4].userDisabled = false; + + await promiseRestartManager(); + await checkInitialState(); + + await loadBlocklist("bug455906_warn.xml", args => { + dump("Checking notification pt 2\n"); + equal(args.list.length, 4); + + for (let addon of args.list) { + if (addon.item instanceof Ci.nsIPluginTag) { + switch (addon.item.name) { + case "test_bug455906_2": + ok(!addon.blocked); + break; + case "test_bug455906_3": + ok(!addon.blocked); + addon.disable = true; + break; + default: + do_throw("Unknown addon: " + addon.item.name); + } + } else { + switch (addon.item.id) { + case "test_bug455906_2@tests.mozilla.org": + ok(!addon.blocked); + break; + case "test_bug455906_3@tests.mozilla.org": + ok(!addon.blocked); + addon.disable = true; + break; + default: + do_throw("Unknown addon: " + addon.item.id); + } + } + } + }); + + await promiseRestartManager(); + dump("Checking results pt 2\n"); + + addons = await AddonManager.getAddonsByIDs(ADDONS.map(a => a.id)); + + // Should have disabled this add-on as requested + checkAddonState(addons[2], {userDisabled: true, softDisabled: true, appDisabled: false}); + equal(check_plugin_state(PLUGINS[2]), "true,false"); + + // The blocked add-on should have changed to soft disabled + checkAddonState(addons[5], {userDisabled: true, softDisabled: true, appDisabled: false}); + checkAddonState(addons[6], {userDisabled: true, softDisabled: true, appDisabled: true}); + equal(check_plugin_state(PLUGINS[5]), "true,false"); + + // These should have been unchanged + checkAddonState(addons[0], {userDisabled: true, softDisabled: false, appDisabled: false}); + checkAddonState(addons[1], {userDisabled: false, softDisabled: false, appDisabled: false}); + checkAddonState(addons[3], {userDisabled: true, softDisabled: true, appDisabled: false}); + checkAddonState(addons[4], {userDisabled: false, softDisabled: false, appDisabled: false}); + equal(check_plugin_state(PLUGINS[0]), "true,false"); + equal(check_plugin_state(PLUGINS[1]), "false,false"); + equal(check_plugin_state(PLUGINS[3]), "true,false"); + equal(check_plugin_state(PLUGINS[4]), "false,false"); + + // Back to starting state + addons[2].userDisabled = false; + addons[5].userDisabled = false; + PLUGINS[2].enabledState = Ci.nsIPluginTag.STATE_ENABLED; + PLUGINS[5].enabledState = Ci.nsIPluginTag.STATE_ENABLED; + + await promiseRestartManager(); + await loadBlocklist("bug455906_start.xml"); +}); + +add_task(async function test_pt3() { + await promiseRestartManager(); + await checkInitialState(); + + await loadBlocklist("bug455906_block.xml", args => { + dump("Checking notification pt 3\n"); + equal(args.list.length, 3); + + for (let addon of args.list) { + if (addon.item instanceof Ci.nsIPluginTag) { + switch (addon.item.name) { + case "test_bug455906_2": + ok(addon.blocked); + break; + case "test_bug455906_3": + ok(addon.blocked); + break; + case "test_bug455906_5": + ok(addon.blocked); + break; + default: + do_throw("Unknown addon: " + addon.item.name); + } + } else { + switch (addon.item.id) { + case "test_bug455906_2@tests.mozilla.org": + ok(addon.blocked); + break; + case "test_bug455906_3@tests.mozilla.org": + ok(addon.blocked); + break; + case "test_bug455906_5@tests.mozilla.org": + ok(addon.blocked); + break; + default: + do_throw("Unknown addon: " + addon.item.id); + } + } + } + }); + + await promiseRestartManager(); + dump("Checking results pt 3\n"); + + let addons = await AddonManager.getAddonsByIDs(ADDONS.map(a => a.id)); + + // All should have gained the blocklist state, user disabled as previously + checkAddonState(addons[0], {userDisabled: true, softDisabled: false, appDisabled: true}); + checkAddonState(addons[1], {userDisabled: false, softDisabled: false, appDisabled: true}); + checkAddonState(addons[2], {userDisabled: false, softDisabled: false, appDisabled: true}); + checkAddonState(addons[4], {userDisabled: false, softDisabled: false, appDisabled: true}); + equal(check_plugin_state(PLUGINS[0]), "true,true"); + equal(check_plugin_state(PLUGINS[1]), "false,true"); + equal(check_plugin_state(PLUGINS[2]), "false,true"); + equal(check_plugin_state(PLUGINS[3]), "true,true"); + equal(check_plugin_state(PLUGINS[4]), "false,true"); + + // Should have gained the blocklist state but no longer be soft disabled + checkAddonState(addons[3], {userDisabled: false, softDisabled: false, appDisabled: true}); + + // Check blockIDs are correct + equal(Services.blocklist.getAddonBlocklistURL(addons[0]), create_blocklistURL(addons[0].id)); + equal(Services.blocklist.getAddonBlocklistURL(addons[1]), create_blocklistURL(addons[1].id)); + equal(Services.blocklist.getAddonBlocklistURL(addons[2]), create_blocklistURL(addons[2].id)); + equal(Services.blocklist.getAddonBlocklistURL(addons[3]), create_blocklistURL(addons[3].id)); + equal(Services.blocklist.getAddonBlocklistURL(addons[4]), create_blocklistURL(addons[4].id)); + + // All plugins have the same blockID on the test + equal(Services.blocklist.getPluginBlocklistURL(PLUGINS[0]), create_blocklistURL("test_bug455906_plugin")); + equal(Services.blocklist.getPluginBlocklistURL(PLUGINS[1]), create_blocklistURL("test_bug455906_plugin")); + equal(Services.blocklist.getPluginBlocklistURL(PLUGINS[2]), create_blocklistURL("test_bug455906_plugin")); + equal(Services.blocklist.getPluginBlocklistURL(PLUGINS[3]), create_blocklistURL("test_bug455906_plugin")); + equal(Services.blocklist.getPluginBlocklistURL(PLUGINS[4]), create_blocklistURL("test_bug455906_plugin")); + + // Shouldn't be changed + checkAddonState(addons[5], {userDisabled: false, softDisabled: false, appDisabled: true}); + checkAddonState(addons[6], {userDisabled: false, softDisabled: false, appDisabled: true}); + equal(check_plugin_state(PLUGINS[5]), "false,true"); + + // Back to starting state + await loadBlocklist("bug455906_start.xml"); +}); + +add_task(async function test_pt4() { + let addon = await AddonManager.getAddonByID(ADDONS[4].id); + addon.userDisabled = false; + PLUGINS[4].enabledState = Ci.nsIPluginTag.STATE_ENABLED; + + await promiseRestartManager(); + await checkInitialState(); + + await loadBlocklist("bug455906_empty.xml", args => { + dump("Checking notification pt 4\n"); + + // Should be just the dummy add-on to force this notification + equal(args.list.length, 1); + equal(false, args.list[0].item instanceof Ci.nsIPluginTag); + equal(args.list[0].item.id, "dummy_bug455906_2@tests.mozilla.org"); + }); + + await promiseRestartManager(); + dump("Checking results pt 4\n"); + + let addons = await AddonManager.getAddonsByIDs(ADDONS.map(a => a.id)); + // This should have become unblocked + checkAddonState(addons[5], {userDisabled: false, softDisabled: false, appDisabled: false}); + equal(check_plugin_state(PLUGINS[5]), "false,false"); + + // Should get re-enabled + checkAddonState(addons[3], {userDisabled: false, softDisabled: false, appDisabled: false}); + + // No change for anything else + checkAddonState(addons[0], {userDisabled: true, softDisabled: false, appDisabled: false}); + checkAddonState(addons[1], {userDisabled: false, softDisabled: false, appDisabled: false}); + checkAddonState(addons[2], {userDisabled: false, softDisabled: false, appDisabled: false}); + checkAddonState(addons[4], {userDisabled: false, softDisabled: false, appDisabled: false}); + checkAddonState(addons[6], {userDisabled: false, softDisabled: false, appDisabled: true}); + equal(check_plugin_state(PLUGINS[0]), "true,false"); + equal(check_plugin_state(PLUGINS[1]), "false,false"); + equal(check_plugin_state(PLUGINS[2]), "false,false"); + equal(check_plugin_state(PLUGINS[3]), "true,false"); + equal(check_plugin_state(PLUGINS[4]), "false,false"); +}); diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug455906.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug455906.js deleted file mode 100644 index e8d138a366bc..000000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug455906.js +++ /dev/null @@ -1,505 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -const URI_EXTENSION_BLOCKLIST_DIALOG = "chrome://mozapps/content/extensions/blocklist.xul"; - -ChromeUtils.import("resource://gre/modules/ExtensionUtils.jsm"); -ChromeUtils.import("resource://testing-common/MockRegistrar.jsm"); -var gTestserver = AddonTestUtils.createHttpServer({hosts: ["example.com"]}); - -const {promiseObserved} = ExtensionUtils; - -gTestserver.registerDirectory("/data/", do_get_file("data")); - -// Workaround for Bug 658720 - URL formatter can leak during xpcshell tests -const PREF_BLOCKLIST_ITEM_URL = "extensions.blocklist.itemURL"; -Services.prefs.setCharPref(PREF_BLOCKLIST_ITEM_URL, "http://example.com/blocklist/%blockID%"); - -var ADDONS = [{ - // Tests how the blocklist affects a disabled add-on - id: "test_bug455906_1@tests.mozilla.org", - name: "Bug 455906 Addon Test 1", - version: "5", - appVersion: "3" -}, { - // Tests how the blocklist affects an enabled add-on - id: "test_bug455906_2@tests.mozilla.org", - name: "Bug 455906 Addon Test 2", - version: "5", - appVersion: "3" -}, { - // Tests how the blocklist affects an enabled add-on, to be disabled by the notification - id: "test_bug455906_3@tests.mozilla.org", - name: "Bug 455906 Addon Test 3", - version: "5", - appVersion: "3" -}, { - // Tests how the blocklist affects a disabled add-on that was already warned about - id: "test_bug455906_4@tests.mozilla.org", - name: "Bug 455906 Addon Test 4", - version: "5", - appVersion: "3" -}, { - // Tests how the blocklist affects an enabled add-on that was already warned about - id: "test_bug455906_5@tests.mozilla.org", - name: "Bug 455906 Addon Test 5", - version: "5", - appVersion: "3" -}, { - // Tests how the blocklist affects an already blocked add-on - id: "test_bug455906_6@tests.mozilla.org", - name: "Bug 455906 Addon Test 6", - version: "5", - appVersion: "3" -}, { - // Tests how the blocklist affects an incompatible add-on - id: "test_bug455906_7@tests.mozilla.org", - name: "Bug 455906 Addon Test 7", - version: "5", - appVersion: "2" -}, { - // Spare add-on used to ensure we get a notification when switching lists - id: "dummy_bug455906_1@tests.mozilla.org", - name: "Dummy Addon 1", - version: "5", - appVersion: "3" -}, { - // Spare add-on used to ensure we get a notification when switching lists - id: "dummy_bug455906_2@tests.mozilla.org", - name: "Dummy Addon 2", - version: "5", - appVersion: "3" -}]; - -function MockPlugin(name, version, enabledState) { - this.name = name; - this.version = version; - this.enabledState = enabledState; -} -Object.defineProperty(MockPlugin.prototype, "blocklisted", { - get: function MockPlugin_getBlocklisted() { - return Services.blocklist.getPluginBlocklistState(this) == Services.blocklist.STATE_BLOCKED; - } -}); -Object.defineProperty(MockPlugin.prototype, "disabled", { - get: function MockPlugin_getDisabled() { - return this.enabledState == Ci.nsIPluginTag.STATE_DISABLED; - } -}); - -var PLUGINS = [ - // Tests how the blocklist affects a disabled plugin - new MockPlugin("test_bug455906_1", "5", Ci.nsIPluginTag.STATE_DISABLED), - // Tests how the blocklist affects an enabled plugin - new MockPlugin("test_bug455906_2", "5", Ci.nsIPluginTag.STATE_ENABLED), - // Tests how the blocklist affects an enabled plugin, to be disabled by the notification - new MockPlugin("test_bug455906_3", "5", Ci.nsIPluginTag.STATE_ENABLED), - // Tests how the blocklist affects a disabled plugin that was already warned about - new MockPlugin("test_bug455906_4", "5", Ci.nsIPluginTag.STATE_DISABLED), - // Tests how the blocklist affects an enabled plugin that was already warned about - new MockPlugin("test_bug455906_5", "5", Ci.nsIPluginTag.STATE_ENABLED), - // Tests how the blocklist affects an already blocked plugin - new MockPlugin("test_bug455906_6", "5", Ci.nsIPluginTag.STATE_ENABLED) -]; - -var gNotificationCheck = null; -var gTestCheck = null; - -// A fake plugin host for the blocklist service to use -var PluginHost = { - getPluginTags(countRef) { - countRef.value = PLUGINS.length; - return PLUGINS; - }, - - QueryInterface(iid) { - if (iid.equals(Ci.nsIPluginHost) - || iid.equals(Ci.nsISupports)) - return this; - - throw Cr.NS_ERROR_NO_INTERFACE; - } -}; - -// Don't need the full interface, attempts to call other methods will just -// throw which is just fine -var WindowWatcher = { - openWindow(parent, url, name, features, windowArguments) { - // Should be called to list the newly blocklisted items - Assert.equal(url, URI_EXTENSION_BLOCKLIST_DIALOG); - - if (gNotificationCheck) { - var args = windowArguments.wrappedJSObject; - gNotificationCheck(args); - } - - // run the code after the blocklist is closed - Services.obs.notifyObservers(null, "addon-blocklist-closed"); - - // Call the next test after the blocklist has finished up - do_timeout(0, gTestCheck); - }, - - QueryInterface(iid) { - if (iid.equals(Ci.nsIWindowWatcher) - || iid.equals(Ci.nsISupports)) - return this; - - throw Cr.NS_ERROR_NO_INTERFACE; - } -}; - -MockRegistrar.register("@mozilla.org/plugin/host;1", PluginHost); -MockRegistrar.register("@mozilla.org/embedcomp/window-watcher;1", WindowWatcher); - -function create_addon(addon) { - var installrdf = "\n" + - "\n" + - "\n" + - " \n" + - " " + addon.id + "\n" + - " " + addon.version + "\n" + - " true\n" + - " \n" + - " \n" + - " xpcshell@tests.mozilla.org\n" + - " " + addon.appVersion + "\n" + - " " + addon.appVersion + "\n" + - " \n" + - " \n" + - " " + addon.name + "\n" + - " \n" + - "\n"; - var target = gProfD.clone(); - target.append("extensions"); - target.append(addon.id); - target.append("install.rdf"); - target.create(target.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE); - var stream = Cc["@mozilla.org/network/file-output-stream;1"]. - createInstance(Ci.nsIFileOutputStream); - stream.init(target, - FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE | FileUtils.MODE_TRUNCATE, - FileUtils.PERMS_FILE, 0); - stream.write(installrdf, installrdf.length); - stream.close(); -} - -function load_blocklist(file) { - Services.prefs.setCharPref("extensions.blocklist.url", "http://example.com/data/" + file); - var blocklist = Cc["@mozilla.org/extensions/blocklist;1"]. - getService(Ci.nsITimerCallback); - blocklist.notify(null); -} - -function check_addon_state(addon) { - return addon.userDisabled + "," + addon.softDisabled + "," + addon.appDisabled; -} - -function check_plugin_state(plugin) { - return plugin.disabled + "," + plugin.blocklisted; -} - -function create_blocklistURL(blockID) { - let url = Services.urlFormatter.formatURLPref(PREF_BLOCKLIST_ITEM_URL); - url = url.replace(/%blockID%/g, blockID); - return url; -} - -// Performs the initial setup -function run_test() { - // Setup for test - dump("Setting up tests\n"); - // Rather than keeping lots of identical add-ons in version control, just - // write them into the profile. - for (let addon of ADDONS) - create_addon(addon); - - // Copy the initial blocklist into the profile to check add-ons start in the - // right state. - copyBlocklistToProfile(do_get_file("data/bug455906_start.xml")); - - createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8"); - startupManager(); - - do_test_pending(); - check_test_pt1(); -} - -// Before every main test this is the state the add-ons are meant to be in -function check_initial_state(callback) { - AddonManager.getAddonsByIDs(ADDONS.map(a => a.id), function(addons) { - Assert.equal(check_addon_state(addons[0]), "true,false,false"); - Assert.equal(check_addon_state(addons[1]), "false,false,false"); - Assert.equal(check_addon_state(addons[2]), "false,false,false"); - Assert.equal(check_addon_state(addons[3]), "true,true,false"); - Assert.equal(check_addon_state(addons[4]), "false,false,false"); - Assert.equal(check_addon_state(addons[5]), "false,false,true"); - Assert.equal(check_addon_state(addons[6]), "false,false,true"); - - Assert.equal(check_plugin_state(PLUGINS[0]), "true,false"); - Assert.equal(check_plugin_state(PLUGINS[1]), "false,false"); - Assert.equal(check_plugin_state(PLUGINS[2]), "false,false"); - Assert.equal(check_plugin_state(PLUGINS[3]), "true,false"); - Assert.equal(check_plugin_state(PLUGINS[4]), "false,false"); - Assert.equal(check_plugin_state(PLUGINS[5]), "false,true"); - - callback(); - }); -} - -// Tests the add-ons were installed and the initial blocklist applied as expected -function check_test_pt1() { - dump("Checking pt 1\n"); - - AddonManager.getAddonsByIDs(ADDONS.map(a => a.id), callback_soon(function(addons) { - for (var i = 0; i < ADDONS.length; i++) { - if (!addons[i]) - do_throw("Addon " + (i + 1) + " did not get installed correctly"); - } - - Assert.equal(check_addon_state(addons[0]), "false,false,false"); - Assert.equal(check_addon_state(addons[1]), "false,false,false"); - Assert.equal(check_addon_state(addons[2]), "false,false,false"); - - // Warn add-ons should be soft disabled automatically - Assert.equal(check_addon_state(addons[3]), "true,true,false"); - Assert.equal(check_addon_state(addons[4]), "true,true,false"); - - // Blocked and incompatible should be app disabled only - Assert.equal(check_addon_state(addons[5]), "false,false,true"); - Assert.equal(check_addon_state(addons[6]), "false,false,true"); - - // We've overridden the plugin host so we cannot tell what that would have - // initialised the plugins as - - // Put the add-ons into the base state - addons[0].userDisabled = true; - addons[4].userDisabled = false; - - restartManager(); - check_initial_state(function() { - gNotificationCheck = check_notification_pt2; - gTestCheck = check_test_pt2; - load_blocklist("bug455906_warn.xml"); - }); - })); -} - -function check_notification_pt2(args) { - dump("Checking notification pt 2\n"); - Assert.equal(args.list.length, 4); - - for (let addon of args.list) { - if (addon.item instanceof Ci.nsIPluginTag) { - switch (addon.item.name) { - case "test_bug455906_2": - Assert.ok(!addon.blocked); - break; - case "test_bug455906_3": - Assert.ok(!addon.blocked); - addon.disable = true; - break; - default: - do_throw("Unknown addon: " + addon.item.name); - } - } else { - switch (addon.item.id) { - case "test_bug455906_2@tests.mozilla.org": - Assert.ok(!addon.blocked); - break; - case "test_bug455906_3@tests.mozilla.org": - Assert.ok(!addon.blocked); - addon.disable = true; - break; - default: - do_throw("Unknown addon: " + addon.item.id); - } - } - } -} - -function check_test_pt2() { - restartManager(); - dump("Checking results pt 2\n"); - - AddonManager.getAddonsByIDs(ADDONS.map(a => a.id), callback_soon(function(addons) { - // Should have disabled this add-on as requested - Assert.equal(check_addon_state(addons[2]), "true,true,false"); - Assert.equal(check_plugin_state(PLUGINS[2]), "true,false"); - - // The blocked add-on should have changed to soft disabled - Assert.equal(check_addon_state(addons[5]), "true,true,false"); - Assert.equal(check_addon_state(addons[6]), "true,true,true"); - Assert.equal(check_plugin_state(PLUGINS[5]), "true,false"); - - // These should have been unchanged - Assert.equal(check_addon_state(addons[0]), "true,false,false"); - Assert.equal(check_addon_state(addons[1]), "false,false,false"); - Assert.equal(check_addon_state(addons[3]), "true,true,false"); - Assert.equal(check_addon_state(addons[4]), "false,false,false"); - Assert.equal(check_plugin_state(PLUGINS[0]), "true,false"); - Assert.equal(check_plugin_state(PLUGINS[1]), "false,false"); - Assert.equal(check_plugin_state(PLUGINS[3]), "true,false"); - Assert.equal(check_plugin_state(PLUGINS[4]), "false,false"); - - // Back to starting state - addons[2].userDisabled = false; - addons[5].userDisabled = false; - PLUGINS[2].enabledState = Ci.nsIPluginTag.STATE_ENABLED; - PLUGINS[5].enabledState = Ci.nsIPluginTag.STATE_ENABLED; - restartManager(); - gNotificationCheck = null; - gTestCheck = run_test_pt3; - load_blocklist("bug455906_start.xml"); - })); -} - -function run_test_pt3() { - restartManager(); - check_initial_state(function() { - gNotificationCheck = check_notification_pt3; - gTestCheck = check_test_pt3; - load_blocklist("bug455906_block.xml"); - }); -} - -function check_notification_pt3(args) { - dump("Checking notification pt 3\n"); - Assert.equal(args.list.length, 3); - - for (let addon of args.list) { - if (addon.item instanceof Ci.nsIPluginTag) { - switch (addon.item.name) { - case "test_bug455906_2": - Assert.ok(addon.blocked); - break; - case "test_bug455906_3": - Assert.ok(addon.blocked); - break; - case "test_bug455906_5": - Assert.ok(addon.blocked); - break; - default: - do_throw("Unknown addon: " + addon.item.name); - } - } else { - switch (addon.item.id) { - case "test_bug455906_2@tests.mozilla.org": - Assert.ok(addon.blocked); - break; - case "test_bug455906_3@tests.mozilla.org": - Assert.ok(addon.blocked); - break; - case "test_bug455906_5@tests.mozilla.org": - Assert.ok(addon.blocked); - break; - default: - do_throw("Unknown addon: " + addon.item.id); - } - } - } -} - -function check_test_pt3() { - restartManager(); - dump("Checking results pt 3\n"); - - AddonManager.getAddonsByIDs(ADDONS.map(a => a.id), function(addons) { - // All should have gained the blocklist state, user disabled as previously - Assert.equal(check_addon_state(addons[0]), "true,false,true"); - Assert.equal(check_addon_state(addons[1]), "false,false,true"); - Assert.equal(check_addon_state(addons[2]), "false,false,true"); - Assert.equal(check_addon_state(addons[4]), "false,false,true"); - Assert.equal(check_plugin_state(PLUGINS[0]), "true,true"); - Assert.equal(check_plugin_state(PLUGINS[1]), "false,true"); - Assert.equal(check_plugin_state(PLUGINS[2]), "false,true"); - Assert.equal(check_plugin_state(PLUGINS[3]), "true,true"); - Assert.equal(check_plugin_state(PLUGINS[4]), "false,true"); - - // Should have gained the blocklist state but no longer be soft disabled - Assert.equal(check_addon_state(addons[3]), "false,false,true"); - - // Check blockIDs are correct - Assert.equal(Services.blocklist.getAddonBlocklistURL(addons[0]), create_blocklistURL(addons[0].id)); - Assert.equal(Services.blocklist.getAddonBlocklistURL(addons[1]), create_blocklistURL(addons[1].id)); - Assert.equal(Services.blocklist.getAddonBlocklistURL(addons[2]), create_blocklistURL(addons[2].id)); - Assert.equal(Services.blocklist.getAddonBlocklistURL(addons[3]), create_blocklistURL(addons[3].id)); - Assert.equal(Services.blocklist.getAddonBlocklistURL(addons[4]), create_blocklistURL(addons[4].id)); - - // All plugins have the same blockID on the test - Assert.equal(Services.blocklist.getPluginBlocklistURL(PLUGINS[0]), create_blocklistURL("test_bug455906_plugin")); - Assert.equal(Services.blocklist.getPluginBlocklistURL(PLUGINS[1]), create_blocklistURL("test_bug455906_plugin")); - Assert.equal(Services.blocklist.getPluginBlocklistURL(PLUGINS[2]), create_blocklistURL("test_bug455906_plugin")); - Assert.equal(Services.blocklist.getPluginBlocklistURL(PLUGINS[3]), create_blocklistURL("test_bug455906_plugin")); - Assert.equal(Services.blocklist.getPluginBlocklistURL(PLUGINS[4]), create_blocklistURL("test_bug455906_plugin")); - - // Shouldn't be changed - Assert.equal(check_addon_state(addons[5]), "false,false,true"); - Assert.equal(check_addon_state(addons[6]), "false,false,true"); - Assert.equal(check_plugin_state(PLUGINS[5]), "false,true"); - - // Back to starting state - gNotificationCheck = null; - gTestCheck = null; - promiseObserved("blocklist-updated").then(run_test_pt4); - load_blocklist("bug455906_start.xml"); - }); -} - -function run_test_pt4() { - AddonManager.getAddonByID(ADDONS[4].id, callback_soon(function(addon) { - addon.userDisabled = false; - PLUGINS[4].enabledState = Ci.nsIPluginTag.STATE_ENABLED; - restartManager(); - check_initial_state(function() { - gNotificationCheck = check_notification_pt4; - gTestCheck = check_test_pt4; - promiseObserved("blocklist-updated").then(check_test_pt4); - load_blocklist("bug455906_empty.xml"); - }); - })); -} - -function check_notification_pt4(args) { - dump("Checking notification pt 4\n"); - - // Should be just the dummy add-on to force this notification - Assert.equal(args.list.length, 1); - Assert.equal(false, args.list[0].item instanceof Ci.nsIPluginTag); - Assert.equal(args.list[0].item.id, "dummy_bug455906_2@tests.mozilla.org"); -} - -function check_test_pt4() { - restartManager(); - dump("Checking results pt 4\n"); - - AddonManager.getAddonsByIDs(ADDONS.map(a => a.id), function(addons) { - // This should have become unblocked - Assert.equal(check_addon_state(addons[5]), "false,false,false"); - Assert.equal(check_plugin_state(PLUGINS[5]), "false,false"); - - // Should get re-enabled - Assert.equal(check_addon_state(addons[3]), "false,false,false"); - - // No change for anything else - Assert.equal(check_addon_state(addons[0]), "true,false,false"); - Assert.equal(check_addon_state(addons[1]), "false,false,false"); - Assert.equal(check_addon_state(addons[2]), "false,false,false"); - Assert.equal(check_addon_state(addons[4]), "false,false,false"); - Assert.equal(check_addon_state(addons[6]), "false,false,true"); - Assert.equal(check_plugin_state(PLUGINS[0]), "true,false"); - Assert.equal(check_plugin_state(PLUGINS[1]), "false,false"); - Assert.equal(check_plugin_state(PLUGINS[2]), "false,false"); - Assert.equal(check_plugin_state(PLUGINS[3]), "true,false"); - Assert.equal(check_plugin_state(PLUGINS[4]), "false,false"); - - finish(); - }); -} - -function finish() { - do_test_finished(); -} diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index 21144572ec4f..4c2bc4b32a8b 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -41,6 +41,10 @@ tags = blocklist [test_blocklist_regexp.js] skip-if = os == "android" tags = blocklist +[test_blocklist_severities.js] +# Bug 676992: test consistently hangs on Android +skip-if = os == "android" +tags = blocklist [test_blocklist_url_parameters.js] # Bug 676992: test consistently hangs on Android skip-if = os == "android" @@ -55,10 +59,6 @@ skip-if = true # Bug 1358846 Bug 1365021 Bug 676992 [test_bootstrap_globals.js] [test_bug1180901_2.js] skip-if = os != "win" -[test_bug455906.js] -# Bug 676992: test consistently hangs on Android -skip-if = os == "android" -tags = blocklist [test_bug465190.js] # Bug 676992: test consistently hangs on Android skip-if = os == "android" From 1df8b437800f04b0fbd701482408eb5ba7a7bdf2 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 15:20:14 -0700 Subject: [PATCH 57/88] Bug 1449255: Part 9 - Remove test_bug465190.js. r=aswan MozReview-Commit-ID: K8J7ytv20jN --HG-- extra : rebase_source : 1eb8efdc1256cbf9d9b5b58017bf19737f9d2bcb --- .../test/xpcshell/test_bug465190.js | 38 ------------------- .../extensions/test/xpcshell/xpcshell.ini | 3 -- 2 files changed, 41 deletions(-) delete mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_bug465190.js diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug465190.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug465190.js deleted file mode 100644 index d03da9899b6d..000000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug465190.js +++ /dev/null @@ -1,38 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -var installLocation = gProfD.clone(); -installLocation.append("baddir"); -installLocation.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0o664); - -var dirProvider2 = { - getFile(prop, persistent) { - persistent.value = true; - if (prop == "XREUSysExt") - return installLocation.clone(); - return null; - }, - QueryInterface(iid) { - if (iid.equals(Ci.nsIDirectoryServiceProvider) || - iid.equals(Ci.nsISupports)) { - return this; - } - throw Cr.NS_ERROR_NO_INTERFACE; - } -}; -Services.dirsvc.QueryInterface(Ci.nsIDirectoryService) - .registerProvider(dirProvider2); - -function run_test() { - var log = gProfD.clone(); - log.append("extensions.log"); - Assert.ok(!log.exists()); - - // Setup for test - createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1"); - - startupManager(); - Assert.ok(!log.exists()); -} diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index 4c2bc4b32a8b..7012e14c8f53 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -59,9 +59,6 @@ skip-if = true # Bug 1358846 Bug 1365021 Bug 676992 [test_bootstrap_globals.js] [test_bug1180901_2.js] skip-if = os != "win" -[test_bug465190.js] -# Bug 676992: test consistently hangs on Android -skip-if = os == "android" [test_bug468528.js] # Bug 676992: test consistently hangs on Android skip-if = os == "android" From 7a9b857beea1467f51993aaa29cc9ea0743124dd Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 15:23:10 -0700 Subject: [PATCH 58/88] Bug 1449255: Part 10 - Rename test_bug468528 to test_blocklist_plugin_regexp.js. r=aswan MozReview-Commit-ID: HVXg5ljc52z --HG-- rename : toolkit/mozapps/extensions/test/xpcshell/test_bug468528.js => toolkit/mozapps/extensions/test/xpcshell/test_blocklist_plugin_regexp.js extra : rebase_source : a4dc3cfab6944e632d2565335907127ed19bdcac --- ...bug468528.js => test_blocklist_plugin_regexp.js} | 13 +++++-------- .../mozapps/extensions/test/xpcshell/xpcshell.ini | 8 ++++---- 2 files changed, 9 insertions(+), 12 deletions(-) rename toolkit/mozapps/extensions/test/xpcshell/{test_bug468528.js => test_blocklist_plugin_regexp.js} (84%) diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug468528.js b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_plugin_regexp.js similarity index 84% rename from toolkit/mozapps/extensions/test/xpcshell/test_bug468528.js rename to toolkit/mozapps/extensions/test/xpcshell/test_blocklist_plugin_regexp.js index a09ee65eff6c..10a198de16d5 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug468528.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_plugin_regexp.js @@ -2,8 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -const nsIBLS = Ci.nsIBlocklistService; - var PLUGINS = [{ // Normal blacklisted plugin, before an invalid regexp name: "test_bug468528_1", @@ -40,19 +38,18 @@ function run_test() { // We cannot force the blocklist to update so just copy our test list to the profile copyBlocklistToProfile(do_get_file("data/test_bug468528.xml")); - var blocklist = Cc["@mozilla.org/extensions/blocklist;1"] - .getService(nsIBLS); + var {blocklist} = Services; // blocked (sanity check) - Assert.ok(blocklist.getPluginBlocklistState(PLUGINS[0], "1", "1.9") == nsIBLS.STATE_BLOCKED); + Assert.ok(blocklist.getPluginBlocklistState(PLUGINS[0], "1", "1.9") == blocklist.STATE_BLOCKED); // not blocked - won't match due to invalid regexp - Assert.ok(blocklist.getPluginBlocklistState(PLUGINS[1], "1", "1.9") == nsIBLS.STATE_NOT_BLOCKED); + Assert.ok(blocklist.getPluginBlocklistState(PLUGINS[1], "1", "1.9") == blocklist.STATE_NOT_BLOCKED); // blocked - the invalid regexp for the previous item shouldn't affect this one - Assert.ok(blocklist.getPluginBlocklistState(PLUGINS[2], "1", "1.9") == nsIBLS.STATE_BLOCKED); + Assert.ok(blocklist.getPluginBlocklistState(PLUGINS[2], "1", "1.9") == blocklist.STATE_BLOCKED); // not blocked - the previous invalid regexp shouldn't act as a wildcard - Assert.ok(blocklist.getPluginBlocklistState(PLUGINS[3], "1", "1.9") == nsIBLS.STATE_NOT_BLOCKED); + Assert.ok(blocklist.getPluginBlocklistState(PLUGINS[3], "1", "1.9") == blocklist.STATE_NOT_BLOCKED); } diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index 7012e14c8f53..a6ec86f43e2f 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -36,6 +36,10 @@ tags = blocklist # Bug 676992: test consistently hangs on Android skip-if = os == "android" tags = blocklist +[test_blocklist_plugin_regexp.js] +# Bug 676992: test consistently hangs on Android +skip-if = os == "android" +tags = blocklist [test_blocklist_prefs.js] tags = blocklist [test_blocklist_regexp.js] @@ -59,10 +63,6 @@ skip-if = true # Bug 1358846 Bug 1365021 Bug 676992 [test_bootstrap_globals.js] [test_bug1180901_2.js] skip-if = os != "win" -[test_bug468528.js] -# Bug 676992: test consistently hangs on Android -skip-if = os == "android" -tags = blocklist [test_bug514327_1.js] # Bug 676992: test consistently hangs on Android skip-if = os == "android" From c2d00beed7910e8c22b7c2acc1b01a7c811a0a5e Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 15:25:53 -0700 Subject: [PATCH 59/88] Bug 1449255: Part 11a - Rename test_bug514327_1 to test_blocklist_plugin_severities.js. r=aswan MozReview-Commit-ID: Aor9QhJiBzE --HG-- rename : toolkit/mozapps/extensions/test/xpcshell/test_bug514327_1.js => toolkit/mozapps/extensions/test/xpcshell/test_blocklist_plugin_severities.js extra : rebase_source : 77b64fafbc864161b34d5250e108c5130483d0d4 --- ...4327_1.js => test_blocklist_plugin_severities.js} | 12 +++++------- .../mozapps/extensions/test/xpcshell/xpcshell.ini | 8 ++++---- 2 files changed, 9 insertions(+), 11 deletions(-) rename toolkit/mozapps/extensions/test/xpcshell/{test_bug514327_1.js => test_blocklist_plugin_severities.js} (82%) diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug514327_1.js b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_plugin_severities.js similarity index 82% rename from toolkit/mozapps/extensions/test/xpcshell/test_bug514327_1.js rename to toolkit/mozapps/extensions/test/xpcshell/test_blocklist_plugin_severities.js index 2d2fbd43d149..4f5208ab2ede 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug514327_1.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_plugin_severities.js @@ -2,8 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -const nsIBLS = Ci.nsIBlocklistService; - var PLUGINS = [{ // blocklisted - default severity name: "test_bug514327_1", @@ -40,17 +38,17 @@ function run_test() { copyBlocklistToProfile(do_get_file("data/test_bug514327_1.xml")); - var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].getService(nsIBLS); + var {blocklist} = Services; // blocked (sanity check) - Assert.ok(blocklist.getPluginBlocklistState(PLUGINS[0], "1", "1.9") == nsIBLS.STATE_BLOCKED); + Assert.ok(blocklist.getPluginBlocklistState(PLUGINS[0], "1", "1.9") == blocklist.STATE_BLOCKED); // outdated - Assert.ok(blocklist.getPluginBlocklistState(PLUGINS[1], "1", "1.9") == nsIBLS.STATE_OUTDATED); + Assert.ok(blocklist.getPluginBlocklistState(PLUGINS[1], "1", "1.9") == blocklist.STATE_OUTDATED); // outdated - Assert.ok(blocklist.getPluginBlocklistState(PLUGINS[2], "1", "1.9") == nsIBLS.STATE_OUTDATED); + Assert.ok(blocklist.getPluginBlocklistState(PLUGINS[2], "1", "1.9") == blocklist.STATE_OUTDATED); // not blocked - Assert.ok(blocklist.getPluginBlocklistState(PLUGINS[3], "1", "1.9") == nsIBLS.STATE_NOT_BLOCKED); + Assert.ok(blocklist.getPluginBlocklistState(PLUGINS[3], "1", "1.9") == blocklist.STATE_NOT_BLOCKED); } diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index a6ec86f43e2f..43205cc864d8 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -40,6 +40,10 @@ tags = blocklist # Bug 676992: test consistently hangs on Android skip-if = os == "android" tags = blocklist +[test_blocklist_plugin_severities.js] +# Bug 676992: test consistently hangs on Android +skip-if = os == "android" +tags = blocklist [test_blocklist_prefs.js] tags = blocklist [test_blocklist_regexp.js] @@ -63,10 +67,6 @@ skip-if = true # Bug 1358846 Bug 1365021 Bug 676992 [test_bootstrap_globals.js] [test_bug1180901_2.js] skip-if = os != "win" -[test_bug514327_1.js] -# Bug 676992: test consistently hangs on Android -skip-if = os == "android" -tags = blocklist [test_bug514327_2.js] # Bug 676992: test consistently hangs on Android skip-if = os == "android" From 841b2c998fa632c539e248c396d0195227abd380 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 15:26:39 -0700 Subject: [PATCH 60/88] Bug 1449255: Part 11b - Rename test_bug514327_2 to test_blocklist_plugin_flashonly.js. r=aswan MozReview-Commit-ID: 6pUxBdnzftW --HG-- rename : toolkit/mozapps/extensions/test/xpcshell/test_bug514327_2.js => toolkit/mozapps/extensions/test/xpcshell/test_blocklist_plugin_flashonly.js extra : rebase_source : f62db4ad6261523295f5c568c81815e35a108fdf --- ..._bug514327_2.js => test_blocklist_plugin_flashonly.js} | 0 toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini | 8 ++++---- 2 files changed, 4 insertions(+), 4 deletions(-) rename toolkit/mozapps/extensions/test/xpcshell/{test_bug514327_2.js => test_blocklist_plugin_flashonly.js} (100%) diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug514327_2.js b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_plugin_flashonly.js similarity index 100% rename from toolkit/mozapps/extensions/test/xpcshell/test_bug514327_2.js rename to toolkit/mozapps/extensions/test/xpcshell/test_blocklist_plugin_flashonly.js diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index 43205cc864d8..262cb2969bb9 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -36,6 +36,10 @@ tags = blocklist # Bug 676992: test consistently hangs on Android skip-if = os == "android" tags = blocklist +[test_blocklist_plugin_flashonly.js] +# Bug 676992: test consistently hangs on Android +skip-if = os == "android" +tags = blocklist [test_blocklist_plugin_regexp.js] # Bug 676992: test consistently hangs on Android skip-if = os == "android" @@ -67,10 +71,6 @@ skip-if = true # Bug 1358846 Bug 1365021 Bug 676992 [test_bootstrap_globals.js] [test_bug1180901_2.js] skip-if = os != "win" -[test_bug514327_2.js] -# Bug 676992: test consistently hangs on Android -skip-if = os == "android" -tags = blocklist [test_bug514327_3.js] # Bug 676992: test consistently hangs on Android skip-if = os == "android" From ea39f412776fd813fffed7ebf1c5596c07f61137 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 15:44:49 -0700 Subject: [PATCH 61/88] Bug 1449255: Part 11c - Rename test_bug514327_3 to test_blocklist_plugin_outdated.js. r=aswan MozReview-Commit-ID: 8mHmOWbgDC3 --HG-- rename : toolkit/mozapps/extensions/test/xpcshell/test_bug514327_3.js => toolkit/mozapps/extensions/test/xpcshell/test_blocklist_plugin_outdated.js extra : rebase_source : 5875aa7d791690981ffc82ce2c197d62c29c6175 --- ...3.js => test_blocklist_plugin_outdated.js} | 96 +++++++------------ .../extensions/test/xpcshell/xpcshell.ini | 8 +- 2 files changed, 40 insertions(+), 64 deletions(-) rename toolkit/mozapps/extensions/test/xpcshell/{test_bug514327_3.js => test_blocklist_plugin_outdated.js} (53%) diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug514327_3.js b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_plugin_outdated.js similarity index 53% rename from toolkit/mozapps/extensions/test/xpcshell/test_bug514327_3.js rename to toolkit/mozapps/extensions/test/xpcshell/test_blocklist_plugin_outdated.js index 8b1ae2537509..3c68c3eab778 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug514327_3.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_plugin_outdated.js @@ -2,16 +2,16 @@ * 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/. */ +const Cm = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); + ChromeUtils.import("resource://testing-common/httpd.js"); ChromeUtils.import("resource://testing-common/MockRegistrar.jsm"); const nsIBLS = Ci.nsIBlocklistService; -const URI_EXTENSION_BLOCKLIST_DIALOG = "chrome://mozapps/content/extensions/blocklist.xul"; var gBlocklist = null; -var gTestserver = null; - -var gNextTestPart = null; +var gTestserver = AddonTestUtils.createHttpServer({hosts: ["example.com"]}); +gTestserver.registerDirectory("/data/", do_get_file("data")); var PLUGINS = [{ @@ -42,91 +42,67 @@ var PluginHost = { return PLUGINS; }, - QueryInterface(iid) { - if (iid.equals(Ci.nsIPluginHost) - || iid.equals(Ci.nsISupports)) - return this; - - throw Cr.NS_ERROR_NO_INTERFACE; - } + QueryInterface: XPCOMUtils.generateQI(["nsIPluginHost"]), }; -// Don't need the full interface, attempts to call other methods will just -// throw which is just fine -var WindowWatcher = { - openWindow(parent, url, name, features, args) { - // Should be called to list the newly blocklisted items - Assert.equal(url, URI_EXTENSION_BLOCKLIST_DIALOG); +var BlocklistPrompt = { + prompt(list) { // Should only include one item - Assert.equal(args.wrappedJSObject.list.length, 1); + Assert.equal(list.length, 1); // And that item should be the blocked plugin, not the outdated one - var item = args.wrappedJSObject.list[0]; + var item = list[0]; Assert.ok(item.item instanceof Ci.nsIPluginTag); Assert.notEqual(item.name, "test_bug514327_outdated"); - - // Call the next test after the blocklist has finished up - do_timeout(0, gNextTestPart); }, - QueryInterface(iid) { - if (iid.equals(Ci.nsIWindowWatcher) - || iid.equals(Ci.nsISupports)) - return this; - - throw Cr.NS_ERROR_NO_INTERFACE; - } + QueryInterface: XPCOMUtils.generateQI(["nsIBlocklistPrompt"]), }; -MockRegistrar.register("@mozilla.org/plugin/host;1", PluginHost); -MockRegistrar.register("@mozilla.org/embedcomp/window-watcher;1", WindowWatcher); +async function loadBlocklist(file) { + let blocklistUpdated = TestUtils.topicObserved("blocklist-updated"); -function do_update_blocklist(aDatafile, aNextPart) { - gNextTestPart = aNextPart; + Services.prefs.setCharPref("extensions.blocklist.url", + "http://example.com/data/" + file); + Services.blocklist.QueryInterface(Ci.nsITimerCallback).notify(null); - Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:" + gPort + "/data/" + aDatafile); - gBlocklist.QueryInterface(Ci.nsITimerCallback).notify(null); + await blocklistUpdated; } -function run_test() { +MockRegistrar.register("@mozilla.org/plugin/host;1", PluginHost); + +let factory = XPCOMUtils.generateSingletonFactory(function() { return BlocklistPrompt; }); +Cm.registerFactory(Components.ID("{26d32654-30c7-485d-b983-b4d2568aebba}"), + "Blocklist Prompt", + "@mozilla.org/addons/blocklist-prompt;1", factory); + +add_task(async function setup() { createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9"); - gTestserver = new HttpServer(); - gTestserver.registerDirectory("/data/", do_get_file("data")); - gTestserver.start(-1); - gPort = gTestserver.identity.primaryPort; - - startupManager(); - // initialize the blocklist with no entries copyBlocklistToProfile(do_get_file("data/test_bug514327_3_empty.xml")); - gBlocklist = Cc["@mozilla.org/extensions/blocklist;1"].getService(nsIBLS); + await promiseStartupManager(); + + gBlocklist = Services.blocklist; // should NOT be marked as outdated by the blocklist Assert.ok(gBlocklist.getPluginBlocklistState(PLUGINS[0], "1", "1.9") == nsIBLS.STATE_NOT_BLOCKED); +}); - do_test_pending(); - +add_task(async function test_part_1() { // update blocklist with data that marks the plugin as outdated - do_update_blocklist("test_bug514327_3_outdated_1.xml", test_part_1); -} + await loadBlocklist("test_bug514327_3_outdated_1.xml"); -function test_part_1() { // plugin should now be marked as outdated Assert.ok(gBlocklist.getPluginBlocklistState(PLUGINS[0], "1", "1.9") == nsIBLS.STATE_OUTDATED); - // update blocklist with data that marks the plugin as outdated - do_update_blocklist("test_bug514327_3_outdated_2.xml", test_part_2); -} +}); + +add_task(async function test_part_2() { + // update blocklist with data that marks the plugin as outdated + await loadBlocklist("test_bug514327_3_outdated_2.xml"); -function test_part_2() { // plugin should still be marked as outdated Assert.ok(gBlocklist.getPluginBlocklistState(PLUGINS[0], "1", "1.9") == nsIBLS.STATE_OUTDATED); - - finish(); -} - -function finish() { - gTestserver.stop(do_test_finished); -} +}); diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index 262cb2969bb9..16d4e56bc4e5 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -40,6 +40,10 @@ tags = blocklist # Bug 676992: test consistently hangs on Android skip-if = os == "android" tags = blocklist +[test_blocklist_plugin_outdated.js] +# Bug 676992: test consistently hangs on Android +skip-if = os == "android" +tags = blocklist [test_blocklist_plugin_regexp.js] # Bug 676992: test consistently hangs on Android skip-if = os == "android" @@ -71,10 +75,6 @@ skip-if = true # Bug 1358846 Bug 1365021 Bug 676992 [test_bootstrap_globals.js] [test_bug1180901_2.js] skip-if = os != "win" -[test_bug514327_3.js] -# Bug 676992: test consistently hangs on Android -skip-if = os == "android" -tags = blocklist [test_bug566626.js] [test_bug567184.js] [test_bug569138.js] From 1f796f0f36a176fb437881de528bf21649b9ee54 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 15:46:16 -0700 Subject: [PATCH 62/88] Bug 1449255: Part 12a - Rename test_bug953156 to test_bootstrapped_chrome_manifest.js and modernize. r=aswan MozReview-Commit-ID: HU1bBCTD207 --HG-- rename : toolkit/mozapps/extensions/test/xpcshell/test_bug953156.js => toolkit/mozapps/extensions/test/xpcshell/test_bootstrapped_chrome_manifest.js extra : rebase_source : 90efc3bc0e7713c88c640edc7b1551b1f11dce64 --- .../test_bootstrapped_chrome_manifest.js | 45 ++++++++++++++++ .../test/xpcshell/test_bug953156.js | 51 ------------------- .../extensions/test/xpcshell/xpcshell.ini | 2 +- 3 files changed, 46 insertions(+), 52 deletions(-) create mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_bootstrapped_chrome_manifest.js delete mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_bug953156.js diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bootstrapped_chrome_manifest.js b/toolkit/mozapps/extensions/test/xpcshell/test_bootstrapped_chrome_manifest.js new file mode 100644 index 000000000000..b9cdb866bc8b --- /dev/null +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bootstrapped_chrome_manifest.js @@ -0,0 +1,45 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +const ADDON = { + "install.rdf": { + "id": "bug675371@tests.mozilla.org", + "version": "1.0", + "bootstrap": "true", + "name": "Bug 675371 Test", + "description": "Test Description", + "targetApplications": [ + { + "id": "xpcshell@tests.mozilla.org", + "minVersion": "1", + "maxVersion": "1" + } + ] + }, + "chrome.manifest": `content bug675371 .`, + "test.js": `var active = true;`, +}; + +add_task(async function run_test() { + createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); + await promiseStartupManager(); +}); + +add_task(async function test() { + let {addon} = await AddonTestUtils.promiseInstallXPI(ADDON); + + Assert.ok(addon.isActive); + + // Tests that chrome.manifest is registered when the addon is installed. + var target = { active: false }; + Services.scriptloader.loadSubScript("chrome://bug675371/content/test.js", target); + Assert.ok(target.active); + + await promiseShutdownManager(); + + // Tests that chrome.manifest remains registered at app shutdown. + target.active = false; + Services.scriptloader.loadSubScript("chrome://bug675371/content/test.js", target); + Assert.ok(target.active); +}); diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug953156.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug953156.js deleted file mode 100644 index fddcb849b4c7..000000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug953156.js +++ /dev/null @@ -1,51 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -function run_test() { - do_test_pending(); - createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); - startupManager(); - - prepare_test({ }, [ - "onNewInstall" - ]); - - AddonManager.getInstallForFile(do_get_addon("test_bug675371"), function(install) { - ensure_test_completed(); - - Assert.notEqual(install, null); - - prepare_test({ - "bug675371@tests.mozilla.org": [ - ["onInstalling", false], - "onInstalled" - ] - }, [ - "onInstallStarted", - "onInstallEnded" - ], callback_soon(check_test)); - install.install(); - }); -} - -function check_test() { - AddonManager.getAddonByID("bug675371@tests.mozilla.org", do_exception_wrap(function(addon) { - Assert.notEqual(addon, null); - Assert.ok(addon.isActive); - - // Tests that chrome.manifest is registered when the addon is installed. - var target = { active: false }; - Services.scriptloader.loadSubScript("chrome://bug675371/content/test.js", target); - Assert.ok(target.active); - - shutdownManager(); - - // Tests that chrome.manifest remains registered at app shutdown. - target.active = false; - Services.scriptloader.loadSubScript("chrome://bug675371/content/test.js", target); - Assert.ok(target.active); - - executeSoon(do_test_finished); - })); -} diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index 16d4e56bc4e5..e3a2e9ad5a70 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -73,6 +73,7 @@ tags = blocklist skip-if = true # Bug 1358846 Bug 1365021 Bug 676992 [test_bootstrap_const.js] [test_bootstrap_globals.js] +[test_bootstrapped_chrome_manifest.js] [test_bug1180901_2.js] skip-if = os != "win" [test_bug566626.js] @@ -95,7 +96,6 @@ tags = blocklist [test_bug740612.js] [test_bug753900.js] [test_bug757663.js] -[test_bug953156.js] [test_cache_certdb.js] run-if = addon_signing [test_cacheflush.js] From 01485305b7ccf577b1af3739954c823f32a93899 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 16:02:02 -0700 Subject: [PATCH 63/88] Bug 1449255: Part 12b - Fold test_bug675371 into test_bootstrapped_chrome_manifest.js. r=aswan MozReview-Commit-ID: 356HXe3iPKT --HG-- extra : rebase_source : e7046a53978f8b80060d7ba6f40ed350ad19615a --- .../addons/test_bug675371/chrome.manifest | 1 - .../test/addons/test_bug675371/install.rdf | 24 ----- .../test/addons/test_bug675371/test.js | 2 - .../test_bootstrapped_chrome_manifest.js | 28 ++++-- .../test/xpcshell/test_bug675371.js | 91 ------------------- .../extensions/test/xpcshell/xpcshell.ini | 1 - 6 files changed, 22 insertions(+), 125 deletions(-) delete mode 100644 toolkit/mozapps/extensions/test/addons/test_bug675371/chrome.manifest delete mode 100644 toolkit/mozapps/extensions/test/addons/test_bug675371/install.rdf delete mode 100644 toolkit/mozapps/extensions/test/addons/test_bug675371/test.js delete mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_bug675371.js diff --git a/toolkit/mozapps/extensions/test/addons/test_bug675371/chrome.manifest b/toolkit/mozapps/extensions/test/addons/test_bug675371/chrome.manifest deleted file mode 100644 index 17d5c99ec45e..000000000000 --- a/toolkit/mozapps/extensions/test/addons/test_bug675371/chrome.manifest +++ /dev/null @@ -1 +0,0 @@ -content bug675371 . diff --git a/toolkit/mozapps/extensions/test/addons/test_bug675371/install.rdf b/toolkit/mozapps/extensions/test/addons/test_bug675371/install.rdf deleted file mode 100644 index ca2881e5ac18..000000000000 --- a/toolkit/mozapps/extensions/test/addons/test_bug675371/install.rdf +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - bug675371@tests.mozilla.org - 1.0 - true - - - Bug 675371 Test - Test Description - - - - xpcshell@tests.mozilla.org - 1 - 1 - - - - - diff --git a/toolkit/mozapps/extensions/test/addons/test_bug675371/test.js b/toolkit/mozapps/extensions/test/addons/test_bug675371/test.js deleted file mode 100644 index d1aebc88c950..000000000000 --- a/toolkit/mozapps/extensions/test/addons/test_bug675371/test.js +++ /dev/null @@ -1,2 +0,0 @@ -/* exported active */ -var active = true; diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bootstrapped_chrome_manifest.js b/toolkit/mozapps/extensions/test/xpcshell/test_bootstrapped_chrome_manifest.js index b9cdb866bc8b..a3703e4d020e 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bootstrapped_chrome_manifest.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bootstrapped_chrome_manifest.js @@ -26,20 +26,36 @@ add_task(async function run_test() { await promiseStartupManager(); }); +function checkActive(expected) { + let target = { active: false }; + let load = () => { + Services.scriptloader.loadSubScript("chrome://bug675371/content/test.js", target); + }; + + if (expected) { + load(); + } else { + Assert.throws(load); + } + equal(target.active, expected, "Manifest is active?"); +} + add_task(async function test() { let {addon} = await AddonTestUtils.promiseInstallXPI(ADDON); Assert.ok(addon.isActive); // Tests that chrome.manifest is registered when the addon is installed. - var target = { active: false }; - Services.scriptloader.loadSubScript("chrome://bug675371/content/test.js", target); - Assert.ok(target.active); + checkActive(true); + + addon.userDisabled = true; + checkActive(false); + + addon.userDisabled = false; + checkActive(true); await promiseShutdownManager(); // Tests that chrome.manifest remains registered at app shutdown. - target.active = false; - Services.scriptloader.loadSubScript("chrome://bug675371/content/test.js", target); - Assert.ok(target.active); + checkActive(true); }); diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug675371.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug675371.js deleted file mode 100644 index 4ebb83a96d39..000000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug675371.js +++ /dev/null @@ -1,91 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -function run_test() { - do_test_pending(); - createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); - startupManager(); - - prepare_test({ }, [ - "onNewInstall" - ]); - - AddonManager.getInstallForFile(do_get_addon("test_bug675371"), function(install) { - ensure_test_completed(); - - Assert.notEqual(install, null); - - prepare_test({ - "bug675371@tests.mozilla.org": [ - ["onInstalling", false], - "onInstalled" - ] - }, [ - "onInstallStarted", - "onInstallEnded", - ], callback_soon(check_test)); - install.install(); - }); -} - -function check_test() { - AddonManager.getAddonByID("bug675371@tests.mozilla.org", do_exception_wrap(function(addon) { - Assert.notEqual(addon, null); - Assert.ok(addon.isActive); - - // Tests that chrome.manifest is registered when the addon is installed. - var target = { }; - Services.scriptloader.loadSubScript("chrome://bug675371/content/test.js", target); - Assert.ok(target.active); - - prepare_test({ - "bug675371@tests.mozilla.org": [ - ["onDisabling", false], - "onDisabled" - ] - }); - - // Tests that chrome.manifest is unregistered when the addon is disabled. - addon.userDisabled = true; - target.active = false; - try { - Services.scriptloader.loadSubScript("chrome://bug675371/content/test.js", target); - do_throw("Chrome file should not have been found"); - } catch (e) { - Assert.ok(!target.active); - } - - prepare_test({ - "bug675371@tests.mozilla.org": [ - ["onEnabling", false], - "onEnabled" - ] - }); - - // Tests that chrome.manifest is registered when the addon is enabled. - addon.userDisabled = false; - target.active = false; - Services.scriptloader.loadSubScript("chrome://bug675371/content/test.js", target); - Assert.ok(target.active); - - prepare_test({ - "bug675371@tests.mozilla.org": [ - ["onUninstalling", false], - "onUninstalled" - ] - }); - - // Tests that chrome.manifest is unregistered when the addon is uninstalled. - addon.uninstall(); - target.active = false; - try { - Services.scriptloader.loadSubScript("chrome://bug675371/content/test.js", target); - do_throw("Chrome file should not have been found"); - } catch (e) { - Assert.ok(!target.active); - } - - executeSoon(do_test_finished); - })); -} diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index e3a2e9ad5a70..f4eced5afaf1 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -92,7 +92,6 @@ tags = blocklist [test_bug620837.js] tags = blocklist [test_bug655254.js] -[test_bug675371.js] [test_bug740612.js] [test_bug753900.js] [test_bug757663.js] From 976704d637bc17317bbefe72df878699965f7ab8 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 15:51:38 -0700 Subject: [PATCH 64/88] Bug 1449255: Part 13 - Remove test_bug757663.js, which doesn't test anything anymore. r=aswan MozReview-Commit-ID: 6K45YVu95nl --HG-- extra : rebase_source : 2ec66a1a3b5d53cbf91a175b1ac5bb7c483c454f --- .../test/addons/test_bug757663/install.rdf | 24 ---- .../test/xpcshell/test_bug757663.js | 112 ------------------ .../extensions/test/xpcshell/xpcshell.ini | 1 - 3 files changed, 137 deletions(-) delete mode 100644 toolkit/mozapps/extensions/test/addons/test_bug757663/install.rdf delete mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_bug757663.js diff --git a/toolkit/mozapps/extensions/test/addons/test_bug757663/install.rdf b/toolkit/mozapps/extensions/test/addons/test_bug757663/install.rdf deleted file mode 100644 index be8d85b1b1fd..000000000000 --- a/toolkit/mozapps/extensions/test/addons/test_bug757663/install.rdf +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - bug757663@tests.mozilla.org - 1.0 - true - - - Test Bootstrap 1 - Test Description - - - - xpcshell@tests.mozilla.org - 1 - 1 - - - - - diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug757663.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug757663.js deleted file mode 100644 index bb9a066ae672..000000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug757663.js +++ /dev/null @@ -1,112 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -// This test verifies that removing a listener during a callback for that type -// of listener still results in all listeners being called. - -var addon1 = { - id: "addon1@tests.mozilla.org", - version: "2.0", - name: "Test 1", - bootstrap: "true", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "1" - }] -}; - -var listener1 = { - sawEvent: false, - onDisabling() { - this.sawEvent = true; - AddonManager.removeAddonListener(this); - }, - onNewInstall() { - this.sawEvent = true; - AddonManager.removeInstallListener(this); - } -}; -var listener2 = { - sawEvent: false, - onDisabling() { - this.sawEvent = true; - }, - onNewInstall() { - this.sawEvent = true; - } -}; -var listener3 = { - sawEvent: false, - onDisabling() { - this.sawEvent = true; - }, - onNewInstall() { - this.sawEvent = true; - } -}; - -const profileDir = gProfD.clone(); -profileDir.append("extensions"); - - -function run_test() { - do_test_pending(); - createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); - - writeInstallRDFForExtension(addon1, profileDir); - startupManager(); - - run_test_1(); -} - -function run_test_1() { - AddonManager.addAddonListener(listener1); - AddonManager.addAddonListener(listener2); - AddonManager.addAddonListener(listener3); - - AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org"], function([a1]) { - Assert.notEqual(a1, null); - Assert.ok(!a1.userDisabled); - Assert.ok(a1.isActive); - - a1.userDisabled = true; - - Assert.ok(listener1.sawEvent); - listener1.sawEvent = false; - Assert.ok(listener2.sawEvent); - listener2.sawEvent = false; - Assert.ok(listener3.sawEvent); - listener3.sawEvent = false; - - AddonManager.removeAddonListener(listener1); - AddonManager.removeAddonListener(listener2); - AddonManager.removeAddonListener(listener3); - - a1.uninstall(); - run_test_2(); - }); -} - -function run_test_2() { - AddonManager.addInstallListener(listener1); - AddonManager.addInstallListener(listener2); - AddonManager.addInstallListener(listener3); - - AddonManager.getInstallForFile(do_get_addon("test_bug757663"), function(aInstall) { - - Assert.ok(listener1.sawEvent); - listener1.sawEvent = false; - Assert.ok(listener2.sawEvent); - listener2.sawEvent = false; - Assert.ok(listener3.sawEvent); - listener3.sawEvent = false; - - AddonManager.removeInstallListener(listener1); - AddonManager.removeInstallListener(listener2); - AddonManager.removeInstallListener(listener3); - - executeSoon(do_test_finished); - }); -} diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index f4eced5afaf1..f63fb9991020 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -94,7 +94,6 @@ tags = blocklist [test_bug655254.js] [test_bug740612.js] [test_bug753900.js] -[test_bug757663.js] [test_cache_certdb.js] run-if = addon_signing [test_cacheflush.js] From cfcc91b8ecfc470aec4604920a7802cf22e195e7 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 15:54:45 -0700 Subject: [PATCH 65/88] Bug 1449255: Part 14 - Rename test_bug753900 to test_crash_annotation_quoting.js. r=aswan MozReview-Commit-ID: H0KARZUfGjM --HG-- rename : toolkit/mozapps/extensions/test/xpcshell/test_bug753900.js => toolkit/mozapps/extensions/test/xpcshell/test_crash_annotation_quoting.js extra : rebase_source : 3d76d5376ed6e59c38cccedcfdafc00ff60fdfba --- ...00.js => test_crash_annotation_quoting.js} | 30 +++++++------------ .../extensions/test/xpcshell/xpcshell.ini | 2 +- 2 files changed, 12 insertions(+), 20 deletions(-) rename toolkit/mozapps/extensions/test/xpcshell/{test_bug753900.js => test_crash_annotation_quoting.js} (53%) diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug753900.js b/toolkit/mozapps/extensions/test/xpcshell/test_crash_annotation_quoting.js similarity index 53% rename from toolkit/mozapps/extensions/test/xpcshell/test_bug753900.js rename to toolkit/mozapps/extensions/test/xpcshell/test_crash_annotation_quoting.js index 0ff1793897d6..387900a79e20 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug753900.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_crash_annotation_quoting.js @@ -31,26 +31,18 @@ var addon4 = { createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); -const profileDir = gProfD.clone(); -profileDir.append("extensions"); +add_task(async function run_test() { + await promiseStartupManager(); -function run_test() { - do_test_pending(); + await promiseInstallXPI(addon3); + await promiseInstallXPI(addon4); - writeInstallRDFForExtension(addon3, profileDir); - writeInstallRDFForExtension(addon4, profileDir); + let [a3, a4] = await AddonManager.getAddonsByIDs(["addon3@tests.mozilla.org", + "addon4@tests.mozilla.org"]); - startupManager(); + Assert.notEqual(a3, null); + do_check_in_crash_annotation(addon3.id, addon3.version); - AddonManager.getAddonsByIDs(["addon3@tests.mozilla.org", - "addon4@tests.mozilla.org"], - function([a3, a4]) { - - Assert.notEqual(a3, null); - do_check_in_crash_annotation(addon3.id, addon3.version); - Assert.notEqual(a4, null); - do_check_in_crash_annotation(addon4.id, addon4.version); - - executeSoon(do_test_finished); - }); -} + Assert.notEqual(a4, null); + do_check_in_crash_annotation(addon4.id, addon4.version); +}); diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index f63fb9991020..ffad8d63d28d 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -93,7 +93,6 @@ tags = blocklist tags = blocklist [test_bug655254.js] [test_bug740612.js] -[test_bug753900.js] [test_cache_certdb.js] run-if = addon_signing [test_cacheflush.js] @@ -101,6 +100,7 @@ run-if = addon_signing [test_compatoverrides.js] [test_corrupt.js] [test_corruptfile.js] +[test_crash_annotation_quoting.js] [test_db_path.js] head = [test_default_providers_pref.js] From cf2629d6f0f0992986977a90678596e71229f1f0 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 15:56:30 -0700 Subject: [PATCH 66/88] Bug 1449255: Part 15 - Remove test_bug740612, which is no longer useful. r=aswan MozReview-Commit-ID: GIz5omgP8RR --HG-- extra : rebase_source : 04b9927fc6f1bb4d5cdb2d6ed45264d6bbc83a17 --- .../test/addons/test_bug740612_1/bootstrap.js | 2 - .../test/addons/test_bug740612_1/install.rdf | 24 ----------- .../test/addons/test_bug740612_2/bootstrap.js | 24 ----------- .../test/addons/test_bug740612_2/install.rdf | 24 ----------- .../test/xpcshell/test_bug740612.js | 40 ------------------- .../extensions/test/xpcshell/xpcshell.ini | 1 - 6 files changed, 115 deletions(-) delete mode 100644 toolkit/mozapps/extensions/test/addons/test_bug740612_1/bootstrap.js delete mode 100644 toolkit/mozapps/extensions/test/addons/test_bug740612_1/install.rdf delete mode 100644 toolkit/mozapps/extensions/test/addons/test_bug740612_2/bootstrap.js delete mode 100644 toolkit/mozapps/extensions/test/addons/test_bug740612_2/install.rdf delete mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_bug740612.js diff --git a/toolkit/mozapps/extensions/test/addons/test_bug740612_1/bootstrap.js b/toolkit/mozapps/extensions/test/addons/test_bug740612_1/bootstrap.js deleted file mode 100644 index c231fcbc086d..000000000000 --- a/toolkit/mozapps/extensions/test/addons/test_bug740612_1/bootstrap.js +++ /dev/null @@ -1,2 +0,0 @@ -/* exported APP_STARTUP */ -const APP_STARTUP = 1; diff --git a/toolkit/mozapps/extensions/test/addons/test_bug740612_1/install.rdf b/toolkit/mozapps/extensions/test/addons/test_bug740612_1/install.rdf deleted file mode 100644 index b2316273f91a..000000000000 --- a/toolkit/mozapps/extensions/test/addons/test_bug740612_1/install.rdf +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - bug740612_1@tests.mozilla.org - 1.0 - true - - - Test Bootstrap 1 - Test Description - - - - xpcshell@tests.mozilla.org - 1 - 1 - - - - - diff --git a/toolkit/mozapps/extensions/test/addons/test_bug740612_2/bootstrap.js b/toolkit/mozapps/extensions/test/addons/test_bug740612_2/bootstrap.js deleted file mode 100644 index 779ce073e798..000000000000 --- a/toolkit/mozapps/extensions/test/addons/test_bug740612_2/bootstrap.js +++ /dev/null @@ -1,24 +0,0 @@ -/* exported startup, shutdown, install, uninstall */ -ChromeUtils.import("resource://gre/modules/Services.jsm"); - -const VERSION = "1.0"; - -function install(data, reason) { - Services.prefs.setIntPref("bootstraptest.installed_version", VERSION); - Services.prefs.setIntPref("bootstraptest.install_reason", reason); -} - -function startup(data, reason) { - Services.prefs.setIntPref("bootstraptest.active_version", VERSION); - Services.prefs.setIntPref("bootstraptest.startup_reason", reason); -} - -function shutdown(data, reason) { - Services.prefs.setIntPref("bootstraptest.active_version", 0); - Services.prefs.setIntPref("bootstraptest.shutdown_reason", reason); -} - -function uninstall(data, reason) { - Services.prefs.setIntPref("bootstraptest.installed_version", 0); - Services.prefs.setIntPref("bootstraptest.uninstall_reason", reason); -} diff --git a/toolkit/mozapps/extensions/test/addons/test_bug740612_2/install.rdf b/toolkit/mozapps/extensions/test/addons/test_bug740612_2/install.rdf deleted file mode 100644 index ff4d613ef2f2..000000000000 --- a/toolkit/mozapps/extensions/test/addons/test_bug740612_2/install.rdf +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - bug740612_2@tests.mozilla.org - 1.0 - true - - - Test Bootstrap 2 - Test Description - - - - xpcshell@tests.mozilla.org - 1 - 1 - - - - - diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug740612.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug740612.js deleted file mode 100644 index dd443eea8a48..000000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug740612.js +++ /dev/null @@ -1,40 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -// This verifies that attempts to override the global values fails but doesn't -// destroy the world with it -createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); - -const profileDir = gProfD.clone(); -profileDir.append("extensions"); - -function getActiveVersion() { - return Services.prefs.getIntPref("bootstraptest.active_version"); -} - -function getInstalledVersion() { - return Services.prefs.getIntPref("bootstraptest.installed_version"); -} - -function run_test() { - do_test_pending(); - - manuallyInstall(do_get_addon("test_bug740612_1"), profileDir, - "bug740612_1@tests.mozilla.org"); - manuallyInstall(do_get_addon("test_bug740612_2"), profileDir, - "bug740612_2@tests.mozilla.org"); - - startupManager(); - - AddonManager.getAddonsByIDs(["bug740612_1@tests.mozilla.org", - "bug740612_2@tests.mozilla.org"], - function([a1, a2]) { - Assert.notEqual(a1, null); - Assert.notEqual(a2, null); - Assert.equal(getInstalledVersion(), "1.0"); - Assert.equal(getActiveVersion(), "1.0"); - - executeSoon(do_test_finished); - }); -} diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index ffad8d63d28d..dd2625ac0f66 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -92,7 +92,6 @@ tags = blocklist [test_bug620837.js] tags = blocklist [test_bug655254.js] -[test_bug740612.js] [test_cache_certdb.js] run-if = addon_signing [test_cacheflush.js] From 4f0afb85acc5b3275c83a35575433c9e11c21ad1 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 16:26:01 -0700 Subject: [PATCH 67/88] Bug 1449255: Part 16 - Rename test_bug655254 to test_moved_extension_metadata.js. r=aswan MozReview-Commit-ID: ISPgh91V4TT --HG-- rename : toolkit/mozapps/extensions/test/xpcshell/test_bug655254.js => toolkit/mozapps/extensions/test/xpcshell/test_moved_extension_metadata.js extra : rebase_source : 8022d3bf030abf578c3b258103ce977eb7e816af --- .../test/xpcshell/test_bug655254.js | 192 ------------------ .../xpcshell/test_moved_extension_metadata.js | 170 ++++++++++++++++ .../extensions/test/xpcshell/xpcshell.ini | 2 +- 3 files changed, 171 insertions(+), 193 deletions(-) delete mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_bug655254.js create mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_moved_extension_metadata.js diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug655254.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug655254.js deleted file mode 100644 index a3493f3aca0b..000000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug655254.js +++ /dev/null @@ -1,192 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -// This verifies that moving an extension in the filesystem without any other -// change still keeps updated compatibility information - -// The test extension uses an insecure update url. -Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false); -// Enable loading extensions from the user and system scopes -Services.prefs.setIntPref("extensions.enabledScopes", - AddonManager.SCOPE_PROFILE + AddonManager.SCOPE_USER); - -createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "1.9.2"); - -var testserver = AddonTestUtils.createHttpServer({hosts: ["example.com"]}); -testserver.registerDirectory("/data/", do_get_file("data")); - -var userDir = gProfD.clone(); -userDir.append("extensions2"); -userDir.append(gAppInfo.ID); - -var dirProvider = { - getFile(aProp, aPersistent) { - aPersistent.value = false; - if (aProp == "XREUSysExt") - return userDir.parent; - return null; - }, - - QueryInterface: XPCOMUtils.generateQI([Ci.nsIDirectoryServiceProvider, - Ci.nsISupports]) -}; -Services.dirsvc.registerProvider(dirProvider); - -var addon1 = { - id: "addon1@tests.mozilla.org", - version: "1.0", - name: "Test 1", - bootstrap: true, - updateURL: "http://example.com/data/test_bug655254.json", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "1" - }] -}; - -const ADDONS = [ - { - "install.rdf": { - id: "addon2@tests.mozilla.org", - version: "1.0", - name: "Test 2", - bootstrap: true, - - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "2", - maxVersion: "2"}], - }, - "bootstrap.js": ` - /* exported startup, shutdown */ - ChromeUtils.import("resource://gre/modules/Services.jsm"); - - function startup(data, reason) { - Services.prefs.setIntPref("bootstraptest.active_version", 1); - } - - function shutdown(data, reason) { - Services.prefs.setIntPref("bootstraptest.active_version", 0); - } - ` - }, -]; - -const XPIS = ADDONS.map(addon => AddonTestUtils.createTempXPIFile(addon)); - -// Set up the profile -function run_test() { - do_test_pending(); - run_test_1(); -} - -function end_test() { - do_test_finished(); -} - -async function run_test_1() { - var time = Date.now(); - var dir = writeInstallRDFForExtension(addon1, userDir); - setExtensionModifiedTime(dir, time); - - manuallyInstall(XPIS[0], userDir, "addon2@tests.mozilla.org"); - - await promiseStartupManager(); - - AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", - "addon2@tests.mozilla.org"], function([a1, a2]) { - Assert.notEqual(a1, null); - Assert.ok(a1.appDisabled); - Assert.ok(!a1.isActive); - Assert.ok(!isExtensionInBootstrappedList(userDir, a1.id)); - - Assert.notEqual(a2, null); - Assert.ok(!a2.appDisabled); - Assert.ok(a2.isActive); - Assert.ok(isExtensionInBootstrappedList(userDir, a2.id)); - Assert.equal(Services.prefs.getIntPref("bootstraptest.active_version"), 1); - - a1.findUpdates({ - async onUpdateFinished() { - await promiseRestartManager(); - - AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(async function(a1_2) { - Assert.notEqual(a1_2, null); - Assert.ok(!a1_2.appDisabled); - Assert.ok(a1_2.isActive); - Assert.ok(isExtensionInBootstrappedList(userDir, a1_2.id)); - - shutdownManager(); - - Assert.equal(Services.prefs.getIntPref("bootstraptest.active_version"), 0); - - userDir.parent.moveTo(gProfD, "extensions3"); - userDir = gProfD.clone(); - userDir.append("extensions3"); - userDir.append(gAppInfo.ID); - Assert.ok(userDir.exists()); - - await promiseStartupManager(false); - - AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", - "addon2@tests.mozilla.org"], function([a1_3, a2_3]) { - Assert.notEqual(a1_3, null); - Assert.ok(!a1_3.appDisabled); - Assert.ok(a1_3.isActive); - Assert.ok(isExtensionInBootstrappedList(userDir, a1_3.id)); - - Assert.notEqual(a2_3, null); - Assert.ok(!a2_3.appDisabled); - Assert.ok(a2_3.isActive); - Assert.ok(isExtensionInBootstrappedList(userDir, a2_3.id)); - Assert.equal(Services.prefs.getIntPref("bootstraptest.active_version"), 1); - - executeSoon(run_test_2); - }); - })); - } - }, AddonManager.UPDATE_WHEN_USER_REQUESTED); - }); -} - -// Set up the profile -function run_test_2() { - AddonManager.getAddonByID("addon2@tests.mozilla.org", callback_soon(async function(a2) { - Assert.notEqual(a2, null); - Assert.ok(!a2.appDisabled); - Assert.ok(a2.isActive); - Assert.ok(isExtensionInBootstrappedList(userDir, a2.id)); - Assert.equal(Services.prefs.getIntPref("bootstraptest.active_version"), 1); - - a2.userDisabled = true; - Assert.equal(Services.prefs.getIntPref("bootstraptest.active_version"), 0); - - shutdownManager(); - - userDir.parent.moveTo(gProfD, "extensions4"); - userDir = gProfD.clone(); - userDir.append("extensions4"); - userDir.append(gAppInfo.ID); - Assert.ok(userDir.exists()); - - await promiseStartupManager(false); - - AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", - "addon2@tests.mozilla.org"], function([a1_2, a2_2]) { - Assert.notEqual(a1_2, null); - Assert.ok(!a1_2.appDisabled); - Assert.ok(a1_2.isActive); - Assert.ok(isExtensionInBootstrappedList(userDir, a1_2.id)); - - Assert.notEqual(a2_2, null); - Assert.ok(a2_2.userDisabled); - Assert.ok(!a2_2.isActive); - Assert.ok(!isExtensionInBootstrappedList(userDir, a2_2.id)); - Assert.equal(Services.prefs.getIntPref("bootstraptest.active_version"), 0); - - end_test(); - }); - })); -} diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_moved_extension_metadata.js b/toolkit/mozapps/extensions/test/xpcshell/test_moved_extension_metadata.js new file mode 100644 index 000000000000..56894baa14c0 --- /dev/null +++ b/toolkit/mozapps/extensions/test/xpcshell/test_moved_extension_metadata.js @@ -0,0 +1,170 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +// This verifies that moving an extension in the filesystem without any other +// change still keeps updated compatibility information + +// The test extension uses an insecure update url. +Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false); +// Enable loading extensions from the user and system scopes +Services.prefs.setIntPref("extensions.enabledScopes", + AddonManager.SCOPE_PROFILE + AddonManager.SCOPE_USER); + +createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "1.9.2"); + +var testserver = AddonTestUtils.createHttpServer({hosts: ["example.com"]}); +testserver.registerDirectory("/data/", do_get_file("data")); + +var userDir = gProfD.clone(); +userDir.append("extensions2"); +userDir.append(gAppInfo.ID); + +var dirProvider = { + getFile(aProp, aPersistent) { + aPersistent.value = false; + if (aProp == "XREUSysExt") + return userDir.parent; + return null; + }, + + QueryInterface: XPCOMUtils.generateQI([Ci.nsIDirectoryServiceProvider]) +}; +Services.dirsvc.registerProvider(dirProvider); + +var addon1 = { + id: "addon1@tests.mozilla.org", + version: "1.0", + name: "Test 1", + bootstrap: true, + updateURL: "http://example.com/data/test_bug655254.json", + targetApplications: [{ + id: "xpcshell@tests.mozilla.org", + minVersion: "1", + maxVersion: "1" + }] +}; + +const ADDONS = [ + { + "install.rdf": { + id: "addon2@tests.mozilla.org", + version: "1.0", + name: "Test 2", + bootstrap: true, + + targetApplications: [{ + id: "xpcshell@tests.mozilla.org", + minVersion: "2", + maxVersion: "2"}], + }, + "bootstrap.js": ` + /* exported startup, shutdown */ + ChromeUtils.import("resource://gre/modules/Services.jsm"); + + function startup(data, reason) { + Services.prefs.setIntPref("bootstraptest.active_version", 1); + } + + function shutdown(data, reason) { + Services.prefs.setIntPref("bootstraptest.active_version", 0); + } + ` + }, +]; + +const XPIS = ADDONS.map(addon => AddonTestUtils.createTempXPIFile(addon)); + +add_task(async function test_1() { + var time = Date.now(); + var dir = writeInstallRDFForExtension(addon1, userDir); + setExtensionModifiedTime(dir, time); + + manuallyInstall(XPIS[0], userDir, "addon2@tests.mozilla.org"); + + await promiseStartupManager(); + + let [a1, a2] = await AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", + "addon2@tests.mozilla.org"]); + Assert.notEqual(a1, null); + Assert.ok(a1.appDisabled); + Assert.ok(!a1.isActive); + Assert.ok(!isExtensionInBootstrappedList(userDir, a1.id)); + + Assert.notEqual(a2, null); + Assert.ok(!a2.appDisabled); + Assert.ok(a2.isActive); + Assert.ok(isExtensionInBootstrappedList(userDir, a2.id)); + Assert.equal(Services.prefs.getIntPref("bootstraptest.active_version"), 1); + + await AddonTestUtils.promiseFindAddonUpdates(a1, AddonManager.UPDATE_WHEN_USER_REQUESTED); + + await promiseRestartManager(); + + let a1_2 = await AddonManager.getAddonByID("addon1@tests.mozilla.org"); + Assert.notEqual(a1_2, null); + Assert.ok(!a1_2.appDisabled); + Assert.ok(a1_2.isActive); + Assert.ok(isExtensionInBootstrappedList(userDir, a1_2.id)); + + await promiseShutdownManager(); + + Assert.equal(Services.prefs.getIntPref("bootstraptest.active_version"), 0); + + userDir.parent.moveTo(gProfD, "extensions3"); + userDir = gProfD.clone(); + userDir.append("extensions3"); + userDir.append(gAppInfo.ID); + Assert.ok(userDir.exists()); + + await promiseStartupManager(false); + + let [a1_3, a2_3] = await AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", + "addon2@tests.mozilla.org"]); + Assert.notEqual(a1_3, null); + Assert.ok(!a1_3.appDisabled); + Assert.ok(a1_3.isActive); + Assert.ok(isExtensionInBootstrappedList(userDir, a1_3.id)); + + Assert.notEqual(a2_3, null); + Assert.ok(!a2_3.appDisabled); + Assert.ok(a2_3.isActive); + Assert.ok(isExtensionInBootstrappedList(userDir, a2_3.id)); + Assert.equal(Services.prefs.getIntPref("bootstraptest.active_version"), 1); +}); + +// Set up the profile +add_task(async function test_2() { + let a2 = await AddonManager.getAddonByID("addon2@tests.mozilla.org"); + Assert.notEqual(a2, null); + Assert.ok(!a2.appDisabled); + Assert.ok(a2.isActive); + Assert.ok(isExtensionInBootstrappedList(userDir, a2.id)); + Assert.equal(Services.prefs.getIntPref("bootstraptest.active_version"), 1); + + a2.userDisabled = true; + Assert.equal(Services.prefs.getIntPref("bootstraptest.active_version"), 0); + + await promiseShutdownManager(); + + userDir.parent.moveTo(gProfD, "extensions4"); + userDir = gProfD.clone(); + userDir.append("extensions4"); + userDir.append(gAppInfo.ID); + Assert.ok(userDir.exists()); + + await promiseStartupManager(false); + + let [a1_2, a2_2] = await AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", + "addon2@tests.mozilla.org"]); + Assert.notEqual(a1_2, null); + Assert.ok(!a1_2.appDisabled); + Assert.ok(a1_2.isActive); + Assert.ok(isExtensionInBootstrappedList(userDir, a1_2.id)); + + Assert.notEqual(a2_2, null); + Assert.ok(a2_2.userDisabled); + Assert.ok(!a2_2.isActive); + Assert.ok(!isExtensionInBootstrappedList(userDir, a2_2.id)); + Assert.equal(Services.prefs.getIntPref("bootstraptest.active_version"), 0); +}); diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index dd2625ac0f66..354740f98436 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -91,7 +91,6 @@ fail-if = os == "android" tags = blocklist [test_bug620837.js] tags = blocklist -[test_bug655254.js] [test_cache_certdb.js] run-if = addon_signing [test_cacheflush.js] @@ -175,6 +174,7 @@ skip-if = !allow_legacy_extensions || appname == "thunderbird" # Bug 676992: test consistently hangs on Android skip-if = os == "android" [test_migrate_state_prefs.js] +[test_moved_extension_metadata.js] [test_no_addons.js] [test_nodisable_hidden.js] [test_onPropertyChanged_appDisabled.js] From bb62038b3ec9142ea56aa30840ef77d0c50f4be2 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 16:27:00 -0700 Subject: [PATCH 68/88] Bug 1449255: Part 17 - Rename test_bug620837 to test_blocklist_url_ping_count.js and modernize. r=aswan MozReview-Commit-ID: K9m1vDfLP5X --HG-- rename : toolkit/mozapps/extensions/test/xpcshell/test_bug620837.js => toolkit/mozapps/extensions/test/xpcshell/test_blocklist_url_ping_count.js extra : rebase_source : f35f907018fdbeec95bd2bc522633408860423ae --- ...37.js => test_blocklist_url_ping_count.js} | 137 +++++++----------- .../extensions/test/xpcshell/xpcshell.ini | 4 +- 2 files changed, 55 insertions(+), 86 deletions(-) rename toolkit/mozapps/extensions/test/xpcshell/{test_bug620837.js => test_blocklist_url_ping_count.js} (54%) diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug620837.js b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_url_ping_count.js similarity index 54% rename from toolkit/mozapps/extensions/test/xpcshell/test_bug620837.js rename to toolkit/mozapps/extensions/test/xpcshell/test_blocklist_url_ping_count.js index 5dc9248f4b79..2235dcdb63b7 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug620837.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_url_ping_count.js @@ -10,136 +10,105 @@ const PREF_BLOCKLIST_PINGCOUNTVERSION = "extensions.blocklist.pingCountVersion"; const SECONDS_IN_DAY = 60 * 60 * 24; -var gExpectedQueryString = null; -var gNextTest = null; -var gTestserver = null; +var gTestserver = AddonTestUtils.createHttpServer({hosts: ["example.com"]}); -function notify_blocklist() { - var blocklist = Cc["@mozilla.org/extensions/blocklist;1"]. - getService(Ci.nsITimerCallback); - blocklist.notify(null); +let resolveQuery; +gTestserver.registerPathHandler("/", function pathHandler(metadata, response) { + resolveQuery(metadata.queryString); +}); + +async function checkQuery(expected) { + let promise = new Promise(resolve => { + resolveQuery = resolve; + }); + + Services.blocklist.QueryInterface(Ci.nsITimerCallback).notify(null); + + equal(await promise, expected, "Got expected blocklist query string"); } -function pathHandler(metadata, response) { - Assert.equal(metadata.queryString, gExpectedQueryString); - gNextTest(); -} - -function run_test() { +add_task(async function setup() { createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1"); gTestserver = new HttpServer(); - gTestserver.registerPathHandler("/", pathHandler); gTestserver.start(-1); gPort = gTestserver.identity.primaryPort; Services.prefs.setCharPref("extensions.blocklist.url", - "http://localhost:" + gPort + - "/?%PING_COUNT%&%TOTAL_PING_COUNT%&%DAYS_SINCE_LAST_PING%"); - - do_test_pending(); - test1(); -} + "http://example.com/?%PING_COUNT%&%TOTAL_PING_COUNT%&%DAYS_SINCE_LAST_PING%"); +}); function getNowInSeconds() { return Math.round(Date.now() / 1000); } -function test1() { - gNextTest = test2; - gExpectedQueryString = "1&1&new"; - notify_blocklist(); -} +add_task(async function test1() { + await checkQuery("1&1&new"); +}); -function test2() { - gNextTest = test3; - gExpectedQueryString = "invalid&invalid&invalid"; - notify_blocklist(); -} +add_task(async function test2() { + await checkQuery("invalid&invalid&invalid"); +}); -function test3() { +add_task(async function test3() { Services.prefs.setIntPref(PREF_BLOCKLIST_LASTUPDATETIME, (getNowInSeconds() - SECONDS_IN_DAY)); - gNextTest = test4; - gExpectedQueryString = "2&2&1"; - notify_blocklist(); -} + await checkQuery("2&2&1"); +}); -function test4() { +add_task(async function test4() { Services.prefs.setIntPref(PREF_BLOCKLIST_PINGCOUNTVERSION, -1); Services.prefs.setIntPref(PREF_BLOCKLIST_LASTUPDATETIME, (getNowInSeconds() - (SECONDS_IN_DAY * 2))); - gNextTest = test5; - gExpectedQueryString = "1&3&2"; - notify_blocklist(); -} + await checkQuery("1&3&2"); +}); -function test5() { +add_task(async function test5() { Services.prefs.setIntPref(PREF_BLOCKLIST_LASTUPDATETIME, getNowInSeconds()); - gNextTest = test6; - gExpectedQueryString = "invalid&invalid&0"; - notify_blocklist(); -} + await checkQuery("invalid&invalid&0"); +}); -function test6() { +add_task(async function test6() { Services.prefs.setIntPref(PREF_BLOCKLIST_LASTUPDATETIME, (getNowInSeconds() - (SECONDS_IN_DAY * 3))); - gNextTest = test7; - gExpectedQueryString = "2&4&3"; - notify_blocklist(); -} + await checkQuery("2&4&3"); +}); -function test7() { +add_task(async function test7() { Services.prefs.setIntPref(PREF_BLOCKLIST_PINGCOUNTVERSION, 2147483647); Services.prefs.setIntPref(PREF_BLOCKLIST_LASTUPDATETIME, (getNowInSeconds() - (SECONDS_IN_DAY * 4))); - gNextTest = test8; - gExpectedQueryString = "2147483647&5&4"; - notify_blocklist(); -} + await checkQuery("2147483647&5&4"); +}); -function test8() { +add_task(async function test8() { Services.prefs.setIntPref(PREF_BLOCKLIST_LASTUPDATETIME, (getNowInSeconds() - (SECONDS_IN_DAY * 5))); - gNextTest = test9; - gExpectedQueryString = "1&6&5"; - notify_blocklist(); -} + await checkQuery("1&6&5"); +}); -function test9() { +add_task(async function test9() { Services.prefs.setIntPref(PREF_BLOCKLIST_PINGCOUNTTOTAL, 2147483647); Services.prefs.setIntPref(PREF_BLOCKLIST_LASTUPDATETIME, (getNowInSeconds() - (SECONDS_IN_DAY * 6))); - gNextTest = test10; - gExpectedQueryString = "2&2147483647&6"; - notify_blocklist(); -} + await checkQuery("2&2147483647&6"); +}); -function test10() { +add_task(async function test10() { Services.prefs.setIntPref(PREF_BLOCKLIST_LASTUPDATETIME, (getNowInSeconds() - (SECONDS_IN_DAY * 7))); - gNextTest = test11; - gExpectedQueryString = "3&1&7"; - notify_blocklist(); -} + await checkQuery("3&1&7"); +}); -function test11() { +add_task(async function test11() { Services.prefs.setIntPref(PREF_BLOCKLIST_PINGCOUNTVERSION, -1); Services.prefs.setIntPref(PREF_BLOCKLIST_LASTUPDATETIME, (getNowInSeconds() - (SECONDS_IN_DAY * 8))); - gNextTest = test12; - gExpectedQueryString = "1&2&8"; - notify_blocklist(); -} + await checkQuery("1&2&8"); +}); -function test12() { +add_task(async function test12() { Services.prefs.setIntPref(PREF_BLOCKLIST_LASTUPDATETIME, (getNowInSeconds() - (SECONDS_IN_DAY * 9))); - gNextTest = finish; - gExpectedQueryString = "2&3&9"; - notify_blocklist(); -} - -function finish() { - gTestserver.stop(do_test_finished); -} + await checkQuery("2&3&9"); +}); diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index 354740f98436..2f58a843107a 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -65,6 +65,8 @@ tags = blocklist # Bug 676992: test consistently hangs on Android skip-if = os == "android" tags = blocklist +[test_blocklist_url_ping_count.js] +tags = blocklist [test_blocklistchange.js] # Times out during parallel runs on desktop requesttimeoutfactor = 2 @@ -89,8 +91,6 @@ skip-if = os == "win" # Bug 1358846 fail-if = os == "android" [test_bug619730.js] tags = blocklist -[test_bug620837.js] -tags = blocklist [test_cache_certdb.js] run-if = addon_signing [test_cacheflush.js] From afcf6c17b928ca1bc4bb8c8ff1eb665db409ba99 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 16:29:15 -0700 Subject: [PATCH 69/88] Bug 1449255: Part 18 - Remove test_bug619730, which is covered by other tests. r=aswan MozReview-Commit-ID: 3dgdK7mk5Kk --HG-- extra : rebase_source : c4b90de4fb3f46aadf2b99aa6439b0fc3e5e6e0e --- .../test/xpcshell/data/test_bug619730.xml | 7 --- .../test/xpcshell/test_bug619730.js | 54 ------------------- .../extensions/test/xpcshell/xpcshell.ini | 2 - 3 files changed, 63 deletions(-) delete mode 100644 toolkit/mozapps/extensions/test/xpcshell/data/test_bug619730.xml delete mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_bug619730.js diff --git a/toolkit/mozapps/extensions/test/xpcshell/data/test_bug619730.xml b/toolkit/mozapps/extensions/test/xpcshell/data/test_bug619730.xml deleted file mode 100644 index f2511c0de68d..000000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/data/test_bug619730.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug619730.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug619730.js deleted file mode 100644 index b4effa0307ae..000000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug619730.js +++ /dev/null @@ -1,54 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -var gTestserver = AddonTestUtils.createHttpServer({hosts: ["example.com"]}); -gTestserver.registerDirectory("/data/", do_get_file("data")); - -function load_blocklist(file, aCallback) { - Services.obs.addObserver(function observer() { - Services.obs.removeObserver(observer, "blocklist-updated"); - - executeSoon(aCallback); - }, "blocklist-updated"); - - Services.prefs.setCharPref("extensions.blocklist.url", "http://example.com/data/" + file); - var blocklist = Cc["@mozilla.org/extensions/blocklist;1"]. - getService(Ci.nsITimerCallback); - blocklist.notify(null); -} - -var gSawGFX = false; -var gSawTest = false; - -// Performs the initial setup -function run_test() { - createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8"); - startupManager(); - - do_test_pending(); - - Services.obs.addObserver(function(aSubject, aTopic, aData) { - Assert.ok(aSubject instanceof Ci.nsIDOMElement); - Assert.equal(aSubject.getAttribute("testattr"), "GFX"); - Assert.equal(aSubject.childNodes.length, 2); - gSawGFX = true; - }, "blocklist-data-gfxItems"); - - Services.obs.addObserver(function(aSubject, aTopic, aData) { - Assert.ok(aSubject instanceof Ci.nsIDOMElement); - Assert.equal(aSubject.getAttribute("testattr"), "FOO"); - Assert.equal(aSubject.childNodes.length, 3); - gSawTest = true; - }, "blocklist-data-testItems"); - - Services.obs.addObserver(function(aSubject, aTopic, aData) { - Assert.ok(gSawGFX); - Assert.ok(gSawTest); - }, "blocklist-data-fooItems"); - - // Need to wait for the blocklist to load; Bad Things happen if the test harness - // shuts down AddonManager before the blocklist service is done telling it about - // changes - load_blocklist("test_bug619730.xml", () => do_test_finished()); -} diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index 2f58a843107a..9c7717a1ed11 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -89,8 +89,6 @@ skip-if = os == "win" # Bug 1358846 [test_bug616841.js] # Bug 676992: test consistently fails on Android fail-if = os == "android" -[test_bug619730.js] -tags = blocklist [test_cache_certdb.js] run-if = addon_signing [test_cacheflush.js] From 6fc5f3c7545fedf06b5486c25ca1baac65d0ebb8 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 16:30:33 -0700 Subject: [PATCH 70/88] Bug 1449255: Part 19 - Remove test_bug616841.js, which has no business being part of the add-on manager test suite. r=aswan MozReview-Commit-ID: BCOU9TZawKe --HG-- extra : rebase_source : 3d3a0b388b7f6e2bdccc58fc8d4bd8e0eef93c70 --- .../test/xpcshell/test_bug616841.js | 26 ------------------- .../extensions/test/xpcshell/xpcshell.ini | 3 --- 2 files changed, 29 deletions(-) delete mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_bug616841.js diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug616841.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug616841.js deleted file mode 100644 index 31a680579f29..000000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug616841.js +++ /dev/null @@ -1,26 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -// Tests that string comparisons work correctly in callbacks - -function test_string_compare() { - Assert.ok("C".localeCompare("D") < 0); - Assert.ok("D".localeCompare("C") > 0); - Assert.ok("\u010C".localeCompare("D") < 0); - Assert.ok("D".localeCompare("\u010C") > 0); -} - -function run_test() { - createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); - startupManager(); - - do_test_pending(); - - test_string_compare(); - - AddonManager.getAddonByID("foo", function(aAddon) { - test_string_compare(); - executeSoon(do_test_finished); - }); -} diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index 9c7717a1ed11..1afb72bcd339 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -86,9 +86,6 @@ skip-if = os != "win" skip-if = os == "win" # Bug 1358846 [test_bug595081.js] [test_bug596607.js] -[test_bug616841.js] -# Bug 676992: test consistently fails on Android -fail-if = os == "android" [test_cache_certdb.js] run-if = addon_signing [test_cacheflush.js] From 56c122f518388125b9af4bf6265bfa8bca0dbac9 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 16:34:03 -0700 Subject: [PATCH 71/88] Bug 1449255: Part 20 - Remove test_bug567184.js, which is covered by other tests. r=aswan MozReview-Commit-ID: GePi1xlzZnO --HG-- extra : rebase_source : bc1a70164b12261a40f00278d3e288631f5f18f2 --- .../test/addons/test_bug567184/bootstrap.js | 8 --- .../test/addons/test_bug567184/install.rdf | 24 --------- .../test/xpcshell/test_bug567184.js | 53 ------------------- .../extensions/test/xpcshell/xpcshell.ini | 1 - 4 files changed, 86 deletions(-) delete mode 100644 toolkit/mozapps/extensions/test/addons/test_bug567184/bootstrap.js delete mode 100644 toolkit/mozapps/extensions/test/addons/test_bug567184/install.rdf delete mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_bug567184.js diff --git a/toolkit/mozapps/extensions/test/addons/test_bug567184/bootstrap.js b/toolkit/mozapps/extensions/test/addons/test_bug567184/bootstrap.js deleted file mode 100644 index 281ab65e40c3..000000000000 --- a/toolkit/mozapps/extensions/test/addons/test_bug567184/bootstrap.js +++ /dev/null @@ -1,8 +0,0 @@ -/* exported startup, shutdown, install, uninstall */ -function install(data, reason) { } - -function startup(data, reason) { } - -function shutdown(data, reason) { } - -function uninstall(data, reason) {} diff --git a/toolkit/mozapps/extensions/test/addons/test_bug567184/install.rdf b/toolkit/mozapps/extensions/test/addons/test_bug567184/install.rdf deleted file mode 100644 index 1e13ceb87384..000000000000 --- a/toolkit/mozapps/extensions/test/addons/test_bug567184/install.rdf +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - bug567184@tests.mozilla.org - 1.0 - true - - - Bug 567184 Test - Test Description - - - - xpcshell@tests.mozilla.org - undefined - undefined - - - - - diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug567184.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug567184.js deleted file mode 100644 index d983fa2db70f..000000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug567184.js +++ /dev/null @@ -1,53 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -function run_test() { - do_test_pending(); - createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); - - startupManager(); - - run_test_1(); -} - -// Tests that installing doesn't require a restart -function run_test_1() { - prepare_test({ }, [ - "onNewInstall" - ]); - - AddonManager.getInstallForFile(do_get_addon("test_bug567184"), function(install) { - ensure_test_completed(); - - Assert.notEqual(install, null); - - prepare_test({ - "bug567184@tests.mozilla.org": [ - ["onInstalling", false], - "onInstalled" - ] - }, [ - "onInstallStarted", - "onInstallEnded", - ], check_test_1); - install.install(); - }); -} - -function check_test_1() { - AddonManager.getAllInstalls(function(installs) { - // There should be no active installs now since the install completed and - // doesn't require a restart. - Assert.equal(installs.length, 0); - - AddonManager.getAddonByID("bug567184@tests.mozilla.org", function(b1) { - Assert.notEqual(b1, null); - Assert.ok(b1.appDisabled); - Assert.ok(!b1.userDisabled); - Assert.ok(!b1.isActive); - - executeSoon(do_test_finished); - }); - }); -} diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index 1afb72bcd339..27f2fb8919cc 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -79,7 +79,6 @@ skip-if = true # Bug 1358846 Bug 1365021 Bug 676992 [test_bug1180901_2.js] skip-if = os != "win" [test_bug566626.js] -[test_bug567184.js] [test_bug569138.js] [test_bug570173.js] [test_bug587088.js] From 7a58de4d7757b7dd33747d51ee0c5d1711760376 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 16:34:48 -0700 Subject: [PATCH 72/88] Bug 1449255: Part 21 - Remove test_bug569138.js, which is covered by other tests. r=aswan MozReview-Commit-ID: JP8siEbMwS7 --HG-- extra : rebase_source : ad6c7b1d604b19fa610197eafb510e0bc3c0016c --- .../test/xpcshell/test_bug569138.js | 154 ------------------ .../extensions/test/xpcshell/xpcshell.ini | 1 - 2 files changed, 155 deletions(-) delete mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_bug569138.js diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug569138.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug569138.js deleted file mode 100644 index 99f5633062f7..000000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug569138.js +++ /dev/null @@ -1,154 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -// This verifies that add-ons with invalid target application entries show -// up in the API but are correctly appDisabled - -// A working add-on -var addon1 = { - id: "addon1@tests.mozilla.org", - version: "1.0", - name: "Test 1", - bootstrap: true, - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "1" - }] -}; - -// Missing id -var addon2 = { - id: "addon2@tests.mozilla.org", - version: "1.0", - name: "Test 2", - bootstrap: true, - targetApplications: [{ - minVersion: "1", - maxVersion: "2" - }] -}; - -// Missing minVersion -var addon3 = { - id: "addon3@tests.mozilla.org", - version: "1.0", - name: "Test 3", - bootstrap: true, - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - maxVersion: "1" - }] -}; - -// Missing maxVersion -var addon4 = { - id: "addon4@tests.mozilla.org", - version: "1.0", - name: "Test 4", - bootstrap: true, - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1" - }] -}; - -// Blank id -var addon5 = { - id: "addon5@tests.mozilla.org", - version: "1.0", - name: "Test 5", - bootstrap: true, - targetApplications: [{ - id: "", - minVersion: "1", - maxVersion: "2" - }] -}; - -// Blank minVersion -var addon6 = { - id: "addon6@tests.mozilla.org", - version: "1.0", - name: "Test 6", - bootstrap: true, - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "", - maxVersion: "1" - }] -}; - -// Blank maxVersion -var addon7 = { - id: "addon7@tests.mozilla.org", - version: "1.0", - name: "Test 7", - bootstrap: true, - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "" - }] -}; - -createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); - -const profileDir = gProfD.clone(); -profileDir.append("extensions"); - -// Set up the profile -function run_test() { - do_test_pending(); - - writeInstallRDFForExtension(addon1, profileDir); - writeInstallRDFForExtension(addon2, profileDir); - writeInstallRDFForExtension(addon3, profileDir); - writeInstallRDFForExtension(addon4, profileDir); - writeInstallRDFForExtension(addon5, profileDir); - writeInstallRDFForExtension(addon6, profileDir); - writeInstallRDFForExtension(addon7, profileDir); - - startupManager(); - - AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", - "addon2@tests.mozilla.org", - "addon3@tests.mozilla.org", - "addon4@tests.mozilla.org", - "addon5@tests.mozilla.org", - "addon6@tests.mozilla.org", - "addon7@tests.mozilla.org"], - function([a1, a2, a3, a4, a5, a6, a7]) { - Assert.notEqual(a1, null); - Assert.ok(!a1.appDisabled); - Assert.ok(a1.isActive); - - Assert.notEqual(a2, null); - Assert.ok(a2.appDisabled); - Assert.ok(!a2.isActive); - - Assert.notEqual(a3, null); - Assert.ok(a3.appDisabled); - Assert.ok(!a3.isActive); - - Assert.notEqual(a4, null); - Assert.ok(a4.appDisabled); - Assert.ok(!a4.isActive); - - Assert.notEqual(a5, null); - Assert.ok(a5.appDisabled); - Assert.ok(!a5.isActive); - - Assert.notEqual(a6, null); - Assert.ok(a6.appDisabled); - Assert.ok(!a6.isActive); - - Assert.notEqual(a6, null); - Assert.ok(a6.appDisabled); - Assert.ok(!a6.isActive); - - executeSoon(do_test_finished); - - }); -} diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index 27f2fb8919cc..38730f272e47 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -79,7 +79,6 @@ skip-if = true # Bug 1358846 Bug 1365021 Bug 676992 [test_bug1180901_2.js] skip-if = os != "win" [test_bug566626.js] -[test_bug569138.js] [test_bug570173.js] [test_bug587088.js] skip-if = os == "win" # Bug 1358846 From 38e3f67780b7bc39c9fa0cb579e8f89d92787c94 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 16:39:26 -0700 Subject: [PATCH 73/88] Bug 1449255: Part 22 - Rename test_bug570173 to test_updatecheck_errors.js and modernize. r=aswan MozReview-Commit-ID: 2sN8JzFdEfy --HG-- rename : toolkit/mozapps/extensions/test/xpcshell/test_bug570173.js => toolkit/mozapps/extensions/test/xpcshell/test_updatecheck_errors.js extra : rebase_source : 9a49fc5ced9c8813cc4fa672aa67cdc63d58d4cf --- .../test/xpcshell/test_bug570173.js | 61 ------------------- .../test/xpcshell/test_updatecheck_errors.js | 52 ++++++++++++++++ .../extensions/test/xpcshell/xpcshell.ini | 2 +- 3 files changed, 53 insertions(+), 62 deletions(-) delete mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_bug570173.js create mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_updatecheck_errors.js diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug570173.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug570173.js deleted file mode 100644 index c6e258c061f6..000000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug570173.js +++ /dev/null @@ -1,61 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -// This verifies that add-on update check failures are propagated correctly - -// The test extension uses an insecure update url. -Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false); - -var testserver; -const profileDir = gProfD.clone(); -profileDir.append("extensions"); - -function run_test() { - createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); - - // Create and configure the HTTP server. - testserver = createHttpServer(); - testserver.registerDirectory("/data/", do_get_file("data")); - testserver.registerDirectory("/addons/", do_get_file("addons")); - gPort = testserver.identity.primaryPort; - - run_next_test(); -} - -// Verify that an update check returns the correct errors. -add_task(async function() { - for (let manifestType of ["rdf", "json"]) { - writeInstallRDFForExtension({ - id: "addon1@tests.mozilla.org", - version: "1.0", - updateURL: `http://localhost:${gPort}/data/test_missing.${manifestType}`, - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "1" - }], - name: "Test Addon 1", - bootstrap: "true", - }, profileDir); - - await promiseRestartManager(); - - let addon = await promiseAddonByID("addon1@tests.mozilla.org"); - - ok(addon); - ok(addon.updateURL.endsWith(manifestType)); - equal(addon.version, "1.0"); - - // We're expecting an error, so resolve when the promise is rejected. - let update = await promiseFindAddonUpdates(addon, AddonManager.UPDATE_WHEN_USER_REQUESTED) - .catch(e => e); - - ok(!update.compatibilityUpdate, "not expecting a compatibility update"); - ok(!update.updateAvailable, "not expecting a compatibility update"); - - equal(update.error, AddonManager.UPDATE_STATUS_DOWNLOAD_ERROR); - - addon.uninstall(); - } -}); diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_updatecheck_errors.js b/toolkit/mozapps/extensions/test/xpcshell/test_updatecheck_errors.js new file mode 100644 index 000000000000..0f406eddfc9b --- /dev/null +++ b/toolkit/mozapps/extensions/test/xpcshell/test_updatecheck_errors.js @@ -0,0 +1,52 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +// This verifies that add-on update check failures are propagated correctly + +// The test extension uses an insecure update url. +Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false); + +var testserver; +const profileDir = gProfD.clone(); +profileDir.append("extensions"); + +add_task(async function setup() { + createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); + + // Create and configure the HTTP server. + testserver = AddonTestUtils.createHttpServer({hosts: ["example.com"]}); + testserver.registerDirectory("/data/", do_get_file("data")); + testserver.registerDirectory("/addons/", do_get_file("addons")); + + await promiseStartupManager(); +}); + +// Verify that an update check returns the correct errors. +add_task(async function() { + let {addon} = await promiseInstallXPI({ + id: "addon1@tests.mozilla.org", + version: "1.0", + updateURL: `http://example.com/data/test_missing.json`, + targetApplications: [{ + id: "xpcshell@tests.mozilla.org", + minVersion: "1", + maxVersion: "1" + }], + name: "Test Addon 1", + bootstrap: "true", + }); + + equal(addon.version, "1.0"); + + // We're expecting an error, so resolve when the promise is rejected. + let update = await promiseFindAddonUpdates(addon, AddonManager.UPDATE_WHEN_USER_REQUESTED) + .catch(e => e); + + ok(!update.compatibilityUpdate, "not expecting a compatibility update"); + ok(!update.updateAvailable, "not expecting a compatibility update"); + + equal(update.error, AddonManager.UPDATE_STATUS_DOWNLOAD_ERROR); + + addon.uninstall(); +}); diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index 38730f272e47..b3bcbdd194c5 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -79,7 +79,6 @@ skip-if = true # Bug 1358846 Bug 1365021 Bug 676992 [test_bug1180901_2.js] skip-if = os != "win" [test_bug566626.js] -[test_bug570173.js] [test_bug587088.js] skip-if = os == "win" # Bug 1358846 [test_bug595081.js] @@ -267,6 +266,7 @@ tags = webextensions [test_updatecheck.js] # Bug 676992: test consistently hangs on Android skip-if = os == "android" +[test_updatecheck_errors.js] [test_updateid.js] # Bug 676992: test consistently hangs on Android skip-if = os == "android" From 97306571ac27f97a0ce7107d4e39b22a7299b43b Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 16:47:59 -0700 Subject: [PATCH 74/88] Bug 1449255: Part 23 - Remove test_bug587088.js, which has been disabled for a long time. r=aswan MozReview-Commit-ID: K6uwZfbw6ta --HG-- extra : rebase_source : 6bd732e7ebf961156a1520dfcc5a599ee15d02f0 --- .../test/addons/test_bug587088_1/install.rdf | 22 --- .../test/addons/test_bug587088_1/testfile | 1 - .../test/addons/test_bug587088_1/testfile1 | 0 .../test/addons/test_bug587088_2/install.rdf | 22 --- .../test/addons/test_bug587088_2/testfile | 1 - .../test/addons/test_bug587088_2/testfile2 | 0 .../test/xpcshell/test_bug587088.js | 170 ++++++++++-------- .../extensions/test/xpcshell/xpcshell.ini | 2 - 8 files changed, 95 insertions(+), 123 deletions(-) delete mode 100644 toolkit/mozapps/extensions/test/addons/test_bug587088_1/install.rdf delete mode 100644 toolkit/mozapps/extensions/test/addons/test_bug587088_1/testfile delete mode 100644 toolkit/mozapps/extensions/test/addons/test_bug587088_1/testfile1 delete mode 100644 toolkit/mozapps/extensions/test/addons/test_bug587088_2/install.rdf delete mode 100644 toolkit/mozapps/extensions/test/addons/test_bug587088_2/testfile delete mode 100644 toolkit/mozapps/extensions/test/addons/test_bug587088_2/testfile2 diff --git a/toolkit/mozapps/extensions/test/addons/test_bug587088_1/install.rdf b/toolkit/mozapps/extensions/test/addons/test_bug587088_1/install.rdf deleted file mode 100644 index 83220ce067e6..000000000000 --- a/toolkit/mozapps/extensions/test/addons/test_bug587088_1/install.rdf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - addon1@tests.mozilla.org - 1.0 - - - Bug 587088 Test - - - - xpcshell@tests.mozilla.org - 1 - 1 - - - - - diff --git a/toolkit/mozapps/extensions/test/addons/test_bug587088_1/testfile b/toolkit/mozapps/extensions/test/addons/test_bug587088_1/testfile deleted file mode 100644 index d2277257f5e4..000000000000 --- a/toolkit/mozapps/extensions/test/addons/test_bug587088_1/testfile +++ /dev/null @@ -1 +0,0 @@ -Contents of add-on version 1 diff --git a/toolkit/mozapps/extensions/test/addons/test_bug587088_1/testfile1 b/toolkit/mozapps/extensions/test/addons/test_bug587088_1/testfile1 deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/toolkit/mozapps/extensions/test/addons/test_bug587088_2/install.rdf b/toolkit/mozapps/extensions/test/addons/test_bug587088_2/install.rdf deleted file mode 100644 index ba23ab802e4c..000000000000 --- a/toolkit/mozapps/extensions/test/addons/test_bug587088_2/install.rdf +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - addon1@tests.mozilla.org - 2.0 - - - Bug 587088 Test - - - - xpcshell@tests.mozilla.org - 1 - 1 - - - - - diff --git a/toolkit/mozapps/extensions/test/addons/test_bug587088_2/testfile b/toolkit/mozapps/extensions/test/addons/test_bug587088_2/testfile deleted file mode 100644 index 07afddfa7f9c..000000000000 --- a/toolkit/mozapps/extensions/test/addons/test_bug587088_2/testfile +++ /dev/null @@ -1 +0,0 @@ -Contents of add-on version 2 diff --git a/toolkit/mozapps/extensions/test/addons/test_bug587088_2/testfile2 b/toolkit/mozapps/extensions/test/addons/test_bug587088_2/testfile2 deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug587088.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug587088.js index 4ae2f0c258ea..f25d012bd287 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug587088.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug587088.js @@ -8,17 +8,50 @@ const profileDir = gProfD.clone(); profileDir.append("extensions"); -function run_test() { +const ADDONS = [ + { + "install.rdf": { + "id": "addon1@tests.mozilla.org", + "version": "1.0", + "name": "Bug 587088 Test", + "targetApplications": [ + { + "id": "xpcshell@tests.mozilla.org", + "minVersion": "1", + "maxVersion": "1" + } + ] + }, + "testfile": "", + "testfile1": "", + }, + + { + "install.rdf": { + "id": "addon1@tests.mozilla.org", + "version": "2.0", + "name": "Bug 587088 Test", + "targetApplications": [ + { + "id": "xpcshell@tests.mozilla.org", + "minVersion": "1", + "maxVersion": "1" + } + ] + }, + "testfile": "", + "testfile2": "", + }, +]; + +add_task(async function setup() { // This is only an issue on windows. if (!("nsIWindowsRegKey" in Ci)) return; do_test_pending(); createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); - - startupManager(); - run_test_1(); -} +}); function check_addon(aAddon, aVersion) { Assert.notEqual(aAddon, null); @@ -72,101 +105,88 @@ function check_addon_uninstalling(aAddon, aAfterRestart) { Assert.equal(aAddon.pendingOperations, AddonManager.PENDING_UNINSTALL); } -function run_test_1() { - installAllFiles([do_get_addon("test_bug587088_1")], function() { - restartManager(); +add_task(async function test_1() { + await AddonTestUtils.promiseInstallXPI(ADDONS[0]); - AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) { - check_addon(a1, "1.0"); + await promiseRestartManager(); - // Lock either install.rdf for unpacked add-ons or the xpi for packed add-ons. - let uri = a1.getResourceURI("install.rdf"); - if (uri.schemeIs("jar")) - uri = a1.getResourceURI(); + let a1 = await AddonManager.getAddonByID("addon1@tests.mozilla.org"); + check_addon(a1, "1.0"); - let fstream = Cc["@mozilla.org/network/file-input-stream;1"]. - createInstance(Ci.nsIFileInputStream); - fstream.init(uri.QueryInterface(Ci.nsIFileURL).file, -1, 0, 0); + // Lock either install.rdf for unpacked add-ons or the xpi for packed add-ons. + let uri = a1.getResourceURI("install.rdf"); + if (uri.schemeIs("jar")) + uri = a1.getResourceURI(); - installAllFiles([do_get_addon("test_bug587088_2")], function() { + let fstream = Cc["@mozilla.org/network/file-input-stream;1"]. + createInstance(Ci.nsIFileInputStream); + fstream.init(uri.QueryInterface(Ci.nsIFileURL).file, -1, 0, 0); - check_addon_upgrading(a1); + await AddonTestUtils.promiseInstallXPI(ADDONS[1]); - restartManager(); + check_addon_upgrading(a1); - AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(function(a1_2) { - check_addon_upgrading(a1_2); + await promiseRestartManager(); - restartManager(); + let a1_2 = await AddonManager.getAddonByID("addon1@tests.mozilla.org"); + check_addon_upgrading(a1_2); - AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(function(a1_3) { - check_addon_upgrading(a1_3); + await promiseRestartManager(); - fstream.close(); + let a1_3 = await AddonManager.getAddonByID("addon1@tests.mozilla.org"); + check_addon_upgrading(a1_3); - restartManager(); + fstream.close(); - AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1_4) { - check_addon(a1_4, "2.0"); + await promiseRestartManager(); - a1_4.uninstall(); - executeSoon(run_test_2); - }); - })); - })); - }); - }); - }); -} + let a1_4 = await AddonManager.getAddonByID("addon1@tests.mozilla.org"); + check_addon(a1_4, "2.0"); + + a1_4.uninstall(); +}); // Test that a failed uninstall gets rolled back -function run_test_2() { - restartManager(); +add_task(async function test_2() { + await promiseRestartManager(); - installAllFiles([do_get_addon("test_bug587088_1")], async function() { - await promiseRestartManager(); + await AddonTestUtils.promiseInstallXPI(ADDONS[0]); + await promiseRestartManager(); - AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(async function(a1) { - check_addon(a1, "1.0"); + let a1 = await AddonManager.getAddonByID("addon1@tests.mozilla.org"); + check_addon(a1, "1.0"); - // Lock either install.rdf for unpacked add-ons or the xpi for packed add-ons. - let uri = a1.getResourceURI("install.rdf"); - if (uri.schemeIs("jar")) - uri = a1.getResourceURI(); + // Lock either install.rdf for unpacked add-ons or the xpi for packed add-ons. + let uri = a1.getResourceURI("install.rdf"); + if (uri.schemeIs("jar")) + uri = a1.getResourceURI(); - let fstream = Cc["@mozilla.org/network/file-input-stream;1"]. - createInstance(Ci.nsIFileInputStream); - fstream.init(uri.QueryInterface(Ci.nsIFileURL).file, -1, 0, 0); + let fstream = Cc["@mozilla.org/network/file-input-stream;1"]. + createInstance(Ci.nsIFileInputStream); + fstream.init(uri.QueryInterface(Ci.nsIFileURL).file, -1, 0, 0); - a1.uninstall(); + a1.uninstall(); - check_addon_uninstalling(a1); + check_addon_uninstalling(a1); - await promiseRestartManager(); + await promiseRestartManager(); - AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(async function(a1_2) { - check_addon_uninstalling(a1_2, true); + let a1_2 = await AddonManager.getAddonByID("addon1@tests.mozilla.org"); + check_addon_uninstalling(a1_2, true); - await promiseRestartManager(); + await promiseRestartManager(); - AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(async function(a1_3) { - check_addon_uninstalling(a1_3, true); + let a1_3 = await AddonManager.getAddonByID("addon1@tests.mozilla.org"); + check_addon_uninstalling(a1_3, true); - fstream.close(); + fstream.close(); - await promiseRestartManager(); + await promiseRestartManager(); - AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1_4) { - Assert.equal(a1_4, null); - var dir = profileDir.clone(); - dir.append(do_get_expected_addon_name("addon1@tests.mozilla.org")); - Assert.ok(!dir.exists()); - Assert.ok(!isExtensionInAddonsList(profileDir, "addon1@tests.mozilla.org")); - - executeSoon(do_test_finished); - }); - })); - })); - })); - }); -} + let a1_4 = await AddonManager.getAddonByID("addon1@tests.mozilla.org"); + Assert.equal(a1_4, null); + var dir = profileDir.clone(); + dir.append(do_get_expected_addon_name("addon1@tests.mozilla.org")); + Assert.ok(!dir.exists()); + Assert.ok(!isExtensionInAddonsList(profileDir, "addon1@tests.mozilla.org")); +}); diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index b3bcbdd194c5..e196a3a2127c 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -79,8 +79,6 @@ skip-if = true # Bug 1358846 Bug 1365021 Bug 676992 [test_bug1180901_2.js] skip-if = os != "win" [test_bug566626.js] -[test_bug587088.js] -skip-if = os == "win" # Bug 1358846 [test_bug595081.js] [test_bug596607.js] [test_cache_certdb.js] From 4fb58d87de3825d7b9bd67f2c47acc39b1dbef45 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 16:48:45 -0700 Subject: [PATCH 75/88] Bug 1449255: Part 24 - Remove test_bug595081.js, which doesn't matter anymore. r=aswan MozReview-Commit-ID: 7eapcbqSwXs --HG-- extra : rebase_source : 1a5e52637da729585f49c6937a67dc52921b5a61 --- .../test/xpcshell/test_bug595081.js | 27 ------------------- .../extensions/test/xpcshell/xpcshell.ini | 1 - 2 files changed, 28 deletions(-) delete mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_bug595081.js diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug595081.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug595081.js deleted file mode 100644 index 2587ba1c45da..000000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug595081.js +++ /dev/null @@ -1,27 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -// Tests that the AddonManager objects cannot be tampered with - -function run_test() { - // Setup for test - createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); - - startupManager(); - - // Verify that properties cannot be changed - let old = AddonManager.STATE_AVAILABLE; - AddonManager.STATE_AVAILABLE = 28; - Assert.equal(AddonManager.STATE_AVAILABLE, old); - - // Verify that functions cannot be replaced - AddonManager.isInstallEnabled = function() { - do_throw("Should not be able to replace a function"); - }; - AddonManager.isInstallEnabled("application/x-xpinstall"); - - // Verify that properties cannot be added - AddonManager.foo = "bar"; - Assert.equal(false, "foo" in AddonManager); -} diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index e196a3a2127c..3cf97a88a81c 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -79,7 +79,6 @@ skip-if = true # Bug 1358846 Bug 1365021 Bug 676992 [test_bug1180901_2.js] skip-if = os != "win" [test_bug566626.js] -[test_bug595081.js] [test_bug596607.js] [test_cache_certdb.js] run-if = addon_signing From b8bf08784df71e0c09554c426cd3cf3300eba795 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 16:54:01 -0700 Subject: [PATCH 76/88] Bug 1449255: Part 25 - Fold test_bug596607 into test_registry.js. r=aswan MozReview-Commit-ID: KK6zpHmKlWS --HG-- extra : rebase_source : e5dcda26fd4ccdd71487596bea681f6016ba6f6a --- .../test/xpcshell/test_bug596607.js | 149 ------------------ .../extensions/test/xpcshell/test_registry.js | 116 +++++++------- .../extensions/test/xpcshell/xpcshell.ini | 2 +- 3 files changed, 59 insertions(+), 208 deletions(-) delete mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_bug596607.js diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug596607.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug596607.js deleted file mode 100644 index cd4cf8d4bfc1..000000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug596607.js +++ /dev/null @@ -1,149 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -// Tests that a reference to a non-existent extension in the registry doesn't -// break things -createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); - -// Enable loading extensions from the user and system scopes -Services.prefs.setIntPref("extensions.enabledScopes", - AddonManager.SCOPE_PROFILE + AddonManager.SCOPE_USER + - AddonManager.SCOPE_SYSTEM); - -var addon1 = { - id: "addon1@tests.mozilla.org", - version: "1.0", - name: "Test 1", - bootstrap: true, - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "1" - }] -}; - -var addon2 = { - id: "addon2@tests.mozilla.org", - version: "2.0", - name: "Test 2", - bootstrap: true, - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "2" - }] -}; - -const addon1Dir = writeInstallRDFForExtension(addon1, gProfD, "addon1"); -const addon2Dir = writeInstallRDFForExtension(addon2, gProfD, "addon2"); -const addon3Dir = gProfD.clone(); -addon3Dir.append("addon3@tests.mozilla.org"); - -let registry; - -function run_test() { - // This test only works where there is a registry. - if (!("nsIWindowsRegKey" in Ci)) - return; - - registry = new MockRegistry(); - registerCleanupFunction(() => { - registry.shutdown(); - }); - - do_test_pending(); - - run_test_1(); -} - -// Tests whether starting a fresh profile with a bad entry works -function run_test_1() { - registry.setValue(Ci.nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE, - "SOFTWARE\\Mozilla\\XPCShell\\Extensions", - "addon1@tests.mozilla.org", addon1Dir.path); - registry.setValue(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER, - "SOFTWARE\\Mozilla\\XPCShell\\Extensions", - "addon2@tests.mozilla.org", addon2Dir.path); - registry.setValue(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER, - "SOFTWARE\\Mozilla\\XPCShell\\Extensions", - "addon3@tests.mozilla.org", addon3Dir.path); - - startupManager(); - - AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", - "addon2@tests.mozilla.org", - "addon3@tests.mozilla.org"], function([a1, a2, a3]) { - Assert.notEqual(a1, null); - Assert.ok(a1.isActive); - Assert.ok(!hasFlag(a1.permissions, AddonManager.PERM_CAN_UNINSTALL)); - Assert.equal(a1.scope, AddonManager.SCOPE_SYSTEM); - - Assert.notEqual(a2, null); - Assert.ok(a2.isActive); - Assert.ok(!hasFlag(a2.permissions, AddonManager.PERM_CAN_UNINSTALL)); - Assert.equal(a2.scope, AddonManager.SCOPE_USER); - - Assert.equal(a3, null); - - executeSoon(run_test_2); - }); -} - -// Tests whether removing the bad entry has any effect -function run_test_2() { - shutdownManager(); - - registry.setValue(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER, - "SOFTWARE\\Mozilla\\XPCShell\\Extensions", - "addon3@tests.mozilla.org", addon3Dir.path); - - startupManager(false); - - AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", - "addon2@tests.mozilla.org", - "addon3@tests.mozilla.org"], function([a1, a2, a3]) { - Assert.notEqual(a1, null); - Assert.ok(a1.isActive); - Assert.ok(!hasFlag(a1.permissions, AddonManager.PERM_CAN_UNINSTALL)); - Assert.equal(a1.scope, AddonManager.SCOPE_SYSTEM); - - Assert.notEqual(a2, null); - Assert.ok(a2.isActive); - Assert.ok(!hasFlag(a2.permissions, AddonManager.PERM_CAN_UNINSTALL)); - Assert.equal(a2.scope, AddonManager.SCOPE_USER); - - Assert.equal(a3, null); - - executeSoon(run_test_3); - }); -} - -// Tests adding the bad entry to an existing profile has any effect -function run_test_3() { - shutdownManager(); - - registry.setValue(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER, - "SOFTWARE\\Mozilla\\XPCShell\\Extensions", - "addon3@tests.mozilla.org", null); - - startupManager(false); - - AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", - "addon2@tests.mozilla.org", - "addon3@tests.mozilla.org"], function([a1, a2, a3]) { - Assert.notEqual(a1, null); - Assert.ok(a1.isActive); - Assert.ok(!hasFlag(a1.permissions, AddonManager.PERM_CAN_UNINSTALL)); - Assert.equal(a1.scope, AddonManager.SCOPE_SYSTEM); - - Assert.notEqual(a2, null); - Assert.ok(a2.isActive); - Assert.ok(!hasFlag(a2.permissions, AddonManager.PERM_CAN_UNINSTALL)); - Assert.equal(a2.scope, AddonManager.SCOPE_USER); - - Assert.equal(a3, null); - - executeSoon(do_test_finished); - }); -} diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_registry.js b/toolkit/mozapps/extensions/test/xpcshell/test_registry.js index d9b6705a3c62..403074fafb79 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_registry.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_registry.js @@ -34,97 +34,97 @@ var addon2 = { }] }; +const IDS = ["addon1@tests.mozilla.org", + "addon2@tests.mozilla.org", + "addon3@tests.mozilla.org"]; + + const addon1Dir = writeInstallRDFForExtension(addon1, gProfD, "addon1"); const addon2Dir = writeInstallRDFForExtension(addon2, gProfD, "addon2"); +const addon3Dir = gProfD.clone(); +addon3Dir.append("addon3@tests.mozilla.org"); let registry; -function run_test() { - // This test only works where there is a registry. - if (!("nsIWindowsRegKey" in Ci)) - return; - +add_task(async function setup() { registry = new MockRegistry(); registerCleanupFunction(() => { registry.shutdown(); }); - - do_test_pending(); - - run_test_1(); -} +}); // Tests whether basic registry install works -function run_test_1() { +add_task(async function test_1() { registry.setValue(Ci.nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE, "SOFTWARE\\Mozilla\\XPCShell\\Extensions", "addon1@tests.mozilla.org", addon1Dir.path); registry.setValue(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER, "SOFTWARE\\Mozilla\\XPCShell\\Extensions", "addon2@tests.mozilla.org", addon2Dir.path); + registry.setValue(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER, + "SOFTWARE\\Mozilla\\XPCShell\\Extensions", + "addon3@tests.mozilla.org", addon3Dir.path); - startupManager(); + await promiseStartupManager(); - AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", - "addon2@tests.mozilla.org"], function([a1, a2]) { - Assert.notEqual(a1, null); - Assert.ok(a1.isActive); - Assert.ok(!hasFlag(a1.permissions, AddonManager.PERM_CAN_UNINSTALL)); - Assert.equal(a1.scope, AddonManager.SCOPE_SYSTEM); + let [a1, a2, a3] = await AddonManager.getAddonsByIDs(IDS); + notEqual(a1, null); + ok(a1.isActive); + ok(!hasFlag(a1.permissions, AddonManager.PERM_CAN_UNINSTALL)); + equal(a1.scope, AddonManager.SCOPE_SYSTEM); - Assert.notEqual(a2, null); - Assert.ok(a2.isActive); - Assert.ok(!hasFlag(a2.permissions, AddonManager.PERM_CAN_UNINSTALL)); - Assert.equal(a2.scope, AddonManager.SCOPE_USER); + notEqual(a2, null); + ok(a2.isActive); + ok(!hasFlag(a2.permissions, AddonManager.PERM_CAN_UNINSTALL)); + equal(a2.scope, AddonManager.SCOPE_USER); - executeSoon(run_test_2); - }); -} + equal(a3, null); +}); // Tests whether uninstalling from the registry works -function run_test_2() { +add_task(async function test_2() { registry.setValue(Ci.nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE, "SOFTWARE\\Mozilla\\XPCShell\\Extensions", "addon1@tests.mozilla.org", null); registry.setValue(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER, "SOFTWARE\\Mozilla\\XPCShell\\Extensions", "addon2@tests.mozilla.org", null); + registry.setValue(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER, + "SOFTWARE\\Mozilla\\XPCShell\\Extensions", + "addon3@tests.mozilla.org", null); - restartManager(); + await promiseRestartManager(); - AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", - "addon2@tests.mozilla.org"], function([a1, a2]) { - Assert.equal(a1, null); - Assert.equal(a2, null); - - executeSoon(run_test_3); - }); -} + let [a1, a2, a3] = await AddonManager.getAddonsByIDs(IDS); + equal(a1, null); + equal(a2, null); + equal(a3, null); +}); // Checks that the ID in the registry must match that in the install manifest -function run_test_3() { +add_task(async function test_3() { registry.setValue(Ci.nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE, "SOFTWARE\\Mozilla\\XPCShell\\Extensions", "addon1@tests.mozilla.org", addon2Dir.path); registry.setValue(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER, "SOFTWARE\\Mozilla\\XPCShell\\Extensions", "addon2@tests.mozilla.org", addon1Dir.path); + registry.setValue(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER, + "SOFTWARE\\Mozilla\\XPCShell\\Extensions", + "addon3@tests.mozilla.org", addon3Dir.path); - restartManager(); + await promiseRestartManager(); - AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", - "addon2@tests.mozilla.org"], function([a1, a2]) { - Assert.equal(a1, null); - Assert.equal(a2, null); - - executeSoon(run_test_4); - }); -} + let [a1, a2, a3] = await AddonManager.getAddonsByIDs(IDS); + equal(a1, null); + equal(a2, null); + equal(a3, null); +}); // Tests whether an extension's ID can change without its directory changing -function run_test_4() { +add_task(async function test_4() { // Restarting with bad items in the registry should not force an EM restart - restartManager(); + await promiseRestartManager(); registry.setValue(Ci.nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE, "SOFTWARE\\Mozilla\\XPCShell\\Extensions", @@ -132,13 +132,16 @@ function run_test_4() { registry.setValue(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER, "SOFTWARE\\Mozilla\\XPCShell\\Extensions", "addon2@tests.mozilla.org", null); + registry.setValue(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER, + "SOFTWARE\\Mozilla\\XPCShell\\Extensions", + "addon3@tests.mozilla.org", null); - restartManager(); + await promiseRestartManager(); registry.setValue(Ci.nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE, "SOFTWARE\\Mozilla\\XPCShell\\Extensions", "addon1@tests.mozilla.org", addon1Dir.path); - restartManager(); + await promiseRestartManager(); registry.setValue(Ci.nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE, "SOFTWARE\\Mozilla\\XPCShell\\Extensions", @@ -148,13 +151,10 @@ function run_test_4() { "addon2@tests.mozilla.org", addon1Dir.path); writeInstallRDFForExtension(addon2, gProfD, "addon1"); - restartManager(); + await promiseRestartManager(); - AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", - "addon2@tests.mozilla.org"], function([a1, a2]) { - Assert.equal(a1, null); - Assert.notEqual(a2, null); - - executeSoon(do_test_finished); - }); -} + let [a1, a2, a3] = await AddonManager.getAddonsByIDs(IDS); + equal(a1, null); + notEqual(a2, null); + equal(a3, null); +}); diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index 3cf97a88a81c..d01b8a87f044 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -79,7 +79,6 @@ skip-if = true # Bug 1358846 Bug 1365021 Bug 676992 [test_bug1180901_2.js] skip-if = os != "win" [test_bug566626.js] -[test_bug596607.js] [test_cache_certdb.js] run-if = addon_signing [test_cacheflush.js] @@ -192,6 +191,7 @@ skip-if = os == "android" [test_proxy.js] [test_registerchrome.js] [test_registry.js] +skip-if = os != 'win' [test_reload.js] # Bug 676992: test consistently hangs on Android # There's a problem removing a temp file without manually clearing the cache on Windows From 57761d6598f2c2763b903ebbdacc58144b7cb86b Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 16:56:30 -0700 Subject: [PATCH 77/88] Bug 1449255: Part 26 - Rename test_bug1180901_2 to test_trash_directory.js. r=aswan MozReview-Commit-ID: JuQv3WQ1Hpt --HG-- rename : toolkit/mozapps/extensions/test/xpcshell/test_bug1180901_2.js => toolkit/mozapps/extensions/test/xpcshell/test_trash_directory.js extra : rebase_source : 097da7339f3bf1a7ba7fbc0a98e21ddb573da12a --- .../{test_bug1180901_2.js => test_trash_directory.js} | 7 +++---- toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) rename toolkit/mozapps/extensions/test/xpcshell/{test_bug1180901_2.js => test_trash_directory.js} (96%) diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug1180901_2.js b/toolkit/mozapps/extensions/test/xpcshell/test_trash_directory.js similarity index 96% rename from toolkit/mozapps/extensions/test/xpcshell/test_bug1180901_2.js rename to toolkit/mozapps/extensions/test/xpcshell/test_trash_directory.js index 733450007817..7265ac82f4f2 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug1180901_2.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_trash_directory.js @@ -2,11 +2,10 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -function run_test() { +add_task(async function setup() { createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); - startupManager(); - run_next_test(); -} + await promiseStartupManager(); +}); add_task(async function() { let profileDir = OS.Constants.Path.profileDir; diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index d01b8a87f044..e53e451dc2dd 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -76,8 +76,6 @@ skip-if = true # Bug 1358846 Bug 1365021 Bug 676992 [test_bootstrap_const.js] [test_bootstrap_globals.js] [test_bootstrapped_chrome_manifest.js] -[test_bug1180901_2.js] -skip-if = os != "win" [test_bug566626.js] [test_cache_certdb.js] run-if = addon_signing @@ -247,6 +245,8 @@ skip-if = appname == "thunderbird" [test_system_update_upgrades.js] [test_temporary.js] tags = webextensions +[test_trash_directory.js] +skip-if = os != "win" [test_types.js] [test_undouninstall.js] skip-if = os == "win" # Bug 1358846 From 8c623c8122af009eb124171b3b2bc0306c119b49 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 27 Mar 2018 16:58:05 -0700 Subject: [PATCH 78/88] Bug 1449255: Part 27 - Remove test_bug566626, which seems unnecessary. r=aswan MozReview-Commit-ID: CqChkPZpDUS --HG-- extra : rebase_source : 3a2a6bc619e90cf573bb17bcd8e14b0f3fb69061 --- .../test/xpcshell/test_bug566626.js | 113 ------------------ .../extensions/test/xpcshell/xpcshell.ini | 1 - 2 files changed, 114 deletions(-) delete mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_bug566626.js diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug566626.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug566626.js deleted file mode 100644 index 07b8ed45e136..000000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug566626.js +++ /dev/null @@ -1,113 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -// This verifies that multiple calls to the async API return fully formed -// add-ons - -var addon1 = { - id: "addon1@tests.mozilla.org", - version: "1.0", - name: "Test 1", - bootstrap: true, - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "1" - }] -}; - -const profileDir = gProfD.clone(); -profileDir.append("extensions"); - -var gAddon; - -// Sets up the profile by installing an add-on. -function run_test() { - do_test_pending(); - - createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); - - writeInstallRDFForExtension(addon1, profileDir); - - startupManager(); - - run_test_1(); -} - -// Verifies that multiple calls to get an add-on at various stages of execution -// return an add-on with a valid name. -function run_test_1() { - var count = 0; - - AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) { - Assert.notEqual(a1, null); - Assert.equal(a1.name, "Test 1"); - - if (count == 0) - gAddon = a1; - else - Assert.equal(a1, gAddon); - count++; - if (count == 4) - run_test_2(); - }); - - AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) { - Assert.notEqual(a1, null); - Assert.equal(a1.name, "Test 1"); - - if (count == 0) - gAddon = a1; - else - Assert.equal(a1, gAddon); - count++; - if (count == 4) - run_test_2(); - }); - - executeSoon(function() { - AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) { - Assert.notEqual(a1, null); - Assert.equal(a1.name, "Test 1"); - - if (count == 0) - gAddon = a1; - else - Assert.equal(a1, gAddon); - count++; - if (count == 4) - run_test_2(); - }); - }); - - executeSoon(function() { - executeSoon(function() { - AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) { - Assert.notEqual(a1, null); - Assert.equal(a1.name, "Test 1"); - - if (count == 0) - gAddon = a1; - else - Assert.equal(a1, gAddon); - count++; - if (count == 4) - run_test_2(); - }); - }); - }); -} - -// Verifies that a subsequent call gets the same add-on from the cache -function run_test_2() { - AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) { - Assert.notEqual(a1, null); - Assert.equal(a1.name, "Test 1"); - - Assert.equal(a1, gAddon); - - executeSoon(do_test_finished); - }); - -} diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index e53e451dc2dd..b1ebd0d8ca32 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -76,7 +76,6 @@ skip-if = true # Bug 1358846 Bug 1365021 Bug 676992 [test_bootstrap_const.js] [test_bootstrap_globals.js] [test_bootstrapped_chrome_manifest.js] -[test_bug566626.js] [test_cache_certdb.js] run-if = addon_signing [test_cacheflush.js] From 009c31f3fdeed79d2fbad0cf400ba1102eb9805e Mon Sep 17 00:00:00 2001 From: sotaro Date: Thu, 5 Apr 2018 11:07:54 +0900 Subject: [PATCH 79/88] Bug 1449086 - Always call WaitFlushed() in WebRenderBridgeParent::FlushRendering() r=kats --- gfx/layers/wr/WebRenderBridgeParent.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gfx/layers/wr/WebRenderBridgeParent.cpp b/gfx/layers/wr/WebRenderBridgeParent.cpp index 66bc1f570dd4..61874089f7fa 100644 --- a/gfx/layers/wr/WebRenderBridgeParent.cpp +++ b/gfx/layers/wr/WebRenderBridgeParent.cpp @@ -1318,9 +1318,9 @@ WebRenderBridgeParent::FlushRendering() } mForceRendering = true; - if (mCompositorScheduler->FlushPendingComposite()) { - mApi->WaitFlushed(); - } + mCompositorScheduler->FlushPendingComposite(); + // Always meed to wait flushed, since WebRender might have ongoing tasks. + mApi->WaitFlushed(); mForceRendering = false; } From 30c7ab35fe6dde16bf41fe3679056232a018097a Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 3 Apr 2018 10:55:33 +1000 Subject: [PATCH 80/88] Bug 1451169 - Change nsRoleMapEntry::roleAtom from `nsStaticAtom**` to `nsStaticAtom* const`. r=davidb And likewise for AttrCharacteristics::attributeName. MozReview-Commit-ID: DwGzWCCKcVP --HG-- extra : rebase_source : ac595af0b0da2cee36b5aecf4474880fbe993f11 --- accessible/base/ARIAMap.cpp | 304 ++++++++++---------- accessible/base/ARIAMap.h | 6 +- accessible/generic/Accessible.cpp | 5 +- accessible/ipc/ProxyAccessibleShared.h | 2 +- accessible/ipc/other/DocAccessibleChild.cpp | 2 +- accessible/ipc/other/ProxyAccessible.cpp | 2 +- accessible/mac/mozAccessible.mm | 4 +- 7 files changed, 163 insertions(+), 162 deletions(-) diff --git a/accessible/base/ARIAMap.cpp b/accessible/base/ARIAMap.cpp index 142d831089fa..598dc66db347 100644 --- a/accessible/base/ARIAMap.cpp +++ b/accessible/base/ARIAMap.cpp @@ -38,7 +38,7 @@ static const uint32_t kGenericAccType = 0; static const nsRoleMapEntry sWAIRoleMaps[] = { { // alert - &nsGkAtoms::alert, + nsGkAtoms::alert, roles::ALERT, kUseMapRole, eNoValue, @@ -48,7 +48,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // alertdialog - &nsGkAtoms::alertdialog, + nsGkAtoms::alertdialog, roles::DIALOG, kUseMapRole, eNoValue, @@ -58,7 +58,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // application - &nsGkAtoms::application, + nsGkAtoms::application, roles::APPLICATION, kUseMapRole, eNoValue, @@ -68,7 +68,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // article - &nsGkAtoms::article, + nsGkAtoms::article, roles::ARTICLE, kUseMapRole, eNoValue, @@ -79,7 +79,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eReadonlyUntilEditable }, { // banner - &nsGkAtoms::banner, + nsGkAtoms::banner, roles::NOTHING, kUseNativeRole, eNoValue, @@ -89,7 +89,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // button - &nsGkAtoms::button, + nsGkAtoms::button, roles::PUSHBUTTON, kUseMapRole, eNoValue, @@ -100,7 +100,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = // eARIAPressed is auto applied on any button }, { // cell - &nsGkAtoms::cell, + nsGkAtoms::cell, roles::CELL, kUseMapRole, eNoValue, @@ -110,7 +110,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // checkbox - &nsGkAtoms::checkbox, + nsGkAtoms::checkbox, roles::CHECKBUTTON, kUseMapRole, eNoValue, @@ -122,7 +122,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIAReadonly }, { // columnheader - &nsGkAtoms::columnheader, + nsGkAtoms::columnheader, roles::COLUMNHEADER, kUseMapRole, eNoValue, @@ -134,7 +134,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIAReadonlyOrEditableIfDefined }, { // combobox, which consists of text input and popup - &nsGkAtoms::combobox, + nsGkAtoms::combobox, roles::EDITCOMBOBOX, kUseMapRole, eNoValue, @@ -147,7 +147,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIAOrientation }, { // complementary - &nsGkAtoms::complementary, + nsGkAtoms::complementary, roles::NOTHING, kUseNativeRole, eNoValue, @@ -157,7 +157,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // contentinfo - &nsGkAtoms::contentinfo, + nsGkAtoms::contentinfo, roles::NOTHING, kUseNativeRole, eNoValue, @@ -167,7 +167,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // dialog - &nsGkAtoms::dialog, + nsGkAtoms::dialog, roles::DIALOG, kUseMapRole, eNoValue, @@ -177,7 +177,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // directory - &nsGkAtoms::directory, + nsGkAtoms::directory, roles::LIST, kUseMapRole, eNoValue, @@ -187,7 +187,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = states::READONLY }, { // doc-abstract - &nsGkAtoms::docAbstract, + nsGkAtoms::docAbstract, roles::SECTION, kUseMapRole, eNoValue, @@ -197,7 +197,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-acknowledgments - &nsGkAtoms::docAcknowledgments, + nsGkAtoms::docAcknowledgments, roles::LANDMARK, kUseMapRole, eNoValue, @@ -207,7 +207,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-afterword - &nsGkAtoms::docAfterword, + nsGkAtoms::docAfterword, roles::LANDMARK, kUseMapRole, eNoValue, @@ -217,7 +217,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-appendix - &nsGkAtoms::docAppendix, + nsGkAtoms::docAppendix, roles::LANDMARK, kUseMapRole, eNoValue, @@ -227,7 +227,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-backlink - &nsGkAtoms::docBacklink, + nsGkAtoms::docBacklink, roles::LINK, kUseMapRole, eNoValue, @@ -237,7 +237,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = states::LINKED }, { // doc-biblioentry - &nsGkAtoms::docBiblioentry, + nsGkAtoms::docBiblioentry, roles::LISTITEM, kUseMapRole, eNoValue, @@ -247,7 +247,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = states::READONLY }, { // doc-bibliography - &nsGkAtoms::docBibliography, + nsGkAtoms::docBibliography, roles::LANDMARK, kUseMapRole, eNoValue, @@ -257,7 +257,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-biblioref - &nsGkAtoms::docBiblioref, + nsGkAtoms::docBiblioref, roles::LINK, kUseMapRole, eNoValue, @@ -267,7 +267,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = states::LINKED }, { // doc-chapter - &nsGkAtoms::docChapter, + nsGkAtoms::docChapter, roles::LANDMARK, kUseMapRole, eNoValue, @@ -277,7 +277,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-colophon - &nsGkAtoms::docColophon, + nsGkAtoms::docColophon, roles::SECTION, kUseMapRole, eNoValue, @@ -287,7 +287,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-conclusion - &nsGkAtoms::docConclusion, + nsGkAtoms::docConclusion, roles::LANDMARK, kUseMapRole, eNoValue, @@ -297,7 +297,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-cover - &nsGkAtoms::docCover, + nsGkAtoms::docCover, roles::GRAPHIC, kUseMapRole, eNoValue, @@ -307,7 +307,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-credit - &nsGkAtoms::docCredit, + nsGkAtoms::docCredit, roles::SECTION, kUseMapRole, eNoValue, @@ -317,7 +317,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-credits - &nsGkAtoms::docCredits, + nsGkAtoms::docCredits, roles::LANDMARK, kUseMapRole, eNoValue, @@ -327,7 +327,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-dedication - &nsGkAtoms::docDedication, + nsGkAtoms::docDedication, roles::SECTION, kUseMapRole, eNoValue, @@ -337,7 +337,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-endnote - &nsGkAtoms::docEndnote, + nsGkAtoms::docEndnote, roles::LISTITEM, kUseMapRole, eNoValue, @@ -347,7 +347,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = states::READONLY }, { // doc-endnotes - &nsGkAtoms::docEndnotes, + nsGkAtoms::docEndnotes, roles::LANDMARK, kUseMapRole, eNoValue, @@ -357,7 +357,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-epigraph - &nsGkAtoms::docEpigraph, + nsGkAtoms::docEpigraph, roles::SECTION, kUseMapRole, eNoValue, @@ -367,7 +367,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-epilogue - &nsGkAtoms::docEpilogue, + nsGkAtoms::docEpilogue, roles::LANDMARK, kUseMapRole, eNoValue, @@ -377,7 +377,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-errata - &nsGkAtoms::docErrata, + nsGkAtoms::docErrata, roles::LANDMARK, kUseMapRole, eNoValue, @@ -387,7 +387,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-example - &nsGkAtoms::docExample, + nsGkAtoms::docExample, roles::SECTION, kUseMapRole, eNoValue, @@ -397,7 +397,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-footnote - &nsGkAtoms::docFootnote, + nsGkAtoms::docFootnote, roles::FOOTNOTE, kUseMapRole, eNoValue, @@ -407,7 +407,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-foreword - &nsGkAtoms::docForeword, + nsGkAtoms::docForeword, roles::LANDMARK, kUseMapRole, eNoValue, @@ -417,7 +417,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-glossary - &nsGkAtoms::docGlossary, + nsGkAtoms::docGlossary, roles::LANDMARK, kUseMapRole, eNoValue, @@ -427,7 +427,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-glossref - &nsGkAtoms::docGlossref, + nsGkAtoms::docGlossref, roles::LINK, kUseMapRole, eNoValue, @@ -437,7 +437,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = states::LINKED }, { // doc-index - &nsGkAtoms::docIndex, + nsGkAtoms::docIndex, roles::NAVIGATION, kUseMapRole, eNoValue, @@ -447,7 +447,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-introduction - &nsGkAtoms::docIntroduction, + nsGkAtoms::docIntroduction, roles::LANDMARK, kUseMapRole, eNoValue, @@ -457,7 +457,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-noteref - &nsGkAtoms::docNoteref, + nsGkAtoms::docNoteref, roles::LINK, kUseMapRole, eNoValue, @@ -467,7 +467,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = states::LINKED }, { // doc-notice - &nsGkAtoms::docNotice, + nsGkAtoms::docNotice, roles::NOTE, kUseMapRole, eNoValue, @@ -477,7 +477,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-pagebreak - &nsGkAtoms::docPagebreak, + nsGkAtoms::docPagebreak, roles::SEPARATOR, kUseMapRole, eNoValue, @@ -487,7 +487,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-pagelist - &nsGkAtoms::docPagelist, + nsGkAtoms::docPagelist, roles::NAVIGATION, kUseMapRole, eNoValue, @@ -497,7 +497,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-part - &nsGkAtoms::docPart, + nsGkAtoms::docPart, roles::LANDMARK, kUseMapRole, eNoValue, @@ -507,7 +507,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-preface - &nsGkAtoms::docPreface, + nsGkAtoms::docPreface, roles::LANDMARK, kUseMapRole, eNoValue, @@ -517,7 +517,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-prologue - &nsGkAtoms::docPrologue, + nsGkAtoms::docPrologue, roles::LANDMARK, kUseMapRole, eNoValue, @@ -527,7 +527,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-pullquote - &nsGkAtoms::docPullquote, + nsGkAtoms::docPullquote, roles::SECTION, kUseMapRole, eNoValue, @@ -537,7 +537,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-qna - &nsGkAtoms::docQna, + nsGkAtoms::docQna, roles::SECTION, kUseMapRole, eNoValue, @@ -547,7 +547,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-subtitle - &nsGkAtoms::docSubtitle, + nsGkAtoms::docSubtitle, roles::HEADING, kUseMapRole, eNoValue, @@ -557,7 +557,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-tip - &nsGkAtoms::docTip, + nsGkAtoms::docTip, roles::NOTE, kUseMapRole, eNoValue, @@ -567,7 +567,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // doc-toc - &nsGkAtoms::docToc, + nsGkAtoms::docToc, roles::NAVIGATION, kUseMapRole, eNoValue, @@ -577,7 +577,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // document - &nsGkAtoms::document, + nsGkAtoms::document, roles::NON_NATIVE_DOCUMENT, kUseMapRole, eNoValue, @@ -588,7 +588,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eReadonlyUntilEditable }, { // feed - &nsGkAtoms::feed, + nsGkAtoms::feed, roles::GROUPING, kUseMapRole, eNoValue, @@ -598,7 +598,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // figure - &nsGkAtoms::figure, + nsGkAtoms::figure, roles::FIGURE, kUseMapRole, eNoValue, @@ -608,7 +608,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // form - &nsGkAtoms::form, + nsGkAtoms::form, roles::FORM, kUseMapRole, eNoValue, @@ -618,7 +618,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // graphics-document - &nsGkAtoms::graphicsDocument, + nsGkAtoms::graphicsDocument, roles::NON_NATIVE_DOCUMENT, kUseMapRole, eNoValue, @@ -629,7 +629,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eReadonlyUntilEditable }, { // graphics-object - &nsGkAtoms::graphicsObject, + nsGkAtoms::graphicsObject, roles::GROUPING, kUseMapRole, eNoValue, @@ -639,7 +639,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // graphics-symbol - &nsGkAtoms::graphicsSymbol, + nsGkAtoms::graphicsSymbol, roles::GRAPHIC, kUseMapRole, eNoValue, @@ -649,7 +649,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // grid - &nsGkAtoms::grid, + nsGkAtoms::grid, roles::TABLE, kUseMapRole, eNoValue, @@ -662,7 +662,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eFocusableUntilDisabled }, { // gridcell - &nsGkAtoms::gridcell, + nsGkAtoms::gridcell, roles::GRID_CELL, kUseMapRole, eNoValue, @@ -674,7 +674,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIAReadonlyOrEditableIfDefined }, { // group - &nsGkAtoms::group, + nsGkAtoms::group, roles::GROUPING, kUseMapRole, eNoValue, @@ -684,7 +684,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // heading - &nsGkAtoms::heading, + nsGkAtoms::heading, roles::HEADING, kUseMapRole, eNoValue, @@ -694,7 +694,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // img - &nsGkAtoms::img, + nsGkAtoms::img, roles::GRAPHIC, kUseMapRole, eNoValue, @@ -704,7 +704,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // key - &nsGkAtoms::key, + nsGkAtoms::key, roles::KEY, kUseMapRole, eNoValue, @@ -715,7 +715,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIAPressed }, { // link - &nsGkAtoms::link, + nsGkAtoms::link, roles::LINK, kUseMapRole, eNoValue, @@ -725,7 +725,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = states::LINKED }, { // list - &nsGkAtoms::list_, + nsGkAtoms::list_, roles::LIST, kUseMapRole, eNoValue, @@ -735,7 +735,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = states::READONLY }, { // listbox - &nsGkAtoms::listbox, + nsGkAtoms::listbox, roles::LISTBOX, kUseMapRole, eNoValue, @@ -749,7 +749,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIAOrientation }, { // listitem - &nsGkAtoms::listitem, + nsGkAtoms::listitem, roles::LISTITEM, kUseMapRole, eNoValue, @@ -759,7 +759,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = states::READONLY }, { // log - &nsGkAtoms::log_, + nsGkAtoms::log_, roles::NOTHING, kUseNativeRole, eNoValue, @@ -769,7 +769,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // main - &nsGkAtoms::main, + nsGkAtoms::main, roles::NOTHING, kUseNativeRole, eNoValue, @@ -779,7 +779,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // marquee - &nsGkAtoms::marquee, + nsGkAtoms::marquee, roles::ANIMATION, kUseMapRole, eNoValue, @@ -789,7 +789,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // math - &nsGkAtoms::math, + nsGkAtoms::math, roles::FLAT_EQUATION, kUseMapRole, eNoValue, @@ -799,7 +799,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // menu - &nsGkAtoms::menu, + nsGkAtoms::menu, roles::MENUPOPUP, kUseMapRole, eNoValue, @@ -811,7 +811,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIAOrientation }, { // menubar - &nsGkAtoms::menubar, + nsGkAtoms::menubar, roles::MENUBAR, kUseMapRole, eNoValue, @@ -822,7 +822,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIAOrientation }, { // menuitem - &nsGkAtoms::menuitem, + nsGkAtoms::menuitem, roles::MENUITEM, kUseMapRole, eNoValue, @@ -832,7 +832,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // menuitemcheckbox - &nsGkAtoms::menuitemcheckbox, + nsGkAtoms::menuitemcheckbox, roles::CHECK_MENU_ITEM, kUseMapRole, eNoValue, @@ -844,7 +844,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIAReadonly }, { // menuitemradio - &nsGkAtoms::menuitemradio, + nsGkAtoms::menuitemradio, roles::RADIO_MENU_ITEM, kUseMapRole, eNoValue, @@ -856,7 +856,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIAReadonly }, { // navigation - &nsGkAtoms::navigation, + nsGkAtoms::navigation, roles::NOTHING, kUseNativeRole, eNoValue, @@ -866,7 +866,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // none - &nsGkAtoms::none, + nsGkAtoms::none, roles::NOTHING, kUseMapRole, eNoValue, @@ -876,7 +876,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // note - &nsGkAtoms::note_, + nsGkAtoms::note_, roles::NOTE, kUseMapRole, eNoValue, @@ -886,7 +886,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // option - &nsGkAtoms::option, + nsGkAtoms::option, roles::OPTION, kUseMapRole, eNoValue, @@ -898,7 +898,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIACheckedMixed }, { // presentation - &nsGkAtoms::presentation, + nsGkAtoms::presentation, roles::NOTHING, kUseMapRole, eNoValue, @@ -908,7 +908,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // progressbar - &nsGkAtoms::progressbar, + nsGkAtoms::progressbar, roles::PROGRESSBAR, kUseMapRole, eHasValueMinMax, @@ -919,7 +919,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eIndeterminateIfNoValue }, { // radio - &nsGkAtoms::radio, + nsGkAtoms::radio, roles::RADIOBUTTON, kUseMapRole, eNoValue, @@ -930,7 +930,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIACheckableBool }, { // radiogroup - &nsGkAtoms::radiogroup, + nsGkAtoms::radiogroup, roles::RADIO_GROUP, kUseMapRole, eNoValue, @@ -942,7 +942,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIAReadonly }, { // region - &nsGkAtoms::region, + nsGkAtoms::region, roles::REGION, kUseMapRole, eNoValue, @@ -952,7 +952,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // row - &nsGkAtoms::row, + nsGkAtoms::row, roles::ROW, kUseMapRole, eNoValue, @@ -963,7 +963,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIASelectable }, { // rowgroup - &nsGkAtoms::rowgroup, + nsGkAtoms::rowgroup, roles::GROUPING, kUseMapRole, eNoValue, @@ -973,7 +973,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // rowheader - &nsGkAtoms::rowheader, + nsGkAtoms::rowheader, roles::ROWHEADER, kUseMapRole, eNoValue, @@ -985,7 +985,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIAReadonlyOrEditableIfDefined }, { // scrollbar - &nsGkAtoms::scrollbar, + nsGkAtoms::scrollbar, roles::SCROLLBAR, kUseMapRole, eHasValueMinMax, @@ -997,7 +997,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIAReadonly }, { // search - &nsGkAtoms::search, + nsGkAtoms::search, roles::NOTHING, kUseNativeRole, eNoValue, @@ -1007,7 +1007,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // searchbox - &nsGkAtoms::searchbox, + nsGkAtoms::searchbox, roles::ENTRY, kUseMapRole, eNoValue, @@ -1020,7 +1020,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIAReadonlyOrEditable }, { // separator - &nsGkAtoms::separator_, + nsGkAtoms::separator_, roles::SEPARATOR, kUseMapRole, eHasValueMinMaxIfFocusable, @@ -1031,7 +1031,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIAOrientation }, { // slider - &nsGkAtoms::slider, + nsGkAtoms::slider, roles::SLIDER, kUseMapRole, eHasValueMinMax, @@ -1043,7 +1043,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIAReadonly }, { // spinbutton - &nsGkAtoms::spinbutton, + nsGkAtoms::spinbutton, roles::SPINBUTTON, kUseMapRole, eHasValueMinMax, @@ -1054,7 +1054,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIAReadonly }, { // status - &nsGkAtoms::status, + nsGkAtoms::status, roles::STATUSBAR, kUseMapRole, eNoValue, @@ -1064,7 +1064,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // switch - &nsGkAtoms::svgSwitch, + nsGkAtoms::svgSwitch, roles::SWITCH, kUseMapRole, eNoValue, @@ -1076,7 +1076,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIAReadonly }, { // tab - &nsGkAtoms::tab, + nsGkAtoms::tab, roles::PAGETAB, kUseMapRole, eNoValue, @@ -1087,7 +1087,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIASelectable }, { // table - &nsGkAtoms::table, + nsGkAtoms::table, roles::TABLE, kUseMapRole, eNoValue, @@ -1098,7 +1098,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIASelectable }, { // tablist - &nsGkAtoms::tablist, + nsGkAtoms::tablist, roles::PAGETABLIST, kUseMapRole, eNoValue, @@ -1109,7 +1109,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIAOrientation }, { // tabpanel - &nsGkAtoms::tabpanel, + nsGkAtoms::tabpanel, roles::PROPERTYPAGE, kUseMapRole, eNoValue, @@ -1119,7 +1119,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // term - &nsGkAtoms::term, + nsGkAtoms::term, roles::TERM, kUseMapRole, eNoValue, @@ -1129,7 +1129,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = states::READONLY }, { // textbox - &nsGkAtoms::textbox, + nsGkAtoms::textbox, roles::ENTRY, kUseMapRole, eNoValue, @@ -1142,7 +1142,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIAReadonlyOrEditable }, { // timer - &nsGkAtoms::timer, + nsGkAtoms::timer, roles::NOTHING, kUseNativeRole, eNoValue, @@ -1151,7 +1151,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // toolbar - &nsGkAtoms::toolbar, + nsGkAtoms::toolbar, roles::TOOLBAR, kUseMapRole, eNoValue, @@ -1162,7 +1162,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIAOrientation }, { // tooltip - &nsGkAtoms::tooltip, + nsGkAtoms::tooltip, roles::TOOLTIP, kUseMapRole, eNoValue, @@ -1172,7 +1172,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = kNoReqStates }, { // tree - &nsGkAtoms::tree, + nsGkAtoms::tree, roles::OUTLINE, kUseMapRole, eNoValue, @@ -1186,7 +1186,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIAOrientation }, { // treegrid - &nsGkAtoms::treegrid, + nsGkAtoms::treegrid, roles::TREE_TABLE, kUseMapRole, eNoValue, @@ -1200,7 +1200,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = eARIAOrientation }, { // treeitem - &nsGkAtoms::treeitem, + nsGkAtoms::treeitem, roles::OUTLINEITEM, kUseMapRole, eNoValue, @@ -1215,7 +1215,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = }; static const nsRoleMapEntry sLandmarkRoleMap = { - &nsGkAtoms::_empty, + nsGkAtoms::_empty, roles::NOTHING, kUseNativeRole, eNoValue, @@ -1226,7 +1226,7 @@ static const nsRoleMapEntry sLandmarkRoleMap = { }; nsRoleMapEntry aria::gEmptyRoleMap = { - &nsGkAtoms::_empty, + nsGkAtoms::_empty, roles::NOTHING, kUseMapRole, eNoValue, @@ -1261,48 +1261,48 @@ static const EStateRule sWAIUnivStateMap[] = { struct AttrCharacteristics { - nsStaticAtom** attributeName; + const nsStaticAtom* const attributeName; const uint8_t characteristics; }; static const AttrCharacteristics gWAIUnivAttrMap[] = { - {&nsGkAtoms::aria_activedescendant, ATTR_BYPASSOBJ }, - {&nsGkAtoms::aria_atomic, ATTR_BYPASSOBJ_IF_FALSE | ATTR_VALTOKEN | ATTR_GLOBAL }, - {&nsGkAtoms::aria_busy, ATTR_VALTOKEN | ATTR_GLOBAL }, - {&nsGkAtoms::aria_checked, ATTR_BYPASSOBJ | ATTR_VALTOKEN }, /* exposes checkable obj attr */ - {&nsGkAtoms::aria_controls, ATTR_BYPASSOBJ | ATTR_GLOBAL }, - {&nsGkAtoms::aria_describedby, ATTR_BYPASSOBJ | ATTR_GLOBAL }, - {&nsGkAtoms::aria_details, ATTR_BYPASSOBJ | ATTR_GLOBAL }, - {&nsGkAtoms::aria_disabled, ATTR_BYPASSOBJ | ATTR_VALTOKEN | ATTR_GLOBAL }, - {&nsGkAtoms::aria_dropeffect, ATTR_VALTOKEN | ATTR_GLOBAL }, - {&nsGkAtoms::aria_errormessage, ATTR_BYPASSOBJ | ATTR_GLOBAL }, - {&nsGkAtoms::aria_expanded, ATTR_BYPASSOBJ | ATTR_VALTOKEN }, - {&nsGkAtoms::aria_flowto, ATTR_BYPASSOBJ | ATTR_GLOBAL }, - {&nsGkAtoms::aria_grabbed, ATTR_VALTOKEN | ATTR_GLOBAL }, - {&nsGkAtoms::aria_haspopup, ATTR_BYPASSOBJ_IF_FALSE | ATTR_VALTOKEN | ATTR_GLOBAL }, - {&nsGkAtoms::aria_hidden, ATTR_BYPASSOBJ | ATTR_VALTOKEN | ATTR_GLOBAL }, /* handled special way */ - {&nsGkAtoms::aria_invalid, ATTR_BYPASSOBJ | ATTR_VALTOKEN | ATTR_GLOBAL }, - {&nsGkAtoms::aria_label, ATTR_BYPASSOBJ | ATTR_GLOBAL }, - {&nsGkAtoms::aria_labelledby, ATTR_BYPASSOBJ | ATTR_GLOBAL }, - {&nsGkAtoms::aria_level, ATTR_BYPASSOBJ }, /* handled via groupPosition */ - {&nsGkAtoms::aria_live, ATTR_VALTOKEN | ATTR_GLOBAL }, - {&nsGkAtoms::aria_modal, ATTR_BYPASSOBJ | ATTR_VALTOKEN | ATTR_GLOBAL }, - {&nsGkAtoms::aria_multiline, ATTR_BYPASSOBJ | ATTR_VALTOKEN }, - {&nsGkAtoms::aria_multiselectable, ATTR_BYPASSOBJ | ATTR_VALTOKEN }, - {&nsGkAtoms::aria_owns, ATTR_BYPASSOBJ | ATTR_GLOBAL }, - {&nsGkAtoms::aria_orientation, ATTR_VALTOKEN }, - {&nsGkAtoms::aria_posinset, ATTR_BYPASSOBJ }, /* handled via groupPosition */ - {&nsGkAtoms::aria_pressed, ATTR_BYPASSOBJ | ATTR_VALTOKEN }, - {&nsGkAtoms::aria_readonly, ATTR_BYPASSOBJ | ATTR_VALTOKEN }, - {&nsGkAtoms::aria_relevant, ATTR_BYPASSOBJ | ATTR_GLOBAL }, - {&nsGkAtoms::aria_required, ATTR_BYPASSOBJ | ATTR_VALTOKEN }, - {&nsGkAtoms::aria_selected, ATTR_BYPASSOBJ | ATTR_VALTOKEN }, - {&nsGkAtoms::aria_setsize, ATTR_BYPASSOBJ }, /* handled via groupPosition */ - {&nsGkAtoms::aria_sort, ATTR_VALTOKEN }, - {&nsGkAtoms::aria_valuenow, ATTR_BYPASSOBJ }, - {&nsGkAtoms::aria_valuemin, ATTR_BYPASSOBJ }, - {&nsGkAtoms::aria_valuemax, ATTR_BYPASSOBJ }, - {&nsGkAtoms::aria_valuetext, ATTR_BYPASSOBJ } + {nsGkAtoms::aria_activedescendant, ATTR_BYPASSOBJ }, + {nsGkAtoms::aria_atomic, ATTR_BYPASSOBJ_IF_FALSE | ATTR_VALTOKEN | ATTR_GLOBAL }, + {nsGkAtoms::aria_busy, ATTR_VALTOKEN | ATTR_GLOBAL }, + {nsGkAtoms::aria_checked, ATTR_BYPASSOBJ | ATTR_VALTOKEN }, /* exposes checkable obj attr */ + {nsGkAtoms::aria_controls, ATTR_BYPASSOBJ | ATTR_GLOBAL }, + {nsGkAtoms::aria_describedby, ATTR_BYPASSOBJ | ATTR_GLOBAL }, + {nsGkAtoms::aria_details, ATTR_BYPASSOBJ | ATTR_GLOBAL }, + {nsGkAtoms::aria_disabled, ATTR_BYPASSOBJ | ATTR_VALTOKEN | ATTR_GLOBAL }, + {nsGkAtoms::aria_dropeffect, ATTR_VALTOKEN | ATTR_GLOBAL }, + {nsGkAtoms::aria_errormessage, ATTR_BYPASSOBJ | ATTR_GLOBAL }, + {nsGkAtoms::aria_expanded, ATTR_BYPASSOBJ | ATTR_VALTOKEN }, + {nsGkAtoms::aria_flowto, ATTR_BYPASSOBJ | ATTR_GLOBAL }, + {nsGkAtoms::aria_grabbed, ATTR_VALTOKEN | ATTR_GLOBAL }, + {nsGkAtoms::aria_haspopup, ATTR_BYPASSOBJ_IF_FALSE | ATTR_VALTOKEN | ATTR_GLOBAL }, + {nsGkAtoms::aria_hidden, ATTR_BYPASSOBJ | ATTR_VALTOKEN | ATTR_GLOBAL }, /* handled special way */ + {nsGkAtoms::aria_invalid, ATTR_BYPASSOBJ | ATTR_VALTOKEN | ATTR_GLOBAL }, + {nsGkAtoms::aria_label, ATTR_BYPASSOBJ | ATTR_GLOBAL }, + {nsGkAtoms::aria_labelledby, ATTR_BYPASSOBJ | ATTR_GLOBAL }, + {nsGkAtoms::aria_level, ATTR_BYPASSOBJ }, /* handled via groupPosition */ + {nsGkAtoms::aria_live, ATTR_VALTOKEN | ATTR_GLOBAL }, + {nsGkAtoms::aria_modal, ATTR_BYPASSOBJ | ATTR_VALTOKEN | ATTR_GLOBAL }, + {nsGkAtoms::aria_multiline, ATTR_BYPASSOBJ | ATTR_VALTOKEN }, + {nsGkAtoms::aria_multiselectable, ATTR_BYPASSOBJ | ATTR_VALTOKEN }, + {nsGkAtoms::aria_owns, ATTR_BYPASSOBJ | ATTR_GLOBAL }, + {nsGkAtoms::aria_orientation, ATTR_VALTOKEN }, + {nsGkAtoms::aria_posinset, ATTR_BYPASSOBJ }, /* handled via groupPosition */ + {nsGkAtoms::aria_pressed, ATTR_BYPASSOBJ | ATTR_VALTOKEN }, + {nsGkAtoms::aria_readonly, ATTR_BYPASSOBJ | ATTR_VALTOKEN }, + {nsGkAtoms::aria_relevant, ATTR_BYPASSOBJ | ATTR_GLOBAL }, + {nsGkAtoms::aria_required, ATTR_BYPASSOBJ | ATTR_VALTOKEN }, + {nsGkAtoms::aria_selected, ATTR_BYPASSOBJ | ATTR_VALTOKEN }, + {nsGkAtoms::aria_setsize, ATTR_BYPASSOBJ }, /* handled via groupPosition */ + {nsGkAtoms::aria_sort, ATTR_VALTOKEN }, + {nsGkAtoms::aria_valuenow, ATTR_BYPASSOBJ }, + {nsGkAtoms::aria_valuemin, ATTR_BYPASSOBJ }, + {nsGkAtoms::aria_valuemax, ATTR_BYPASSOBJ }, + {nsGkAtoms::aria_valuetext, ATTR_BYPASSOBJ } }; namespace { @@ -1395,7 +1395,7 @@ uint8_t aria::AttrCharacteristicsFor(nsAtom* aAtom) { for (uint32_t i = 0; i < ArrayLength(gWAIUnivAttrMap); i++) - if (*gWAIUnivAttrMap[i].attributeName == aAtom) + if (gWAIUnivAttrMap[i].attributeName == aAtom) return gWAIUnivAttrMap[i].characteristics; return 0; diff --git a/accessible/base/ARIAMap.h b/accessible/base/ARIAMap.h index 003e41d21919..1e9c099e6ca4 100644 --- a/accessible/base/ARIAMap.h +++ b/accessible/base/ARIAMap.h @@ -142,7 +142,7 @@ struct nsRoleMapEntry * Return true if matches to the given ARIA role. */ bool Is(nsAtom* aARIARole) const - { return *roleAtom == aARIARole; } + { return roleAtom == aARIARole; } /** * Return true if ARIA role has the given accessible type. @@ -154,10 +154,10 @@ struct nsRoleMapEntry * Return ARIA role. */ const nsDependentAtomString ARIARoleString() const - { return nsDependentAtomString(*roleAtom); } + { return nsDependentAtomString(roleAtom); } // ARIA role: string representation such as "button" - nsStaticAtom** roleAtom; + nsStaticAtom* const roleAtom; // Role mapping rule: maps to enum Role mozilla::a11y::role role; diff --git a/accessible/generic/Accessible.cpp b/accessible/generic/Accessible.cpp index 48dfc1a8028f..e303191bd812 100644 --- a/accessible/generic/Accessible.cpp +++ b/accessible/generic/Accessible.cpp @@ -1492,8 +1492,9 @@ nsAtom* Accessible::LandmarkRole() const { const nsRoleMapEntry* roleMapEntry = ARIARoleMap(); - return roleMapEntry && roleMapEntry->IsOfType(eLandmark) ? - *(roleMapEntry->roleAtom) : nullptr; + return roleMapEntry && roleMapEntry->IsOfType(eLandmark) + ? roleMapEntry->roleAtom + : nullptr; } role diff --git a/accessible/ipc/ProxyAccessibleShared.h b/accessible/ipc/ProxyAccessibleShared.h index 538a5ea92288..6097ffdd48ce 100644 --- a/accessible/ipc/ProxyAccessibleShared.h +++ b/accessible/ipc/ProxyAccessibleShared.h @@ -62,7 +62,7 @@ bool IsSearchbox() const; nsAtom* LandmarkRole() const; -nsAtom* ARIARoleAtom() const; +nsStaticAtom* ARIARoleAtom() const; int32_t GetLevelInternal(); void ScrollTo(uint32_t aScrollType); diff --git a/accessible/ipc/other/DocAccessibleChild.cpp b/accessible/ipc/other/DocAccessibleChild.cpp index db000d102f6f..74c407a80b3a 100644 --- a/accessible/ipc/other/DocAccessibleChild.cpp +++ b/accessible/ipc/other/DocAccessibleChild.cpp @@ -293,7 +293,7 @@ DocAccessibleChild::RecvARIARoleAtom(const uint64_t& aID, nsString* aRole) } if (const nsRoleMapEntry* roleMap = acc->ARIARoleMap()) { - if (nsAtom* roleAtom = *(roleMap->roleAtom)) { + if (nsStaticAtom* roleAtom = roleMap->roleAtom) { roleAtom->ToString(*aRole); } } diff --git a/accessible/ipc/other/ProxyAccessible.cpp b/accessible/ipc/other/ProxyAccessible.cpp index 6bc36f30313f..ff5e91977b15 100644 --- a/accessible/ipc/other/ProxyAccessible.cpp +++ b/accessible/ipc/other/ProxyAccessible.cpp @@ -127,7 +127,7 @@ ProxyAccessible::LandmarkRole() const return NS_GetStaticAtom(landmark); } -nsAtom* +nsStaticAtom* ProxyAccessible::ARIARoleAtom() const { nsString role; diff --git a/accessible/mac/mozAccessible.mm b/accessible/mac/mozAccessible.mm index 4af2b980b7cc..fa6ba5e7a82c 100644 --- a/accessible/mac/mozAccessible.mm +++ b/accessible/mac/mozAccessible.mm @@ -770,10 +770,10 @@ ConvertToNSArray(nsTArray& aArray) return @"AXLandmarkRegion"; // Now, deal with widget roles - nsAtom* roleAtom = nullptr; + nsStaticAtom* roleAtom = nullptr; if (accWrap && accWrap->HasARIARole()) { const nsRoleMapEntry* roleMap = accWrap->ARIARoleMap(); - roleAtom = *roleMap->roleAtom; + roleAtom = roleMap->roleAtom; } if (proxy) roleAtom = proxy->ARIARoleAtom(); From 86ae6e985997e08a677123bfa61bf742749e0cf7 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 3 Apr 2018 11:20:13 +1000 Subject: [PATCH 81/88] Bug 1451169 - Use `nsStaticAtom*` instead of `nsStaticAtom**` in nsAccessibilityService.h. r=davidb MozReview-Commit-ID: ELDULed7sWF --HG-- extra : rebase_source : bff720f0fdc9b9c41128299bfc1f32cdef1404f4 --- accessible/base/nsAccessibilityService.cpp | 26 +++++++++++----------- accessible/base/nsAccessibilityService.h | 13 ++++++----- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/accessible/base/nsAccessibilityService.cpp b/accessible/base/nsAccessibilityService.cpp index 56c520331032..7a176e3b5a13 100644 --- a/accessible/base/nsAccessibilityService.cpp +++ b/accessible/base/nsAccessibilityService.cpp @@ -304,16 +304,16 @@ static int32_t sPlatformDisabledState = 0; // Markup maps array. #define Attr(name, value) \ - { &nsGkAtoms::name, &nsGkAtoms::value } + { nsGkAtoms::name, nsGkAtoms::value } #define AttrFromDOM(name, DOMAttrName) \ - { &nsGkAtoms::name, nullptr, &nsGkAtoms::DOMAttrName } + { nsGkAtoms::name, nullptr, nsGkAtoms::DOMAttrName } #define AttrFromDOMIf(name, DOMAttrName, DOMAttrValue) \ - { &nsGkAtoms::name, nullptr, &nsGkAtoms::DOMAttrName, &nsGkAtoms::DOMAttrValue } + { nsGkAtoms::name, nullptr, nsGkAtoms::DOMAttrName, nsGkAtoms::DOMAttrValue } #define MARKUPMAP(atom, new_func, r, ... ) \ - { &nsGkAtoms::atom, new_func, static_cast(r), { __VA_ARGS__ } }, + { nsGkAtoms::atom, new_func, static_cast(r), { __VA_ARGS__ } }, static const HTMLMarkupMapInfo sHTMLMarkupMapList[] = { #include "MarkupMap.h" @@ -323,7 +323,7 @@ static const HTMLMarkupMapInfo sHTMLMarkupMapList[] = { #ifdef MOZ_XUL #define XULMAP(atom, ...) \ - { &nsGkAtoms::atom, __VA_ARGS__ }, + { nsGkAtoms::atom, __VA_ARGS__ }, #define XULMAP_TYPE(atom, new_type) \ XULMAP( \ @@ -1350,11 +1350,11 @@ nsAccessibilityService::Init() eventListenerService->AddListenerChangeListener(this); for (uint32_t i = 0; i < ArrayLength(sHTMLMarkupMapList); i++) - mHTMLMarkupMap.Put(*sHTMLMarkupMapList[i].tag, &sHTMLMarkupMapList[i]); + mHTMLMarkupMap.Put(sHTMLMarkupMapList[i].tag, &sHTMLMarkupMapList[i]); #ifdef MOZ_XUL for (uint32_t i = 0; i < ArrayLength(sXULMarkupMapList); i++) - mXULMarkupMap.Put(*sXULMarkupMapList[i].tag, &sXULMarkupMapList[i]); + mXULMarkupMap.Put(sXULMarkupMapList[i].tag, &sXULMarkupMapList[i]); #endif #ifdef A11Y_LOG @@ -1616,10 +1616,10 @@ nsAccessibilityService::MarkupAttributes(const nsIContent* aContent, if (info->DOMAttrValue) { if (aContent->IsElement() && aContent->AsElement()->AttrValueIs(kNameSpaceID_None, - *info->DOMAttrName, - *info->DOMAttrValue, + info->DOMAttrName, + info->DOMAttrValue, eCaseMatters)) { - nsAccUtils::SetAccAttr(aAttributes, *info->name, *info->DOMAttrValue); + nsAccUtils::SetAccAttr(aAttributes, info->name, info->DOMAttrValue); } continue; } @@ -1627,16 +1627,16 @@ nsAccessibilityService::MarkupAttributes(const nsIContent* aContent, nsAutoString value; if (aContent->IsElement()) { - aContent->AsElement()->GetAttr(kNameSpaceID_None, *info->DOMAttrName, value); + aContent->AsElement()->GetAttr(kNameSpaceID_None, info->DOMAttrName, value); } if (!value.IsEmpty()) - nsAccUtils::SetAccAttr(aAttributes, *info->name, value); + nsAccUtils::SetAccAttr(aAttributes, info->name, value); continue; } - nsAccUtils::SetAccAttr(aAttributes, *info->name, *info->value); + nsAccUtils::SetAccAttr(aAttributes, info->name, info->value); } } diff --git a/accessible/base/nsAccessibilityService.h b/accessible/base/nsAccessibilityService.h index fc88dd06fcea..a1f999dde75d 100644 --- a/accessible/base/nsAccessibilityService.h +++ b/accessible/base/nsAccessibilityService.h @@ -53,16 +53,17 @@ xpcAccessibleApplication* XPCApplicationAcc(); typedef Accessible* (New_Accessible)(nsIContent* aContent, Accessible* aContext); +// These fields are not `nsStaticAtom* const` because MSVC doesn't like it. struct MarkupAttrInfo { - nsStaticAtom** name; - nsStaticAtom** value; + nsStaticAtom* name; + nsStaticAtom* value; - nsStaticAtom** DOMAttrName; - nsStaticAtom** DOMAttrValue; + nsStaticAtom* DOMAttrName; + nsStaticAtom* DOMAttrValue; }; struct HTMLMarkupMapInfo { - nsStaticAtom** tag; + const nsStaticAtom* const tag; New_Accessible* new_func; a11y::role role; MarkupAttrInfo attrs[4]; @@ -70,7 +71,7 @@ struct HTMLMarkupMapInfo { #ifdef MOZ_XUL struct XULMarkupMapInfo { - nsStaticAtom** tag; + const nsStaticAtom* const tag; New_Accessible* new_func; }; #endif From 5f08f2ad31bb5f418cfd0571f235c5b2da4f5631 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 3 Apr 2018 22:15:30 +1000 Subject: [PATCH 82/88] Bug 1451169 - Use `nsStaticAtom* const` instead of `nsStaticAtom**` in DocAccessible.cpp. r=davidb MozReview-Commit-ID: 6brOOd7hFqV --HG-- extra : rebase_source : 0d783d878db5a844f49bc04c48012b76aba982c3 --- accessible/generic/DocAccessible.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/accessible/generic/DocAccessible.cpp b/accessible/generic/DocAccessible.cpp index ef579dc6b088..c340bd032a7b 100644 --- a/accessible/generic/DocAccessible.cpp +++ b/accessible/generic/DocAccessible.cpp @@ -54,17 +54,17 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// // Static member initialization -static nsStaticAtom** kRelationAttrs[] = +static nsStaticAtom* const kRelationAttrs[] = { - &nsGkAtoms::aria_labelledby, - &nsGkAtoms::aria_describedby, - &nsGkAtoms::aria_details, - &nsGkAtoms::aria_owns, - &nsGkAtoms::aria_controls, - &nsGkAtoms::aria_flowto, - &nsGkAtoms::aria_errormessage, - &nsGkAtoms::_for, - &nsGkAtoms::control + nsGkAtoms::aria_labelledby, + nsGkAtoms::aria_describedby, + nsGkAtoms::aria_details, + nsGkAtoms::aria_owns, + nsGkAtoms::aria_controls, + nsGkAtoms::aria_flowto, + nsGkAtoms::aria_errormessage, + nsGkAtoms::_for, + nsGkAtoms::control }; static const uint32_t kRelationAttrsLen = ArrayLength(kRelationAttrs); @@ -1557,7 +1557,7 @@ DocAccessible::AddDependentIDsFor(Accessible* aRelProvider, nsAtom* aRelAttr) return; for (uint32_t idx = 0; idx < kRelationAttrsLen; idx++) { - nsAtom* relAttr = *kRelationAttrs[idx]; + nsStaticAtom* relAttr = kRelationAttrs[idx]; if (aRelAttr && aRelAttr != relAttr) continue; @@ -1629,8 +1629,8 @@ DocAccessible::RemoveDependentIDsFor(Accessible* aRelProvider, return; for (uint32_t idx = 0; idx < kRelationAttrsLen; idx++) { - nsAtom* relAttr = *kRelationAttrs[idx]; - if (aRelAttr && aRelAttr != *kRelationAttrs[idx]) + nsStaticAtom* relAttr = kRelationAttrs[idx]; + if (aRelAttr && aRelAttr != kRelationAttrs[idx]) continue; IDRefsIterator iter(this, relProviderElm, relAttr); From a560608963b07b8546d08b57c7bf95e4a01de08c Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 3 Apr 2018 13:21:06 +1000 Subject: [PATCH 83/88] Bug 1451169 - Use `nsStaticAtom*` instead of `nsStaticAtom**` in Element.h. r=baku And then fix up everything else that needs to change as well. MozReview-Commit-ID: GDMfERqdQAc --HG-- extra : rebase_source : 01fe06c3182245a409099a53383d92bf4fa0155c --- accessible/base/ARIAStateMap.cpp | 16 +-- accessible/base/TextAttrs.cpp | 2 +- accessible/base/XULMap.h | 2 +- accessible/base/nsAccUtils.cpp | 7 +- accessible/base/nsAccUtils.h | 3 +- accessible/html/HTMLTableAccessible.cpp | 4 +- accessible/xul/XULFormControlAccessible.cpp | 2 +- accessible/xul/XULMenuAccessible.cpp | 2 +- dom/base/Element.cpp | 18 ++-- dom/base/Element.h | 6 +- dom/base/FragmentOrElement.cpp | 10 +- dom/base/nsContentUtils.cpp | 2 +- dom/events/EventStateManager.cpp | 2 +- dom/html/HTMLBRElement.cpp | 2 +- dom/html/HTMLBodyElement.cpp | 20 ++-- dom/html/HTMLFontElement.cpp | 6 +- dom/html/HTMLHRElement.cpp | 10 +- dom/html/HTMLIFrameElement.cpp | 6 +- dom/html/HTMLInputElement.cpp | 4 +- dom/html/HTMLLIElement.cpp | 2 +- dom/html/HTMLLinkElement.cpp | 2 +- dom/html/HTMLPreElement.cpp | 2 +- dom/html/HTMLSharedElement.cpp | 4 +- dom/html/HTMLSharedListElement.cpp | 2 +- dom/html/HTMLTableCaptionElement.cpp | 2 +- dom/html/HTMLTableCellElement.cpp | 18 ++-- dom/html/HTMLTableColElement.cpp | 8 +- dom/html/HTMLTableElement.cpp | 18 ++-- dom/html/HTMLTableRowElement.cpp | 6 +- dom/html/HTMLTableSectionElement.cpp | 6 +- dom/html/HTMLTextAreaElement.cpp | 2 +- dom/html/HTMLVideoElement.cpp | 4 +- dom/html/nsGenericHTMLElement.cpp | 28 ++--- dom/html/nsGenericHTMLElement.h | 2 +- dom/html/nsTextEditorState.cpp | 2 +- dom/mathml/nsMathMLElement.cpp | 38 +++---- dom/svg/SVGAElement.cpp | 8 +- dom/svg/nsSVGElement.cpp | 112 ++++++++++---------- dom/xbl/nsXBLPrototypeBinding.cpp | 12 +-- dom/xul/XULDocument.cpp | 2 +- layout/base/PositionedEventTargeting.cpp | 2 +- layout/generic/nsImageMap.cpp | 8 +- layout/xul/nsBoxFrame.cpp | 20 ++-- layout/xul/nsImageBoxFrame.cpp | 2 +- layout/xul/nsLeafBoxFrame.cpp | 2 +- layout/xul/nsMenuFrame.cpp | 2 +- layout/xul/nsMenuPopupFrame.cpp | 2 +- layout/xul/nsResizerFrame.cpp | 8 +- layout/xul/nsScrollbarButtonFrame.cpp | 4 +- layout/xul/nsSplitterFrame.cpp | 10 +- layout/xul/nsTextBoxFrame.cpp | 4 +- layout/xul/nsXULPopupManager.cpp | 2 +- layout/xul/tree/nsTreeColumns.cpp | 5 +- layout/xul/tree/nsTreeContentView.cpp | 2 +- layout/xul/tree/nsTreeSelection.cpp | 2 +- widget/cocoa/nsMenuX.mm | 2 +- widget/nsNativeTheme.cpp | 6 +- 57 files changed, 244 insertions(+), 243 deletions(-) diff --git a/accessible/base/ARIAStateMap.cpp b/accessible/base/ARIAStateMap.cpp index 7956a979b01b..f7a187ecbad7 100644 --- a/accessible/base/ARIAStateMap.cpp +++ b/accessible/base/ARIAStateMap.cpp @@ -24,7 +24,7 @@ struct EnumTypeData // States if the attribute value is matched to the enum value. Used as // Element::AttrValuesArray, last item must be nullptr. - nsStaticAtom* const* const mValues[4]; + nsStaticAtom* const mValues[4]; // States applied if corresponding enum values are matched. const uint64_t mStates[3]; @@ -89,9 +89,9 @@ aria::MapToState(EStateRule aRule, dom::Element* aElement, uint64_t* aState) { static const EnumTypeData data = { nsGkAtoms::aria_autocomplete, - { &nsGkAtoms::inlinevalue, - &nsGkAtoms::list_, - &nsGkAtoms::both, nullptr }, + { nsGkAtoms::inlinevalue, + nsGkAtoms::list_, + nsGkAtoms::both, nullptr }, { states::SUPPORTS_AUTOCOMPLETION, states::HASPOPUP | states::SUPPORTS_AUTOCOMPLETION, states::HASPOPUP | states::SUPPORTS_AUTOCOMPLETION }, 0 @@ -105,8 +105,8 @@ aria::MapToState(EStateRule aRule, dom::Element* aElement, uint64_t* aState) { static const EnumTypeData data = { nsGkAtoms::aria_busy, - { &nsGkAtoms::_true, - &nsGkAtoms::error, nullptr }, + { nsGkAtoms::_true, + nsGkAtoms::error, nullptr }, { states::BUSY, states::INVALID }, 0 }; @@ -229,8 +229,8 @@ aria::MapToState(EStateRule aRule, dom::Element* aElement, uint64_t* aState) { static const EnumTypeData data = { nsGkAtoms::aria_orientation, - { &nsGkAtoms::horizontal, - &nsGkAtoms::vertical, nullptr }, + { nsGkAtoms::horizontal, + nsGkAtoms::vertical, nullptr }, { states::HORIZONTAL, states::VERTICAL }, states::HORIZONTAL | states::VERTICAL diff --git a/accessible/base/TextAttrs.cpp b/accessible/base/TextAttrs.cpp index 7655941c7f5b..c0cffe082a96 100644 --- a/accessible/base/TextAttrs.cpp +++ b/accessible/base/TextAttrs.cpp @@ -302,7 +302,7 @@ TextAttrsMgr::InvalidTextAttr:: do { if (nsAccUtils::HasDefinedARIAToken(elm, nsGkAtoms::aria_invalid)) { static Element::AttrValuesArray tokens[] = - { &nsGkAtoms::_false, &nsGkAtoms::grammar, &nsGkAtoms::spelling, + { nsGkAtoms::_false, nsGkAtoms::grammar, nsGkAtoms::spelling, nullptr }; int32_t idx = elm->AsElement()->FindAttrValueIn(kNameSpaceID_None, diff --git a/accessible/base/XULMap.h b/accessible/base/XULMap.h index 0105d5e3d3ae..008712a6f4c1 100644 --- a/accessible/base/XULMap.h +++ b/accessible/base/XULMap.h @@ -120,7 +120,7 @@ XULMAP( panel, [](nsIContent* aContent, Accessible* aContext) -> Accessible* { static const Element::AttrValuesArray sIgnoreTypeVals[] = - { &nsGkAtoms::autocomplete_richlistbox, &nsGkAtoms::autocomplete, nullptr }; + { nsGkAtoms::autocomplete_richlistbox, nsGkAtoms::autocomplete, nullptr }; if (!aContent->IsElement() || aContent->AsElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::type, diff --git a/accessible/base/nsAccUtils.cpp b/accessible/base/nsAccUtils.cpp index 1b32b5bf4324..a843b83cf521 100644 --- a/accessible/base/nsAccUtils.cpp +++ b/accessible/base/nsAccUtils.cpp @@ -208,20 +208,19 @@ nsAccUtils::HasDefinedARIAToken(nsIContent *aContent, nsAtom *aAtom) return true; } -nsAtom* +nsStaticAtom* nsAccUtils::GetARIAToken(dom::Element* aElement, nsAtom* aAttr) { if (!HasDefinedARIAToken(aElement, aAttr)) return nsGkAtoms::_empty; static Element::AttrValuesArray tokens[] = - { &nsGkAtoms::_false, &nsGkAtoms::_true, - &nsGkAtoms::mixed, nullptr}; + { nsGkAtoms::_false, nsGkAtoms::_true, nsGkAtoms::mixed, nullptr}; int32_t idx = aElement->FindAttrValueIn(kNameSpaceID_None, aAttr, tokens, eCaseMatters); if (idx >= 0) - return *(tokens[idx]); + return tokens[idx]; return nullptr; } diff --git a/accessible/base/nsAccUtils.h b/accessible/base/nsAccUtils.h index 04fef0a4ffce..4043fda0e435 100644 --- a/accessible/base/nsAccUtils.h +++ b/accessible/base/nsAccUtils.h @@ -101,7 +101,8 @@ public: /** * Return atomic value of ARIA attribute of boolean or NMTOKEN type. */ - static nsAtom* GetARIAToken(mozilla::dom::Element* aElement, nsAtom* aAttr); + static nsStaticAtom* GetARIAToken(mozilla::dom::Element* aElement, + nsAtom* aAttr); /** * Return document accessible for the given DOM node. diff --git a/accessible/html/HTMLTableAccessible.cpp b/accessible/html/HTMLTableAccessible.cpp index 66954b4f5919..2517e4cee433 100644 --- a/accessible/html/HTMLTableAccessible.cpp +++ b/accessible/html/HTMLTableAccessible.cpp @@ -311,8 +311,8 @@ HTMLTableHeaderCellAccessible::NativeRole() { // Check value of @scope attribute. static Element::AttrValuesArray scopeValues[] = - { &nsGkAtoms::col, &nsGkAtoms::colgroup, - &nsGkAtoms::row, &nsGkAtoms::rowgroup, nullptr }; + { nsGkAtoms::col, nsGkAtoms::colgroup, + nsGkAtoms::row, nsGkAtoms::rowgroup, nullptr }; int32_t valueIdx = mContent->AsElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::scope, scopeValues, eCaseMatters); diff --git a/accessible/xul/XULFormControlAccessible.cpp b/accessible/xul/XULFormControlAccessible.cpp index 2f46a0675764..65d79623f2a5 100644 --- a/accessible/xul/XULFormControlAccessible.cpp +++ b/accessible/xul/XULFormControlAccessible.cpp @@ -193,7 +193,7 @@ bool XULButtonAccessible::ContainsMenu() const { static Element::AttrValuesArray strings[] = - {&nsGkAtoms::menu, &nsGkAtoms::menuButton, nullptr}; + {nsGkAtoms::menu, nsGkAtoms::menuButton, nullptr}; return mContent->AsElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::type, diff --git a/accessible/xul/XULMenuAccessible.cpp b/accessible/xul/XULMenuAccessible.cpp index 13f7b2c55930..7f055ff2e599 100644 --- a/accessible/xul/XULMenuAccessible.cpp +++ b/accessible/xul/XULMenuAccessible.cpp @@ -60,7 +60,7 @@ XULMenuitemAccessible::NativeState() // Checkable/checked? static Element::AttrValuesArray strings[] = - { &nsGkAtoms::radio, &nsGkAtoms::checkbox, nullptr }; + { nsGkAtoms::radio, nsGkAtoms::checkbox, nullptr }; if (mContent->AsElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::type, strings, eCaseMatters) >= 0) { diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp index fd06eb0ee3c3..3ecff81743e2 100644 --- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -2166,7 +2166,7 @@ Element::FindAttributeDependence(const nsAtom* aAttribute, for (uint32_t mapindex = 0; mapindex < aMapCount; ++mapindex) { for (const MappedAttributeEntry* map = aMaps[mapindex]; map->attribute; ++map) { - if (aAttribute == *map->attribute) { + if (aAttribute == map->attribute) { return true; } } @@ -2908,7 +2908,7 @@ Element::FindAttrValueIn(int32_t aNameSpaceID, const nsAttrValue* val = mAttrsAndChildren.GetAttr(aName, aNameSpaceID); if (val) { for (int32_t i = 0; aValues[i]; ++i) { - if (val->Equals(*aValues[i], aCaseSensitive)) { + if (val->Equals(aValues[i], aCaseSensitive)) { return i; } } @@ -3423,16 +3423,16 @@ nsDOMTokenListPropertyDestructor(void *aObject, nsAtom *aProperty, NS_RELEASE(list); } -static nsStaticAtom** sPropertiesToTraverseAndUnlink[] = +static nsStaticAtom* const sPropertiesToTraverseAndUnlink[] = { - &nsGkAtoms::sandbox, - &nsGkAtoms::sizes, - &nsGkAtoms::dirAutoSetBy, + nsGkAtoms::sandbox, + nsGkAtoms::sizes, + nsGkAtoms::dirAutoSetBy, nullptr }; // static -nsStaticAtom*** +nsStaticAtom* const* Element::HTMLSVGPropertiesToTraverseAndUnlink() { return sPropertiesToTraverseAndUnlink; @@ -3443,10 +3443,10 @@ Element::GetTokenList(nsAtom* aAtom, const DOMTokenListSupportedTokenArray aSupportedTokens) { #ifdef DEBUG - nsStaticAtom*** props = HTMLSVGPropertiesToTraverseAndUnlink(); + const nsStaticAtom* const* props = HTMLSVGPropertiesToTraverseAndUnlink(); bool found = false; for (uint32_t i = 0; props[i]; ++i) { - if (*props[i] == aAtom) { + if (props[i] == aAtom) { found = true; break; } diff --git a/dom/base/Element.h b/dom/base/Element.h index 4d227212c9eb..db0cf3218a40 100644 --- a/dom/base/Element.h +++ b/dom/base/Element.h @@ -803,7 +803,7 @@ public: * @return ATTR_MISSING, ATTR_VALUE_NO_MATCH or the non-negative index * indicating the first value of aValues that matched */ - typedef nsStaticAtom* const* const AttrValuesArray; + typedef nsStaticAtom* const AttrValuesArray; int32_t FindAttrValueIn(int32_t aNameSpaceID, nsAtom* aName, AttrValuesArray* aValues, @@ -964,7 +964,7 @@ public: * Attribute Mapping Helpers */ struct MappedAttributeEntry { - nsStaticAtom** attribute; + const nsStaticAtom* const attribute; }; /** @@ -981,7 +981,7 @@ public: return FindAttributeDependence(aAttribute, aMaps, N); } - static nsStaticAtom*** HTMLSVGPropertiesToTraverseAndUnlink(); + static nsStaticAtom* const* HTMLSVGPropertiesToTraverseAndUnlink(); private: void DescribeAttribute(uint32_t index, nsAString& aOutDescription) const; diff --git a/dom/base/FragmentOrElement.cpp b/dom/base/FragmentOrElement.cpp index 298116b77b96..aad31138d7e9 100644 --- a/dom/base/FragmentOrElement.cpp +++ b/dom/base/FragmentOrElement.cpp @@ -1469,9 +1469,10 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(FragmentOrElement) } if (tmp->IsHTMLElement() || tmp->IsSVGElement()) { - nsStaticAtom*** props = Element::HTMLSVGPropertiesToTraverseAndUnlink(); + nsStaticAtom* const* props = + Element::HTMLSVGPropertiesToTraverseAndUnlink(); for (uint32_t i = 0; props[i]; ++i) { - tmp->DeleteProperty(*props[i]); + tmp->DeleteProperty(props[i]); } if (tmp->MayHaveAnimations()) { nsAtom** effectProps = EffectSet::GetEffectSetPropertyAtoms(); @@ -2034,10 +2035,11 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(FragmentOrElement) } } if (tmp->IsHTMLElement() || tmp->IsSVGElement()) { - nsStaticAtom*** props = Element::HTMLSVGPropertiesToTraverseAndUnlink(); + nsStaticAtom* const* props = + Element::HTMLSVGPropertiesToTraverseAndUnlink(); for (uint32_t i = 0; props[i]; ++i) { nsISupports* property = - static_cast(tmp->GetProperty(*props[i])); + static_cast(tmp->GetProperty(props[i])); cb.NoteXPCOMChild(property); } if (tmp->MayHaveAnimations()) { diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 993aff296f61..090b0be55192 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -4664,7 +4664,7 @@ nsContentUtils::HasNonEmptyAttr(const nsIContent* aContent, int32_t aNameSpaceID, nsAtom* aName) { - static Element::AttrValuesArray strings[] = {&nsGkAtoms::_empty, nullptr}; + static Element::AttrValuesArray strings[] = {nsGkAtoms::_empty, nullptr}; return aContent->IsElement() && aContent->AsElement()->FindAttrValueIn(aNameSpaceID, aName, strings, eCaseMatters) == Element::ATTR_VALUE_NO_MATCH; diff --git a/dom/events/EventStateManager.cpp b/dom/events/EventStateManager.cpp index 1389637624ac..b6ffb633f480 100644 --- a/dom/events/EventStateManager.cpp +++ b/dom/events/EventStateManager.cpp @@ -2963,7 +2963,7 @@ NodeAllowsClickThrough(nsINode* aNode) if (aNode->IsXULElement()) { mozilla::dom::Element* element = aNode->AsElement(); static Element::AttrValuesArray strings[] = - {&nsGkAtoms::always, &nsGkAtoms::never, nullptr}; + {nsGkAtoms::always, nsGkAtoms::never, nullptr}; switch (element->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::clickthrough, strings, eCaseMatters)) { case 0: diff --git a/dom/html/HTMLBRElement.cpp b/dom/html/HTMLBRElement.cpp index 0f1867aa39a1..9b5abc5d46d6 100644 --- a/dom/html/HTMLBRElement.cpp +++ b/dom/html/HTMLBRElement.cpp @@ -67,7 +67,7 @@ NS_IMETHODIMP_(bool) HTMLBRElement::IsAttributeMapped(const nsAtom* aAttribute) const { static const MappedAttributeEntry attributes[] = { - { &nsGkAtoms::clear }, + { nsGkAtoms::clear }, { nullptr } }; diff --git a/dom/html/HTMLBodyElement.cpp b/dom/html/HTMLBodyElement.cpp index cddafbc0c573..a9e080dc943f 100644 --- a/dom/html/HTMLBodyElement.cpp +++ b/dom/html/HTMLBodyElement.cpp @@ -232,16 +232,16 @@ NS_IMETHODIMP_(bool) HTMLBodyElement::IsAttributeMapped(const nsAtom* aAttribute) const { static const MappedAttributeEntry attributes[] = { - { &nsGkAtoms::link }, - { &nsGkAtoms::vlink }, - { &nsGkAtoms::alink }, - { &nsGkAtoms::text }, - { &nsGkAtoms::marginwidth }, - { &nsGkAtoms::marginheight }, - { &nsGkAtoms::topmargin }, - { &nsGkAtoms::rightmargin }, - { &nsGkAtoms::bottommargin }, - { &nsGkAtoms::leftmargin }, + { nsGkAtoms::link }, + { nsGkAtoms::vlink }, + { nsGkAtoms::alink }, + { nsGkAtoms::text }, + { nsGkAtoms::marginwidth }, + { nsGkAtoms::marginheight }, + { nsGkAtoms::topmargin }, + { nsGkAtoms::rightmargin }, + { nsGkAtoms::bottommargin }, + { nsGkAtoms::leftmargin }, { nullptr }, }; diff --git a/dom/html/HTMLFontElement.cpp b/dom/html/HTMLFontElement.cpp index 5a93db99a49c..32c741c643b3 100644 --- a/dom/html/HTMLFontElement.cpp +++ b/dom/html/HTMLFontElement.cpp @@ -98,9 +98,9 @@ NS_IMETHODIMP_(bool) HTMLFontElement::IsAttributeMapped(const nsAtom* aAttribute) const { static const MappedAttributeEntry attributes[] = { - { &nsGkAtoms::face }, - { &nsGkAtoms::size }, - { &nsGkAtoms::color }, + { nsGkAtoms::face }, + { nsGkAtoms::size }, + { nsGkAtoms::color }, { nullptr } }; diff --git a/dom/html/HTMLHRElement.cpp b/dom/html/HTMLHRElement.cpp index f7ac5ea1547e..61dac41c0e1c 100644 --- a/dom/html/HTMLHRElement.cpp +++ b/dom/html/HTMLHRElement.cpp @@ -171,11 +171,11 @@ NS_IMETHODIMP_(bool) HTMLHRElement::IsAttributeMapped(const nsAtom* aAttribute) const { static const MappedAttributeEntry attributes[] = { - { &nsGkAtoms::align }, - { &nsGkAtoms::width }, - { &nsGkAtoms::size }, - { &nsGkAtoms::color }, - { &nsGkAtoms::noshade }, + { nsGkAtoms::align }, + { nsGkAtoms::width }, + { nsGkAtoms::size }, + { nsGkAtoms::color }, + { nsGkAtoms::noshade }, { nullptr }, }; diff --git a/dom/html/HTMLIFrameElement.cpp b/dom/html/HTMLIFrameElement.cpp index d4048c06835d..529b29282aed 100644 --- a/dom/html/HTMLIFrameElement.cpp +++ b/dom/html/HTMLIFrameElement.cpp @@ -109,9 +109,9 @@ NS_IMETHODIMP_(bool) HTMLIFrameElement::IsAttributeMapped(const nsAtom* aAttribute) const { static const MappedAttributeEntry attributes[] = { - { &nsGkAtoms::width }, - { &nsGkAtoms::height }, - { &nsGkAtoms::frameborder }, + { nsGkAtoms::width }, + { nsGkAtoms::height }, + { nsGkAtoms::frameborder }, { nullptr }, }; diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp index f8ff0af9e0f5..5e6cfe1a1d47 100644 --- a/dom/html/HTMLInputElement.cpp +++ b/dom/html/HTMLInputElement.cpp @@ -5819,8 +5819,8 @@ NS_IMETHODIMP_(bool) HTMLInputElement::IsAttributeMapped(const nsAtom* aAttribute) const { static const MappedAttributeEntry attributes[] = { - { &nsGkAtoms::align }, - { &nsGkAtoms::type }, + { nsGkAtoms::align }, + { nsGkAtoms::type }, { nullptr }, }; diff --git a/dom/html/HTMLLIElement.cpp b/dom/html/HTMLLIElement.cpp index eee4985e65d4..e0b965a3c135 100644 --- a/dom/html/HTMLLIElement.cpp +++ b/dom/html/HTMLLIElement.cpp @@ -83,7 +83,7 @@ NS_IMETHODIMP_(bool) HTMLLIElement::IsAttributeMapped(const nsAtom* aAttribute) const { static const MappedAttributeEntry attributes[] = { - { &nsGkAtoms::type }, + { nsGkAtoms::type }, { nullptr }, }; diff --git a/dom/html/HTMLLinkElement.cpp b/dom/html/HTMLLinkElement.cpp index baa321d4c13a..7c8e12d6675a 100644 --- a/dom/html/HTMLLinkElement.cpp +++ b/dom/html/HTMLLinkElement.cpp @@ -235,7 +235,7 @@ HTMLLinkElement::CreateAndDispatchEvent(nsIDocument* aDoc, // doing the "right" thing costs virtually nothing here, even if it doesn't // make much sense. static Element::AttrValuesArray strings[] = - {&nsGkAtoms::_empty, &nsGkAtoms::stylesheet, nullptr}; + {nsGkAtoms::_empty, nsGkAtoms::stylesheet, nullptr}; if (!nsContentUtils::HasNonEmptyAttr(this, kNameSpaceID_None, nsGkAtoms::rev) && diff --git a/dom/html/HTMLPreElement.cpp b/dom/html/HTMLPreElement.cpp index d37fb7cf61f7..e3f05138adf2 100644 --- a/dom/html/HTMLPreElement.cpp +++ b/dom/html/HTMLPreElement.cpp @@ -62,7 +62,7 @@ HTMLPreElement::IsAttributeMapped(const nsAtom* aAttribute) const } static const MappedAttributeEntry attributes[] = { - { &nsGkAtoms::wrap }, + { nsGkAtoms::wrap }, { nullptr }, }; diff --git a/dom/html/HTMLSharedElement.cpp b/dom/html/HTMLSharedElement.cpp index 8f74f5c9ce84..a23238f03d1d 100644 --- a/dom/html/HTMLSharedElement.cpp +++ b/dom/html/HTMLSharedElement.cpp @@ -101,8 +101,8 @@ HTMLSharedElement::IsAttributeMapped(const nsAtom* aAttribute) const { if (mNodeInfo->Equals(nsGkAtoms::dir)) { static const MappedAttributeEntry attributes[] = { - { &nsGkAtoms::type }, - // { &nsGkAtoms::compact }, // XXX + { nsGkAtoms::type }, + // { nsGkAtoms::compact }, // XXX { nullptr} }; diff --git a/dom/html/HTMLSharedListElement.cpp b/dom/html/HTMLSharedListElement.cpp index e06275aecedc..d713acfca134 100644 --- a/dom/html/HTMLSharedListElement.cpp +++ b/dom/html/HTMLSharedListElement.cpp @@ -100,7 +100,7 @@ HTMLSharedListElement::IsAttributeMapped(const nsAtom* aAttribute) const if (mNodeInfo->Equals(nsGkAtoms::ol) || mNodeInfo->Equals(nsGkAtoms::ul)) { static const MappedAttributeEntry attributes[] = { - { &nsGkAtoms::type }, + { nsGkAtoms::type }, { nullptr } }; diff --git a/dom/html/HTMLTableCaptionElement.cpp b/dom/html/HTMLTableCaptionElement.cpp index aeea239640b0..3a6003d1509e 100644 --- a/dom/html/HTMLTableCaptionElement.cpp +++ b/dom/html/HTMLTableCaptionElement.cpp @@ -68,7 +68,7 @@ NS_IMETHODIMP_(bool) HTMLTableCaptionElement::IsAttributeMapped(const nsAtom* aAttribute) const { static const MappedAttributeEntry attributes[] = { - { &nsGkAtoms::align }, + { nsGkAtoms::align }, { nullptr } }; diff --git a/dom/html/HTMLTableCellElement.cpp b/dom/html/HTMLTableCellElement.cpp index 6e2ff464fd8e..02aeddc6c07a 100644 --- a/dom/html/HTMLTableCellElement.cpp +++ b/dom/html/HTMLTableCellElement.cpp @@ -237,19 +237,19 @@ NS_IMETHODIMP_(bool) HTMLTableCellElement::IsAttributeMapped(const nsAtom* aAttribute) const { static const MappedAttributeEntry attributes[] = { - { &nsGkAtoms::align }, - { &nsGkAtoms::valign }, - { &nsGkAtoms::nowrap }, + { nsGkAtoms::align }, + { nsGkAtoms::valign }, + { nsGkAtoms::nowrap }, #if 0 // XXXldb If these are implemented, they might need to move to // GetAttributeChangeHint (depending on how, and preferably not). - { &nsGkAtoms::abbr }, - { &nsGkAtoms::axis }, - { &nsGkAtoms::headers }, - { &nsGkAtoms::scope }, + { nsGkAtoms::abbr }, + { nsGkAtoms::axis }, + { nsGkAtoms::headers }, + { nsGkAtoms::scope }, #endif - { &nsGkAtoms::width }, - { &nsGkAtoms::height }, + { nsGkAtoms::width }, + { nsGkAtoms::height }, { nullptr } }; diff --git a/dom/html/HTMLTableColElement.cpp b/dom/html/HTMLTableColElement.cpp index 20fcc52c8fe0..3160d4e45201 100644 --- a/dom/html/HTMLTableColElement.cpp +++ b/dom/html/HTMLTableColElement.cpp @@ -91,10 +91,10 @@ NS_IMETHODIMP_(bool) HTMLTableColElement::IsAttributeMapped(const nsAtom* aAttribute) const { static const MappedAttributeEntry attributes[] = { - { &nsGkAtoms::width }, - { &nsGkAtoms::align }, - { &nsGkAtoms::valign }, - { &nsGkAtoms::span }, + { nsGkAtoms::width }, + { nsGkAtoms::align }, + { nsGkAtoms::valign }, + { nsGkAtoms::span }, { nullptr } }; diff --git a/dom/html/HTMLTableElement.cpp b/dom/html/HTMLTableElement.cpp index 16268481e29a..7c396aec5bc9 100644 --- a/dom/html/HTMLTableElement.cpp +++ b/dom/html/HTMLTableElement.cpp @@ -1016,17 +1016,17 @@ NS_IMETHODIMP_(bool) HTMLTableElement::IsAttributeMapped(const nsAtom* aAttribute) const { static const MappedAttributeEntry attributes[] = { - { &nsGkAtoms::cellpadding }, - { &nsGkAtoms::cellspacing }, - { &nsGkAtoms::border }, - { &nsGkAtoms::width }, - { &nsGkAtoms::height }, - { &nsGkAtoms::hspace }, - { &nsGkAtoms::vspace }, + { nsGkAtoms::cellpadding }, + { nsGkAtoms::cellspacing }, + { nsGkAtoms::border }, + { nsGkAtoms::width }, + { nsGkAtoms::height }, + { nsGkAtoms::hspace }, + { nsGkAtoms::vspace }, - { &nsGkAtoms::bordercolor }, + { nsGkAtoms::bordercolor }, - { &nsGkAtoms::align }, + { nsGkAtoms::align }, { nullptr } }; diff --git a/dom/html/HTMLTableRowElement.cpp b/dom/html/HTMLTableRowElement.cpp index 8d54db17e499..f71c05ddd60f 100644 --- a/dom/html/HTMLTableRowElement.cpp +++ b/dom/html/HTMLTableRowElement.cpp @@ -273,9 +273,9 @@ NS_IMETHODIMP_(bool) HTMLTableRowElement::IsAttributeMapped(const nsAtom* aAttribute) const { static const MappedAttributeEntry attributes[] = { - { &nsGkAtoms::align }, - { &nsGkAtoms::valign }, - { &nsGkAtoms::height }, + { nsGkAtoms::align }, + { nsGkAtoms::valign }, + { nsGkAtoms::height }, { nullptr } }; diff --git a/dom/html/HTMLTableSectionElement.cpp b/dom/html/HTMLTableSectionElement.cpp index a3f9f7954903..6ef946f76545 100644 --- a/dom/html/HTMLTableSectionElement.cpp +++ b/dom/html/HTMLTableSectionElement.cpp @@ -181,9 +181,9 @@ NS_IMETHODIMP_(bool) HTMLTableSectionElement::IsAttributeMapped(const nsAtom* aAttribute) const { static const MappedAttributeEntry attributes[] = { - { &nsGkAtoms::align }, - { &nsGkAtoms::valign }, - { &nsGkAtoms::height }, + { nsGkAtoms::align }, + { nsGkAtoms::valign }, + { nsGkAtoms::height }, { nullptr } }; diff --git a/dom/html/HTMLTextAreaElement.cpp b/dom/html/HTMLTextAreaElement.cpp index bfe51e855cb3..33decb88acec 100644 --- a/dom/html/HTMLTextAreaElement.cpp +++ b/dom/html/HTMLTextAreaElement.cpp @@ -484,7 +484,7 @@ NS_IMETHODIMP_(bool) HTMLTextAreaElement::IsAttributeMapped(const nsAtom* aAttribute) const { static const MappedAttributeEntry attributes[] = { - { &nsGkAtoms::wrap }, + { nsGkAtoms::wrap }, { nullptr } }; diff --git a/dom/html/HTMLVideoElement.cpp b/dom/html/HTMLVideoElement.cpp index ed1b222feef1..3f6fdb839d35 100644 --- a/dom/html/HTMLVideoElement.cpp +++ b/dom/html/HTMLVideoElement.cpp @@ -111,8 +111,8 @@ NS_IMETHODIMP_(bool) HTMLVideoElement::IsAttributeMapped(const nsAtom* aAttribute) const { static const MappedAttributeEntry attributes[] = { - { &nsGkAtoms::width }, - { &nsGkAtoms::height }, + { nsGkAtoms::width }, + { nsGkAtoms::height }, { nullptr } }; diff --git a/dom/html/nsGenericHTMLElement.cpp b/dom/html/nsGenericHTMLElement.cpp index a46982a61118..f3da651fff8b 100644 --- a/dom/html/nsGenericHTMLElement.cpp +++ b/dom/html/nsGenericHTMLElement.cpp @@ -315,7 +315,7 @@ nsGenericHTMLElement::Spellcheck() for (node = this; node; node = node->GetParent()) { if (node->IsHTMLElement()) { static Element::AttrValuesArray strings[] = - {&nsGkAtoms::_true, &nsGkAtoms::_false, nullptr}; + {nsGkAtoms::_true, nsGkAtoms::_false, nullptr}; switch (node->AsElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::spellcheck, strings, eCaseMatters)) { @@ -1222,49 +1222,49 @@ nsGenericHTMLElement::MapCommonAttributesInto(const nsMappedAttributes* aAttribu /* static */ const nsGenericHTMLElement::MappedAttributeEntry nsGenericHTMLElement::sCommonAttributeMap[] = { - { &nsGkAtoms::contenteditable }, - { &nsGkAtoms::lang }, - { &nsGkAtoms::hidden }, + { nsGkAtoms::contenteditable }, + { nsGkAtoms::lang }, + { nsGkAtoms::hidden }, { nullptr } }; /* static */ const Element::MappedAttributeEntry nsGenericHTMLElement::sImageMarginSizeAttributeMap[] = { - { &nsGkAtoms::width }, - { &nsGkAtoms::height }, - { &nsGkAtoms::hspace }, - { &nsGkAtoms::vspace }, + { nsGkAtoms::width }, + { nsGkAtoms::height }, + { nsGkAtoms::hspace }, + { nsGkAtoms::vspace }, { nullptr } }; /* static */ const Element::MappedAttributeEntry nsGenericHTMLElement::sImageAlignAttributeMap[] = { - { &nsGkAtoms::align }, + { nsGkAtoms::align }, { nullptr } }; /* static */ const Element::MappedAttributeEntry nsGenericHTMLElement::sDivAlignAttributeMap[] = { - { &nsGkAtoms::align }, + { nsGkAtoms::align }, { nullptr } }; /* static */ const Element::MappedAttributeEntry nsGenericHTMLElement::sImageBorderAttributeMap[] = { - { &nsGkAtoms::border }, + { nsGkAtoms::border }, { nullptr } }; /* static */ const Element::MappedAttributeEntry nsGenericHTMLElement::sBackgroundAttributeMap[] = { - { &nsGkAtoms::background }, - { &nsGkAtoms::bgcolor }, + { nsGkAtoms::background }, + { nsGkAtoms::bgcolor }, { nullptr } }; /* static */ const Element::MappedAttributeEntry nsGenericHTMLElement::sBackgroundColorAttributeMap[] = { - { &nsGkAtoms::bgcolor }, + { nsGkAtoms::bgcolor }, { nullptr } }; diff --git a/dom/html/nsGenericHTMLElement.h b/dom/html/nsGenericHTMLElement.h index 2b8711b56303..fd6e19fbf1e3 100644 --- a/dom/html/nsGenericHTMLElement.h +++ b/dom/html/nsGenericHTMLElement.h @@ -921,7 +921,7 @@ protected: ContentEditableTristate GetContentEditableValue() const { static const Element::AttrValuesArray values[] = - { &nsGkAtoms::_false, &nsGkAtoms::_true, &nsGkAtoms::_empty, nullptr }; + { nsGkAtoms::_false, nsGkAtoms::_true, nsGkAtoms::_empty, nullptr }; if (!MayHaveContentEditableAttr()) return eInherit; diff --git a/dom/html/nsTextEditorState.cpp b/dom/html/nsTextEditorState.cpp index 7f79ea5c4d36..658ce4dba174 100644 --- a/dom/html/nsTextEditorState.cpp +++ b/dom/html/nsTextEditorState.cpp @@ -212,7 +212,7 @@ nsITextControlElement::GetWrapPropertyEnum(nsIContent* aContent, nsAutoString wrap; if (aContent->IsHTMLElement()) { static Element::AttrValuesArray strings[] = - {&nsGkAtoms::HARD, &nsGkAtoms::OFF, nullptr}; + {nsGkAtoms::HARD, nsGkAtoms::OFF, nullptr}; switch (aContent->AsElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::wrap, strings, diff --git a/dom/mathml/nsMathMLElement.cpp b/dom/mathml/nsMathMLElement.cpp index faaef93cfdb6..27ef986c4577 100644 --- a/dom/mathml/nsMathMLElement.cpp +++ b/dom/mathml/nsMathMLElement.cpp @@ -183,37 +183,37 @@ nsMathMLElement::ParseAttribute(int32_t aNamespaceID, } static Element::MappedAttributeEntry sMtableStyles[] = { - { &nsGkAtoms::width }, + { nsGkAtoms::width }, { nullptr } }; static Element::MappedAttributeEntry sTokenStyles[] = { - { &nsGkAtoms::mathsize_ }, - { &nsGkAtoms::fontsize_ }, - { &nsGkAtoms::color }, - { &nsGkAtoms::fontfamily_ }, - { &nsGkAtoms::fontstyle_ }, - { &nsGkAtoms::fontweight_ }, - { &nsGkAtoms::mathvariant_}, + { nsGkAtoms::mathsize_ }, + { nsGkAtoms::fontsize_ }, + { nsGkAtoms::color }, + { nsGkAtoms::fontfamily_ }, + { nsGkAtoms::fontstyle_ }, + { nsGkAtoms::fontweight_ }, + { nsGkAtoms::mathvariant_}, { nullptr } }; static Element::MappedAttributeEntry sEnvironmentStyles[] = { - { &nsGkAtoms::scriptlevel_ }, - { &nsGkAtoms::scriptminsize_ }, - { &nsGkAtoms::scriptsizemultiplier_ }, - { &nsGkAtoms::background }, + { nsGkAtoms::scriptlevel_ }, + { nsGkAtoms::scriptminsize_ }, + { nsGkAtoms::scriptsizemultiplier_ }, + { nsGkAtoms::background }, { nullptr } }; static Element::MappedAttributeEntry sCommonPresStyles[] = { - { &nsGkAtoms::mathcolor_ }, - { &nsGkAtoms::mathbackground_ }, + { nsGkAtoms::mathcolor_ }, + { nsGkAtoms::mathbackground_ }, { nullptr } }; static Element::MappedAttributeEntry sDirStyles[] = { - { &nsGkAtoms::dir }, + { nsGkAtoms::dir }, { nullptr } }; @@ -999,13 +999,13 @@ nsMathMLElement::IsLink(nsIURI** aURI) const // result is poorly specified. Either way, we return false. static Element::AttrValuesArray sTypeVals[] = - { &nsGkAtoms::_empty, &nsGkAtoms::simple, nullptr }; + { nsGkAtoms::_empty, nsGkAtoms::simple, nullptr }; static Element::AttrValuesArray sShowVals[] = - { &nsGkAtoms::_empty, &nsGkAtoms::_new, &nsGkAtoms::replace, nullptr }; + { nsGkAtoms::_empty, nsGkAtoms::_new, nsGkAtoms::replace, nullptr }; static Element::AttrValuesArray sActuateVals[] = - { &nsGkAtoms::_empty, &nsGkAtoms::onRequest, nullptr }; + { nsGkAtoms::_empty, nsGkAtoms::onRequest, nullptr }; // Optimization: check for href first for early return href = mAttrsAndChildren.GetAttr(nsGkAtoms::href, @@ -1051,7 +1051,7 @@ nsMathMLElement::GetLinkTarget(nsAString& aTarget) if (aTarget.IsEmpty()) { static Element::AttrValuesArray sShowVals[] = - { &nsGkAtoms::_new, &nsGkAtoms::replace, nullptr }; + { nsGkAtoms::_new, nsGkAtoms::replace, nullptr }; switch (FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms::show, sShowVals, eCaseMatters)) { diff --git a/dom/svg/SVGAElement.cpp b/dom/svg/SVGAElement.cpp index 75fd8d95b9ab..29ff7c647df6 100644 --- a/dom/svg/SVGAElement.cpp +++ b/dom/svg/SVGAElement.cpp @@ -263,13 +263,13 @@ SVGAElement::IsLink(nsIURI** aURI) const // result is poorly specified. Either way, we return false. static Element::AttrValuesArray sTypeVals[] = - { &nsGkAtoms::_empty, &nsGkAtoms::simple, nullptr }; + { nsGkAtoms::_empty, nsGkAtoms::simple, nullptr }; static Element::AttrValuesArray sShowVals[] = - { &nsGkAtoms::_empty, &nsGkAtoms::_new, &nsGkAtoms::replace, nullptr }; + { nsGkAtoms::_empty, nsGkAtoms::_new, nsGkAtoms::replace, nullptr }; static Element::AttrValuesArray sActuateVals[] = - { &nsGkAtoms::_empty, &nsGkAtoms::onRequest, nullptr }; + { nsGkAtoms::_empty, nsGkAtoms::onRequest, nullptr }; // Optimization: check for href first for early return bool useBareHref = mStringAttributes[HREF].IsExplicitlySet(); @@ -305,7 +305,7 @@ SVGAElement::GetLinkTarget(nsAString& aTarget) if (aTarget.IsEmpty()) { static Element::AttrValuesArray sShowVals[] = - { &nsGkAtoms::_new, &nsGkAtoms::replace, nullptr }; + { nsGkAtoms::_new, nsGkAtoms::replace, nullptr }; switch (FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms::show, sShowVals, eCaseMatters)) { diff --git a/dom/svg/nsSVGElement.cpp b/dom/svg/nsSVGElement.cpp index fb41318acd49..69f6dff372b1 100644 --- a/dom/svg/nsSVGElement.cpp +++ b/dom/svg/nsSVGElement.cpp @@ -932,38 +932,38 @@ nsSVGElement::IsAttributeMapped(const nsAtom* name) const // PresentationAttributes-FillStroke /* static */ const Element::MappedAttributeEntry nsSVGElement::sFillStrokeMap[] = { - { &nsGkAtoms::fill }, - { &nsGkAtoms::fill_opacity }, - { &nsGkAtoms::fill_rule }, - { &nsGkAtoms::paint_order }, - { &nsGkAtoms::stroke }, - { &nsGkAtoms::stroke_dasharray }, - { &nsGkAtoms::stroke_dashoffset }, - { &nsGkAtoms::stroke_linecap }, - { &nsGkAtoms::stroke_linejoin }, - { &nsGkAtoms::stroke_miterlimit }, - { &nsGkAtoms::stroke_opacity }, - { &nsGkAtoms::stroke_width }, - { &nsGkAtoms::vector_effect }, + { nsGkAtoms::fill }, + { nsGkAtoms::fill_opacity }, + { nsGkAtoms::fill_rule }, + { nsGkAtoms::paint_order }, + { nsGkAtoms::stroke }, + { nsGkAtoms::stroke_dasharray }, + { nsGkAtoms::stroke_dashoffset }, + { nsGkAtoms::stroke_linecap }, + { nsGkAtoms::stroke_linejoin }, + { nsGkAtoms::stroke_miterlimit }, + { nsGkAtoms::stroke_opacity }, + { nsGkAtoms::stroke_width }, + { nsGkAtoms::vector_effect }, { nullptr } }; // PresentationAttributes-Graphics /* static */ const Element::MappedAttributeEntry nsSVGElement::sGraphicsMap[] = { - { &nsGkAtoms::clip_path }, - { &nsGkAtoms::clip_rule }, - { &nsGkAtoms::colorInterpolation }, - { &nsGkAtoms::cursor }, - { &nsGkAtoms::display }, - { &nsGkAtoms::filter }, - { &nsGkAtoms::image_rendering }, - { &nsGkAtoms::mask }, - { &nsGkAtoms::opacity }, - { &nsGkAtoms::pointer_events }, - { &nsGkAtoms::shape_rendering }, - { &nsGkAtoms::text_rendering }, - { &nsGkAtoms::visibility }, + { nsGkAtoms::clip_path }, + { nsGkAtoms::clip_rule }, + { nsGkAtoms::colorInterpolation }, + { nsGkAtoms::cursor }, + { nsGkAtoms::display }, + { nsGkAtoms::filter }, + { nsGkAtoms::image_rendering }, + { nsGkAtoms::mask }, + { nsGkAtoms::opacity }, + { nsGkAtoms::pointer_events }, + { nsGkAtoms::shape_rendering }, + { nsGkAtoms::text_rendering }, + { nsGkAtoms::visibility }, { nullptr } }; @@ -971,90 +971,90 @@ nsSVGElement::sGraphicsMap[] = { /* static */ const Element::MappedAttributeEntry nsSVGElement::sTextContentElementsMap[] = { // Properties that we don't support are commented out. - // { &nsGkAtoms::alignment_baseline }, - // { &nsGkAtoms::baseline_shift }, - { &nsGkAtoms::direction }, - { &nsGkAtoms::dominant_baseline }, - { &nsGkAtoms::letter_spacing }, - { &nsGkAtoms::text_anchor }, - { &nsGkAtoms::text_decoration }, - { &nsGkAtoms::unicode_bidi }, - { &nsGkAtoms::word_spacing }, - { &nsGkAtoms::writing_mode }, + // { nsGkAtoms::alignment_baseline }, + // { nsGkAtoms::baseline_shift }, + { nsGkAtoms::direction }, + { nsGkAtoms::dominant_baseline }, + { nsGkAtoms::letter_spacing }, + { nsGkAtoms::text_anchor }, + { nsGkAtoms::text_decoration }, + { nsGkAtoms::unicode_bidi }, + { nsGkAtoms::word_spacing }, + { nsGkAtoms::writing_mode }, { nullptr } }; // PresentationAttributes-FontSpecification /* static */ const Element::MappedAttributeEntry nsSVGElement::sFontSpecificationMap[] = { - { &nsGkAtoms::font_family }, - { &nsGkAtoms::font_size }, - { &nsGkAtoms::font_size_adjust }, - { &nsGkAtoms::font_stretch }, - { &nsGkAtoms::font_style }, - { &nsGkAtoms::font_variant }, - { &nsGkAtoms::fontWeight }, + { nsGkAtoms::font_family }, + { nsGkAtoms::font_size }, + { nsGkAtoms::font_size_adjust }, + { nsGkAtoms::font_stretch }, + { nsGkAtoms::font_style }, + { nsGkAtoms::font_variant }, + { nsGkAtoms::fontWeight }, { nullptr } }; // PresentationAttributes-GradientStop /* static */ const Element::MappedAttributeEntry nsSVGElement::sGradientStopMap[] = { - { &nsGkAtoms::stop_color }, - { &nsGkAtoms::stop_opacity }, + { nsGkAtoms::stop_color }, + { nsGkAtoms::stop_opacity }, { nullptr } }; // PresentationAttributes-Viewports /* static */ const Element::MappedAttributeEntry nsSVGElement::sViewportsMap[] = { - { &nsGkAtoms::overflow }, - { &nsGkAtoms::clip }, + { nsGkAtoms::overflow }, + { nsGkAtoms::clip }, { nullptr } }; // PresentationAttributes-Makers /* static */ const Element::MappedAttributeEntry nsSVGElement::sMarkersMap[] = { - { &nsGkAtoms::marker_end }, - { &nsGkAtoms::marker_mid }, - { &nsGkAtoms::marker_start }, + { nsGkAtoms::marker_end }, + { nsGkAtoms::marker_mid }, + { nsGkAtoms::marker_start }, { nullptr } }; // PresentationAttributes-Color /* static */ const Element::MappedAttributeEntry nsSVGElement::sColorMap[] = { - { &nsGkAtoms::color }, + { nsGkAtoms::color }, { nullptr } }; // PresentationAttributes-Filters /* static */ const Element::MappedAttributeEntry nsSVGElement::sFiltersMap[] = { - { &nsGkAtoms::colorInterpolationFilters }, + { nsGkAtoms::colorInterpolationFilters }, { nullptr } }; // PresentationAttributes-feFlood /* static */ const Element::MappedAttributeEntry nsSVGElement::sFEFloodMap[] = { - { &nsGkAtoms::flood_color }, - { &nsGkAtoms::flood_opacity }, + { nsGkAtoms::flood_color }, + { nsGkAtoms::flood_opacity }, { nullptr } }; // PresentationAttributes-LightingEffects /* static */ const Element::MappedAttributeEntry nsSVGElement::sLightingEffectsMap[] = { - { &nsGkAtoms::lighting_color }, + { nsGkAtoms::lighting_color }, { nullptr } }; // PresentationAttributes-mask /* static */ const Element::MappedAttributeEntry nsSVGElement::sMaskMap[] = { - { &nsGkAtoms::mask_type }, + { nsGkAtoms::mask_type }, { nullptr } }; diff --git a/dom/xbl/nsXBLPrototypeBinding.cpp b/dom/xbl/nsXBLPrototypeBinding.cpp index a187fcb70279..826ba7e70ab3 100644 --- a/dom/xbl/nsXBLPrototypeBinding.cpp +++ b/dom/xbl/nsXBLPrototypeBinding.cpp @@ -1557,16 +1557,16 @@ nsXBLPrototypeBinding::WriteNamespace(nsIObjectOutputStream* aStream, bool CheckTagNameWhiteList(int32_t aNameSpaceID, nsAtom *aTagName) { static Element::AttrValuesArray kValidXULTagNames[] = { - &nsGkAtoms::autorepeatbutton, &nsGkAtoms::box, &nsGkAtoms::browser, - &nsGkAtoms::button, &nsGkAtoms::hbox, &nsGkAtoms::image, &nsGkAtoms::menu, - &nsGkAtoms::menubar, &nsGkAtoms::menuitem, &nsGkAtoms::menupopup, - &nsGkAtoms::row, &nsGkAtoms::slider, &nsGkAtoms::spacer, - &nsGkAtoms::splitter, &nsGkAtoms::text, &nsGkAtoms::tree, nullptr}; + nsGkAtoms::autorepeatbutton, nsGkAtoms::box, nsGkAtoms::browser, + nsGkAtoms::button, nsGkAtoms::hbox, nsGkAtoms::image, nsGkAtoms::menu, + nsGkAtoms::menubar, nsGkAtoms::menuitem, nsGkAtoms::menupopup, + nsGkAtoms::row, nsGkAtoms::slider, nsGkAtoms::spacer, + nsGkAtoms::splitter, nsGkAtoms::text, nsGkAtoms::tree, nullptr}; uint32_t i; if (aNameSpaceID == kNameSpaceID_XUL) { for (i = 0; kValidXULTagNames[i]; ++i) { - if (aTagName == *(kValidXULTagNames[i])) { + if (aTagName == kValidXULTagNames[i]) { return true; } } diff --git a/dom/xul/XULDocument.cpp b/dom/xul/XULDocument.cpp index ad846c7c0262..66d06cbebf94 100644 --- a/dom/xul/XULDocument.cpp +++ b/dom/xul/XULDocument.cpp @@ -4132,7 +4132,7 @@ XULDocument::IsDocumentRightToLeft() Element* element = GetRootElement(); if (element) { static Element::AttrValuesArray strings[] = - {&nsGkAtoms::ltr, &nsGkAtoms::rtl, nullptr}; + {nsGkAtoms::ltr, nsGkAtoms::rtl, nullptr}; switch (element->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::localedir, strings, eCaseMatters)) { case 0: return false; diff --git a/layout/base/PositionedEventTargeting.cpp b/layout/base/PositionedEventTargeting.cpp index d401cab34def..0018d10f2da3 100644 --- a/layout/base/PositionedEventTargeting.cpp +++ b/layout/base/PositionedEventTargeting.cpp @@ -248,7 +248,7 @@ GetClickableAncestor(nsIFrame* aFrame, nsAtom* stopAt = nullptr, nsAutoString* a } static Element::AttrValuesArray clickableRoles[] = - { &nsGkAtoms::button, &nsGkAtoms::key, nullptr }; + { nsGkAtoms::button, nsGkAtoms::key, nullptr }; if (content->IsElement() && content->AsElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::role, clickableRoles, eIgnoreCase) >= 0) { diff --git a/layout/generic/nsImageMap.cpp b/layout/generic/nsImageMap.cpp index ba159373945f..ab067a6e3212 100644 --- a/layout/generic/nsImageMap.cpp +++ b/layout/generic/nsImageMap.cpp @@ -793,10 +793,10 @@ void nsImageMap::AddArea(HTMLAreaElement* aArea) { static Element::AttrValuesArray strings[] = - {&nsGkAtoms::rect, &nsGkAtoms::rectangle, - &nsGkAtoms::circle, &nsGkAtoms::circ, - &nsGkAtoms::_default, - &nsGkAtoms::poly, &nsGkAtoms::polygon, + {nsGkAtoms::rect, nsGkAtoms::rectangle, + nsGkAtoms::circle, nsGkAtoms::circ, + nsGkAtoms::_default, + nsGkAtoms::poly, nsGkAtoms::polygon, nullptr}; UniquePtr area; diff --git a/layout/xul/nsBoxFrame.cpp b/layout/xul/nsBoxFrame.cpp index 3e9d270c2311..d1194e9aa240 100644 --- a/layout/xul/nsBoxFrame.cpp +++ b/layout/xul/nsBoxFrame.cpp @@ -204,7 +204,7 @@ nsBoxFrame::Init(nsIContent* aContent, void nsBoxFrame::UpdateMouseThrough() { static Element::AttrValuesArray strings[] = - {&nsGkAtoms::never, &nsGkAtoms::always, nullptr}; + {nsGkAtoms::never, nsGkAtoms::always, nullptr}; switch (mContent->AsElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::mousethrough, strings, eCaseMatters)) { case 0: AddStateBits(NS_FRAME_MOUSE_THROUGH_NEVER); break; @@ -284,7 +284,7 @@ nsBoxFrame::GetInitialDebug(bool& aDebug) return false; static Element::AttrValuesArray strings[] = - {&nsGkAtoms::_false, &nsGkAtoms::_true, nullptr}; + {nsGkAtoms::_false, nsGkAtoms::_true, nullptr}; int32_t index = GetContent()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::debug, strings, eCaseMatters); if (index >= 0) { @@ -305,7 +305,7 @@ nsBoxFrame::GetInitialHAlignment(nsBoxFrame::Halignment& aHalign) Element* element = GetContent()->AsElement(); // XXXdwh Everything inside this if statement is deprecated code. static Element::AttrValuesArray alignStrings[] = - {&nsGkAtoms::left, &nsGkAtoms::right, nullptr}; + {nsGkAtoms::left, nsGkAtoms::right, nullptr}; static const Halignment alignValues[] = {hAlign_Left, hAlign_Right}; int32_t index = element->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::align, alignStrings, eCaseMatters); @@ -319,7 +319,7 @@ nsBoxFrame::GetInitialHAlignment(nsBoxFrame::Halignment& aHalign) // we are checking the ALIGN attribute. nsAtom* attrName = IsXULHorizontal() ? nsGkAtoms::pack : nsGkAtoms::align; static Element::AttrValuesArray strings[] = - {&nsGkAtoms::_empty, &nsGkAtoms::start, &nsGkAtoms::center, &nsGkAtoms::end, nullptr}; + {nsGkAtoms::_empty, nsGkAtoms::start, nsGkAtoms::center, nsGkAtoms::end, nullptr}; static const Halignment values[] = {hAlign_Left/*not used*/, hAlign_Left, hAlign_Center, hAlign_Right}; index = element->FindAttrValueIn(kNameSpaceID_None, attrName, @@ -381,7 +381,7 @@ nsBoxFrame::GetInitialVAlignment(nsBoxFrame::Valignment& aValign) Element* element = GetContent()->AsElement(); static Element::AttrValuesArray valignStrings[] = - {&nsGkAtoms::top, &nsGkAtoms::baseline, &nsGkAtoms::middle, &nsGkAtoms::bottom, nullptr}; + {nsGkAtoms::top, nsGkAtoms::baseline, nsGkAtoms::middle, nsGkAtoms::bottom, nullptr}; static const Valignment valignValues[] = {vAlign_Top, vAlign_BaseLine, vAlign_Middle, vAlign_Bottom}; int32_t index = element->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::valign, @@ -396,8 +396,8 @@ nsBoxFrame::GetInitialVAlignment(nsBoxFrame::Valignment& aValign) // we are checking the PACK attribute. nsAtom* attrName = IsXULHorizontal() ? nsGkAtoms::align : nsGkAtoms::pack; static Element::AttrValuesArray strings[] = - {&nsGkAtoms::_empty, &nsGkAtoms::start, &nsGkAtoms::center, - &nsGkAtoms::baseline, &nsGkAtoms::end, nullptr}; + {nsGkAtoms::_empty, nsGkAtoms::start, nsGkAtoms::center, + nsGkAtoms::baseline, nsGkAtoms::end, nullptr}; static const Valignment values[] = {vAlign_Top/*not used*/, vAlign_Top, vAlign_Middle, vAlign_BaseLine, vAlign_Bottom}; index = element->FindAttrValueIn(kNameSpaceID_None, attrName, @@ -473,7 +473,7 @@ nsBoxFrame::GetInitialOrientation(bool& aIsHorizontal) return; static Element::AttrValuesArray strings[] = - {&nsGkAtoms::vertical, &nsGkAtoms::horizontal, nullptr}; + {nsGkAtoms::vertical, nsGkAtoms::horizontal, nullptr}; int32_t index = GetContent()->AsElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::orient, strings, eCaseMatters); @@ -512,7 +512,7 @@ nsBoxFrame::GetInitialDirection(bool& aIsNormal) // the style system value. if (IsXULHorizontal()) { static Element::AttrValuesArray strings[] = - {&nsGkAtoms::reverse, &nsGkAtoms::ltr, &nsGkAtoms::rtl, nullptr}; + {nsGkAtoms::reverse, nsGkAtoms::ltr, nsGkAtoms::rtl, nullptr}; int32_t index = element->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::dir, strings, eCaseMatters); if (index >= 0) { @@ -555,7 +555,7 @@ nsBoxFrame::GetInitialAutoStretch(bool& aStretch) // Check the align attribute. if (GetContent()->IsElement()) { static Element::AttrValuesArray strings[] = - {&nsGkAtoms::_empty, &nsGkAtoms::stretch, nullptr}; + {nsGkAtoms::_empty, nsGkAtoms::stretch, nullptr}; int32_t index = GetContent()->AsElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::align, strings, eCaseMatters); diff --git a/layout/xul/nsImageBoxFrame.cpp b/layout/xul/nsImageBoxFrame.cpp index 5544871c118a..8813a87fbe9f 100644 --- a/layout/xul/nsImageBoxFrame.cpp +++ b/layout/xul/nsImageBoxFrame.cpp @@ -300,7 +300,7 @@ void nsImageBoxFrame::UpdateLoadFlags() { static Element::AttrValuesArray strings[] = - {&nsGkAtoms::always, &nsGkAtoms::never, nullptr}; + {nsGkAtoms::always, nsGkAtoms::never, nullptr}; switch (mContent->AsElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::validate, strings, eCaseMatters)) { diff --git a/layout/xul/nsLeafBoxFrame.cpp b/layout/xul/nsLeafBoxFrame.cpp index 29e489bcdd38..7c7cf3c613a8 100644 --- a/layout/xul/nsLeafBoxFrame.cpp +++ b/layout/xul/nsLeafBoxFrame.cpp @@ -84,7 +84,7 @@ nsLeafBoxFrame::AttributeChanged(int32_t aNameSpaceID, void nsLeafBoxFrame::UpdateMouseThrough() { static Element::AttrValuesArray strings[] = - {&nsGkAtoms::never, &nsGkAtoms::always, nullptr}; + {nsGkAtoms::never, nsGkAtoms::always, nullptr}; switch (mContent->AsElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::mousethrough, strings, eCaseMatters)) { diff --git a/layout/xul/nsMenuFrame.cpp b/layout/xul/nsMenuFrame.cpp index 8698122ff998..08b504acb557 100644 --- a/layout/xul/nsMenuFrame.cpp +++ b/layout/xul/nsMenuFrame.cpp @@ -944,7 +944,7 @@ void nsMenuFrame::UpdateMenuType() { static Element::AttrValuesArray strings[] = - {&nsGkAtoms::checkbox, &nsGkAtoms::radio, nullptr}; + {nsGkAtoms::checkbox, nsGkAtoms::radio, nullptr}; switch (mContent->AsElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::type, strings, eCaseMatters)) { diff --git a/layout/xul/nsMenuPopupFrame.cpp b/layout/xul/nsMenuPopupFrame.cpp index 02c2c72bb655..eeed94ab5328 100644 --- a/layout/xul/nsMenuPopupFrame.cpp +++ b/layout/xul/nsMenuPopupFrame.cpp @@ -226,7 +226,7 @@ nsMenuPopupFrame::PopupLevel(bool aIsNoAutoHide) const // If the level attribute has been set, use that. static Element::AttrValuesArray strings[] = - {&nsGkAtoms::top, &nsGkAtoms::parent, &nsGkAtoms::floating, nullptr}; + {nsGkAtoms::top, nsGkAtoms::parent, nsGkAtoms::floating, nullptr}; switch (mContent->AsElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::level, strings, eCaseMatters)) { diff --git a/layout/xul/nsResizerFrame.cpp b/layout/xul/nsResizerFrame.cpp index b2e33c1df657..72270eb58975 100644 --- a/layout/xul/nsResizerFrame.cpp +++ b/layout/xul/nsResizerFrame.cpp @@ -494,10 +494,10 @@ nsResizerFrame::Direction nsResizerFrame::GetDirection() { static const Element::AttrValuesArray strings[] = - {&nsGkAtoms::topleft, &nsGkAtoms::top, &nsGkAtoms::topright, - &nsGkAtoms::left, &nsGkAtoms::right, - &nsGkAtoms::bottomleft, &nsGkAtoms::bottom, &nsGkAtoms::bottomright, - &nsGkAtoms::bottomstart, &nsGkAtoms::bottomend, + {nsGkAtoms::topleft, nsGkAtoms::top, nsGkAtoms::topright, + nsGkAtoms::left, nsGkAtoms::right, + nsGkAtoms::bottomleft, nsGkAtoms::bottom, nsGkAtoms::bottomright, + nsGkAtoms::bottomstart, nsGkAtoms::bottomend, nullptr}; static const Direction directions[] = diff --git a/layout/xul/nsScrollbarButtonFrame.cpp b/layout/xul/nsScrollbarButtonFrame.cpp index 12faa573bee8..bc4de1f0118f 100644 --- a/layout/xul/nsScrollbarButtonFrame.cpp +++ b/layout/xul/nsScrollbarButtonFrame.cpp @@ -113,8 +113,8 @@ nsScrollbarButtonFrame::HandleButtonPress(nsPresContext* aPresContext, if (scrollbar == nullptr) return false; - static Element::AttrValuesArray strings[] = { &nsGkAtoms::increment, - &nsGkAtoms::decrement, + static Element::AttrValuesArray strings[] = { nsGkAtoms::increment, + nsGkAtoms::decrement, nullptr }; int32_t index = mContent->AsElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::type, diff --git a/layout/xul/nsSplitterFrame.cpp b/layout/xul/nsSplitterFrame.cpp index 4cd3819b8a83..f07dd49a695c 100644 --- a/layout/xul/nsSplitterFrame.cpp +++ b/layout/xul/nsSplitterFrame.cpp @@ -136,7 +136,7 @@ nsSplitterFrameInner::ResizeType nsSplitterFrameInner::GetResizeBefore() { static Element::AttrValuesArray strings[] = - {&nsGkAtoms::farthest, &nsGkAtoms::flex, nullptr}; + {nsGkAtoms::farthest, nsGkAtoms::flex, nullptr}; switch (SplitterElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::resizebefore, strings, eCaseMatters)) { @@ -154,7 +154,7 @@ nsSplitterFrameInner::ResizeType nsSplitterFrameInner::GetResizeAfter() { static Element::AttrValuesArray strings[] = - {&nsGkAtoms::farthest, &nsGkAtoms::flex, &nsGkAtoms::grow, nullptr}; + {nsGkAtoms::farthest, nsGkAtoms::flex, nsGkAtoms::grow, nullptr}; switch (SplitterElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::resizeafter, strings, eCaseMatters)) { @@ -169,9 +169,9 @@ nsSplitterFrameInner::State nsSplitterFrameInner::GetState() { static Element::AttrValuesArray strings[] = - {&nsGkAtoms::dragging, &nsGkAtoms::collapsed, nullptr}; + {nsGkAtoms::dragging, nsGkAtoms::collapsed, nullptr}; static Element::AttrValuesArray strings_substate[] = - {&nsGkAtoms::before, &nsGkAtoms::after, nullptr}; + {nsGkAtoms::before, nsGkAtoms::after, nullptr}; switch (SplitterElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::state, strings, eCaseMatters)) { @@ -799,7 +799,7 @@ nsSplitterFrameInner::SupportsCollapseDirection ) { static Element::AttrValuesArray strings[] = - {&nsGkAtoms::before, &nsGkAtoms::after, &nsGkAtoms::both, nullptr}; + {nsGkAtoms::before, nsGkAtoms::after, nsGkAtoms::both, nullptr}; switch (SplitterElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::collapse, diff --git a/layout/xul/nsTextBoxFrame.cpp b/layout/xul/nsTextBoxFrame.cpp index 7fa6617b6ebb..48a65cc62810 100644 --- a/layout/xul/nsTextBoxFrame.cpp +++ b/layout/xul/nsTextBoxFrame.cpp @@ -235,8 +235,8 @@ nsTextBoxFrame::UpdateAttributes(nsAtom* aAttribute, if (aAttribute == nullptr || aAttribute == nsGkAtoms::crop) { static Element::AttrValuesArray strings[] = - {&nsGkAtoms::left, &nsGkAtoms::start, &nsGkAtoms::center, - &nsGkAtoms::right, &nsGkAtoms::end, &nsGkAtoms::none, nullptr}; + {nsGkAtoms::left, nsGkAtoms::start, nsGkAtoms::center, + nsGkAtoms::right, nsGkAtoms::end, nsGkAtoms::none, nullptr}; CroppingStyle cropType; switch (mContent->AsElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::crop, strings, diff --git a/layout/xul/nsXULPopupManager.cpp b/layout/xul/nsXULPopupManager.cpp index b711380be35e..ca19b122389d 100644 --- a/layout/xul/nsXULPopupManager.cpp +++ b/layout/xul/nsXULPopupManager.cpp @@ -1375,7 +1375,7 @@ nsXULPopupManager::ExecuteMenu(nsIContent* aMenu, nsXULMenuCommandEvent* aEvent) CloseMenuMode cmm = CloseMenuMode_Auto; static Element::AttrValuesArray strings[] = - {&nsGkAtoms::none, &nsGkAtoms::single, nullptr}; + {nsGkAtoms::none, nsGkAtoms::single, nullptr}; if (aMenu->IsElement()) { switch (aMenu->AsElement()->FindAttrValueIn(kNameSpaceID_None, diff --git a/layout/xul/tree/nsTreeColumns.cpp b/layout/xul/tree/nsTreeColumns.cpp index 4824c1494d1a..be70b4a79457 100644 --- a/layout/xul/tree/nsTreeColumns.cpp +++ b/layout/xul/tree/nsTreeColumns.cpp @@ -319,8 +319,7 @@ nsTreeColumn::Invalidate() // Figure out our column type. Default type is text. mType = nsITreeColumn::TYPE_TEXT; static Element::AttrValuesArray typestrings[] = - {&nsGkAtoms::checkbox, &nsGkAtoms::password, - nullptr}; + {nsGkAtoms::checkbox, nsGkAtoms::password, nullptr}; switch (mContent->AsElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::type, typestrings, @@ -332,7 +331,7 @@ nsTreeColumn::Invalidate() // Fetch the crop style. mCropStyle = 0; static Element::AttrValuesArray cropstrings[] = - {&nsGkAtoms::center, &nsGkAtoms::left, &nsGkAtoms::start, nullptr}; + {nsGkAtoms::center, nsGkAtoms::left, nsGkAtoms::start, nullptr}; switch (mContent->AsElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::crop, cropstrings, eCaseMatters)) { diff --git a/layout/xul/tree/nsTreeContentView.cpp b/layout/xul/tree/nsTreeContentView.cpp index f5096ead5009..90a73bbb4931 100644 --- a/layout/xul/tree/nsTreeContentView.cpp +++ b/layout/xul/tree/nsTreeContentView.cpp @@ -669,7 +669,7 @@ nsTreeContentView::CycleHeader(nsTreeColumn& aColumn, ErrorResult& aError) if (xs) { nsAutoString sortdirection; static Element::AttrValuesArray strings[] = - {&nsGkAtoms::ascending, &nsGkAtoms::descending, nullptr}; + {nsGkAtoms::ascending, nsGkAtoms::descending, nullptr}; switch (column->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::sortDirection, strings, eCaseMatters)) { diff --git a/layout/xul/tree/nsTreeSelection.cpp b/layout/xul/tree/nsTreeSelection.cpp index afdaad7faf9d..beb964e9d382 100644 --- a/layout/xul/tree/nsTreeSelection.cpp +++ b/layout/xul/tree/nsTreeSelection.cpp @@ -291,7 +291,7 @@ NS_IMETHODIMP nsTreeSelection::SetTree(nsITreeBoxObject * aTree) NS_IMETHODIMP nsTreeSelection::GetSingle(bool* aSingle) { static Element::AttrValuesArray strings[] = - {&nsGkAtoms::single, &nsGkAtoms::cell, &nsGkAtoms::text, nullptr}; + {nsGkAtoms::single, nsGkAtoms::cell, nsGkAtoms::text, nullptr}; nsCOMPtr content = GetContent(); if (!content) { diff --git a/widget/cocoa/nsMenuX.mm b/widget/cocoa/nsMenuX.mm index a8b5bfd104d1..23fb159eb8ab 100644 --- a/widget/cocoa/nsMenuX.mm +++ b/widget/cocoa/nsMenuX.mm @@ -521,7 +521,7 @@ void nsMenuX::LoadMenuItem(nsIContent* inMenuItemContent) itemType = eSeparatorMenuItemType; } else if (inMenuItemContent->IsElement()) { static Element::AttrValuesArray strings[] = - {&nsGkAtoms::checkbox, &nsGkAtoms::radio, nullptr}; + {nsGkAtoms::checkbox, nsGkAtoms::radio, nullptr}; switch (inMenuItemContent->AsElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::type, strings, eCaseMatters)) { diff --git a/widget/nsNativeTheme.cpp b/widget/nsNativeTheme.cpp index 681109288c7c..c868880fdf7e 100644 --- a/widget/nsNativeTheme.cpp +++ b/widget/nsNativeTheme.cpp @@ -410,8 +410,8 @@ nsNativeTheme::GetScrollbarButtonType(nsIFrame* aFrame) return 0; static Element::AttrValuesArray strings[] = - {&nsGkAtoms::scrollbarDownBottom, &nsGkAtoms::scrollbarDownTop, - &nsGkAtoms::scrollbarUpBottom, &nsGkAtoms::scrollbarUpTop, + {nsGkAtoms::scrollbarDownBottom, nsGkAtoms::scrollbarDownTop, + nsGkAtoms::scrollbarUpBottom, nsGkAtoms::scrollbarUpTop, nullptr}; nsIContent* content = aFrame->GetContent(); @@ -439,7 +439,7 @@ nsNativeTheme::GetTreeSortDirection(nsIFrame* aFrame) return eTreeSortDirection_Natural; static Element::AttrValuesArray strings[] = - {&nsGkAtoms::descending, &nsGkAtoms::ascending, nullptr}; + {nsGkAtoms::descending, nsGkAtoms::ascending, nullptr}; nsIContent* content = aFrame->GetContent(); if (content->IsElement()) { From 65653d8de193607f636261ceb0fcfd32f5a2c41d Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 3 Apr 2018 22:15:30 +1000 Subject: [PATCH 84/88] Bug 1451169 - Reduce indirection for static atom pointers in nsCSSFrameConstructor.h. r=xidorn MozReview-Commit-ID: Kt3QfZsk0zD --HG-- extra : rebase_source : e4bd0efe51064bb18a446655a52f5b75807ba696 --- layout/base/nsCSSFrameConstructor.cpp | 5 ++--- layout/base/nsCSSFrameConstructor.h | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 243f7da121f4..c6486e9d6ad6 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -397,7 +397,7 @@ GetFieldSetBlockFrame(nsIFrame* aFieldsetFrame) { _flags, { (FrameCreationFunc)_func }, nullptr, nullptr } #define FCDATA_WITH_WRAPPING_BLOCK(_flags, _func, _anon_box) \ { _flags | FCDATA_CREATE_BLOCK_WRAPPER_FOR_ALL_KIDS, \ - { (FrameCreationFunc)_func }, nullptr, &_anon_box } + { (FrameCreationFunc)_func }, nullptr, _anon_box } #define UNREACHABLE_FCDATA() \ { 0, { (FrameCreationFunc)nullptr }, nullptr, nullptr } @@ -3905,8 +3905,7 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt nsIFrame* possiblyLeafFrame = newFrame; if (bits & FCDATA_CREATE_BLOCK_WRAPPER_FOR_ALL_KIDS) { RefPtr outerSC = mPresShell->StyleSet()-> - ResolveInheritingAnonymousBoxStyle(*data->mAnonBoxPseudo, - computedStyle); + ResolveInheritingAnonymousBoxStyle(data->mAnonBoxPseudo, computedStyle); #ifdef DEBUG nsContainerFrame* containerFrame = do_QueryFrame(newFrame); MOZ_ASSERT(containerFrame); diff --git a/layout/base/nsCSSFrameConstructor.h b/layout/base/nsCSSFrameConstructor.h index c768e79d244f..39cc3159a4a0 100644 --- a/layout/base/nsCSSFrameConstructor.h +++ b/layout/base/nsCSSFrameConstructor.h @@ -743,7 +743,7 @@ private: FrameFullConstructor mFullConstructor; // For cases when FCDATA_CREATE_BLOCK_WRAPPER_FOR_ALL_KIDS is set, the // anonymous box type to use for that wrapper. - nsICSSAnonBoxPseudo * const * const mAnonBoxPseudo; + nsICSSAnonBoxPseudo* const mAnonBoxPseudo; }; /* Structure representing a mapping of an atom to a FrameConstructionData. @@ -753,7 +753,7 @@ private: struct FrameConstructionDataByTag { // Pointer to nsStaticAtom* is used because we want to initialize this // statically, so before our atom tables are set up. - const nsStaticAtom * const * const mTag; + const nsStaticAtom* const* mTag; const FrameConstructionData mData; }; @@ -784,7 +784,7 @@ private: for a table pseudo-frame */ struct PseudoParentData { const FrameConstructionData mFCData; - nsICSSAnonBoxPseudo * const * const mPseudoType; + nsICSSAnonBoxPseudo* const* mPseudoType; }; /* Array of such structures that we use to properly construct table pseudo-frames as needed */ From bfe00b7ed419955a22c90c3c148beea04eb71e8c Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 3 Apr 2018 22:15:31 +1000 Subject: [PATCH 85/88] Bug 1451169 - Reduce indirection for FrameConstructionDataByTag::mTag. r=xidorn MozReview-Commit-ID: 4qNZF7SS2bS --HG-- extra : rebase_source : b6bda58ac9bf80c45f41427bcec53538fb927f1a --- layout/base/nsCSSFrameConstructor.cpp | 32 +++++++++++++-------------- layout/base/nsCSSFrameConstructor.h | 4 +--- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index c6486e9d6ad6..914c1fbe63e6 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -3519,7 +3519,7 @@ nsCSSFrameConstructor::FindDataByTag(nsAtom* aTag, *endData = aDataPtr + aDataLength; curData != endData; ++curData) { - if (*curData->mTag == aTag) { + if (curData->mTag == aTag) { if (aTagFound) { *aTagFound = true; } @@ -3543,11 +3543,11 @@ nsCSSFrameConstructor::FindDataByTag(nsAtom* aTag, { _int, FULL_CTOR_FCDATA(0, _func) } #define SIMPLE_TAG_CREATE(_tag, _func) \ - { &nsGkAtoms::_tag, SIMPLE_FCDATA(_func) } + { nsGkAtoms::_tag, SIMPLE_FCDATA(_func) } #define SIMPLE_TAG_CHAIN(_tag, _func) \ - { &nsGkAtoms::_tag, FCDATA_DECL(FCDATA_FUNC_IS_DATA_GETTER, _func) } + { nsGkAtoms::_tag, FCDATA_DECL(FCDATA_FUNC_IS_DATA_GETTER, _func) } #define COMPLEX_TAG_CREATE(_tag, _func) \ - { &nsGkAtoms::_tag, FULL_CTOR_FCDATA(0, _func) } + { nsGkAtoms::_tag, FULL_CTOR_FCDATA(0, _func) } static bool IsFrameForFieldSet(nsIFrame* aFrame) @@ -3597,7 +3597,7 @@ nsCSSFrameConstructor::FindHTMLData(Element* aElement, SIMPLE_TAG_CHAIN(img, nsCSSFrameConstructor::FindImgData), SIMPLE_TAG_CHAIN(mozgeneratedcontentimage, nsCSSFrameConstructor::FindImgData), - { &nsGkAtoms::br, + { nsGkAtoms::br, FCDATA_DECL(FCDATA_IS_LINE_PARTICIPANT | FCDATA_IS_LINE_BREAK, NS_NewBRFrame) }, SIMPLE_TAG_CREATE(wbr, NS_NewWBRFrame), @@ -3608,12 +3608,12 @@ nsCSSFrameConstructor::FindHTMLData(Element* aElement, SIMPLE_TAG_CHAIN(embed, nsCSSFrameConstructor::FindObjectData), COMPLEX_TAG_CREATE(fieldset, &nsCSSFrameConstructor::ConstructFieldSetFrame), - { &nsGkAtoms::legend, + { nsGkAtoms::legend, FCDATA_DECL(FCDATA_ALLOW_BLOCK_STYLES | FCDATA_MAY_NEED_SCROLLFRAME, NS_NewLegendFrame) }, SIMPLE_TAG_CREATE(frameset, NS_NewHTMLFramesetFrame), SIMPLE_TAG_CREATE(iframe, NS_NewSubDocumentFrame), - { &nsGkAtoms::button, + { nsGkAtoms::button, FCDATA_WITH_WRAPPING_BLOCK(FCDATA_ALLOW_BLOCK_STYLES | FCDATA_ALLOW_GRID_FLEX_COLUMNSET, NS_NewHTMLButtonControlFrame, @@ -4284,9 +4284,9 @@ bool IsXULDisplayType(const nsStyleDisplay* aDisplay) FCDATA_MAY_NEED_SCROLLFRAME, _func) #define SIMPLE_XUL_CREATE(_tag, _func) \ - { &nsGkAtoms::_tag, SIMPLE_XUL_FCDATA(_func) } + { nsGkAtoms::_tag, SIMPLE_XUL_FCDATA(_func) } #define SCROLLABLE_XUL_CREATE(_tag, _func) \ - { &nsGkAtoms::_tag, SCROLLABLE_XUL_FCDATA(_func) } + { nsGkAtoms::_tag, SCROLLABLE_XUL_FCDATA(_func) } #define SIMPLE_XUL_DISPLAY_CREATE(_display, _func) \ FCDATA_FOR_DISPLAY(_display, SIMPLE_XUL_FCDATA(_func)) #define SCROLLABLE_XUL_DISPLAY_CREATE(_display, _func) \ @@ -5075,10 +5075,10 @@ nsCSSFrameConstructor::FlushAccumulatedBlock(nsFrameConstructorState& aState, // Only elements can be floated or positioned. All other MathML // should be in-flow. #define SIMPLE_MATHML_CREATE(_tag, _func) \ - { &nsGkAtoms::_tag, \ - FCDATA_DECL(FCDATA_DISALLOW_OUT_OF_FLOW | \ - FCDATA_FORCE_NULL_ABSPOS_CONTAINER | \ - FCDATA_WRAP_KIDS_IN_BLOCKS, _func) } + { nsGkAtoms::_tag, \ + FCDATA_DECL(FCDATA_DISALLOW_OUT_OF_FLOW | \ + FCDATA_FORCE_NULL_ABSPOS_CONTAINER | \ + FCDATA_WRAP_KIDS_IN_BLOCKS, _func) } /* static */ const nsCSSFrameConstructor::FrameConstructionData* @@ -5253,7 +5253,7 @@ nsCSSFrameConstructor::ConstructMarker(nsFrameConstructorState& aState, FCDATA_SKIP_ABSPOS_PUSH | \ FCDATA_DISALLOW_GENERATED_CONTENT, _func) #define SIMPLE_SVG_CREATE(_tag, _func) \ - { &nsGkAtoms::_tag, SIMPLE_SVG_FCDATA(_func) } + { nsGkAtoms::_tag, SIMPLE_SVG_FCDATA(_func) } static bool IsFilterPrimitiveChildTag(const nsAtom* aTag) @@ -5456,12 +5456,12 @@ nsCSSFrameConstructor::FindSVGData(Element* aElement, SIMPLE_SVG_CREATE(path, NS_NewSVGGeometryFrame), SIMPLE_SVG_CREATE(defs, NS_NewSVGContainerFrame), SIMPLE_SVG_CREATE(generic_, NS_NewSVGGenericContainerFrame), - { &nsGkAtoms::text, + { nsGkAtoms::text, FCDATA_WITH_WRAPPING_BLOCK(FCDATA_DISALLOW_OUT_OF_FLOW | FCDATA_ALLOW_BLOCK_STYLES, NS_NewSVGTextFrame, nsCSSAnonBoxes::mozSVGText) }, - { &nsGkAtoms::foreignObject, + { nsGkAtoms::foreignObject, FCDATA_WITH_WRAPPING_BLOCK(FCDATA_DISALLOW_OUT_OF_FLOW, NS_NewSVGForeignObjectFrame, nsCSSAnonBoxes::mozSVGForeignContent) }, diff --git a/layout/base/nsCSSFrameConstructor.h b/layout/base/nsCSSFrameConstructor.h index 39cc3159a4a0..91da16ffe9b4 100644 --- a/layout/base/nsCSSFrameConstructor.h +++ b/layout/base/nsCSSFrameConstructor.h @@ -751,9 +751,7 @@ private: stored somewhere that this struct can point to (that is, a static nsAtom*) and that it's allocated before the struct is ever used. */ struct FrameConstructionDataByTag { - // Pointer to nsStaticAtom* is used because we want to initialize this - // statically, so before our atom tables are set up. - const nsStaticAtom* const* mTag; + const nsStaticAtom* const mTag; const FrameConstructionData mData; }; From e0c05abb10ccd954b3e497e7284e30092328e7f9 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 3 Apr 2018 22:15:31 +1000 Subject: [PATCH 86/88] Bug 1451169 - Reduce indirection for PseudoParentData::mPseudoType. r=xidorn MozReview-Commit-ID: CiXGCKrpfCB --HG-- extra : rebase_source : a2c22543668887d1fd20065e71f359aaf33795d9 --- layout/base/nsCSSFrameConstructor.cpp | 26 +++++++++++++------------- layout/base/nsCSSFrameConstructor.h | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 914c1fbe63e6..b4862b8fd42d 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -9375,7 +9375,7 @@ nsCSSFrameConstructor::sPseudoParentData[eParentTypeCount] = { FCDATA_IS_WRAPPER_ANON_BOX | FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRow), &nsCSSFrameConstructor::ConstructTableCell), - &nsCSSAnonBoxes::tableCell + nsCSSAnonBoxes::tableCell }, { // Row FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET | @@ -9383,7 +9383,7 @@ nsCSSFrameConstructor::sPseudoParentData[eParentTypeCount] = { FCDATA_IS_WRAPPER_ANON_BOX | FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRowGroup), &nsCSSFrameConstructor::ConstructTableRowOrRowGroup), - &nsCSSAnonBoxes::tableRow + nsCSSAnonBoxes::tableRow }, { // Row group FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET | @@ -9391,7 +9391,7 @@ nsCSSFrameConstructor::sPseudoParentData[eParentTypeCount] = { FCDATA_IS_WRAPPER_ANON_BOX | FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeTable), &nsCSSFrameConstructor::ConstructTableRowOrRowGroup), - &nsCSSAnonBoxes::tableRowGroup + nsCSSAnonBoxes::tableRowGroup }, { // Column group FCDATA_DECL(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET | @@ -9401,13 +9401,13 @@ nsCSSFrameConstructor::sPseudoParentData[eParentTypeCount] = { // restyle these: they have non-inheriting styles. FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeTable), NS_NewTableColGroupFrame), - &nsCSSAnonBoxes::tableColGroup + nsCSSAnonBoxes::tableColGroup }, { // Table FULL_CTOR_FCDATA(FCDATA_SKIP_FRAMESET | FCDATA_USE_CHILD_ITEMS | FCDATA_IS_WRAPPER_ANON_BOX, &nsCSSFrameConstructor::ConstructTable), - &nsCSSAnonBoxes::table + nsCSSAnonBoxes::table }, { // Ruby FCDATA_DECL(FCDATA_IS_LINE_PARTICIPANT | @@ -9415,7 +9415,7 @@ nsCSSFrameConstructor::sPseudoParentData[eParentTypeCount] = { FCDATA_IS_WRAPPER_ANON_BOX | FCDATA_SKIP_FRAMESET, NS_NewRubyFrame), - &nsCSSAnonBoxes::ruby + nsCSSAnonBoxes::ruby }, { // Ruby Base FCDATA_DECL(FCDATA_USE_CHILD_ITEMS | @@ -9424,7 +9424,7 @@ nsCSSFrameConstructor::sPseudoParentData[eParentTypeCount] = { FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRubyBaseContainer) | FCDATA_SKIP_FRAMESET, NS_NewRubyBaseFrame), - &nsCSSAnonBoxes::rubyBase + nsCSSAnonBoxes::rubyBase }, { // Ruby Base Container FCDATA_DECL(FCDATA_USE_CHILD_ITEMS | @@ -9433,7 +9433,7 @@ nsCSSFrameConstructor::sPseudoParentData[eParentTypeCount] = { FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRuby) | FCDATA_SKIP_FRAMESET, NS_NewRubyBaseContainerFrame), - &nsCSSAnonBoxes::rubyBaseContainer + nsCSSAnonBoxes::rubyBaseContainer }, { // Ruby Text FCDATA_DECL(FCDATA_USE_CHILD_ITEMS | @@ -9442,7 +9442,7 @@ nsCSSFrameConstructor::sPseudoParentData[eParentTypeCount] = { FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRubyTextContainer) | FCDATA_SKIP_FRAMESET, NS_NewRubyTextFrame), - &nsCSSAnonBoxes::rubyText + nsCSSAnonBoxes::rubyText }, { // Ruby Text Container FCDATA_DECL(FCDATA_USE_CHILD_ITEMS | @@ -9450,7 +9450,7 @@ nsCSSFrameConstructor::sPseudoParentData[eParentTypeCount] = { FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRuby) | FCDATA_SKIP_FRAMESET, NS_NewRubyTextContainerFrame), - &nsCSSAnonBoxes::rubyTextContainer + nsCSSAnonBoxes::rubyTextContainer } }; @@ -10022,7 +10022,7 @@ nsCSSFrameConstructor::WrapItemsInPseudoParent(nsIContent* aParentContent, const FCItemIterator& aEndIter) { const PseudoParentData& pseudoData = sPseudoParentData[aWrapperType]; - nsAtom* pseudoType = *pseudoData.mPseudoType; + nsICSSAnonBoxPseudo* pseudoType = pseudoData.mPseudoType; StyleDisplay parentDisplay = aParentStyle->StyleDisplay()->mDisplay; if (pseudoType == nsCSSAnonBoxes::table && @@ -10111,14 +10111,14 @@ nsCSSFrameConstructor::CreateNeededPseudoSiblings( const PseudoParentData& pseudoData = sPseudoParentData[eTypeRubyBaseContainer]; already_AddRefed pseudoStyle = mPresShell->StyleSet()-> - ResolveInheritingAnonymousBoxStyle(*pseudoData.mPseudoType, + ResolveInheritingAnonymousBoxStyle(pseudoData.mPseudoType, aParentFrame->Style()); FrameConstructionItem* newItem = new (this) FrameConstructionItem(&pseudoData.mFCData, // Use the content of the parent frame aParentFrame->GetContent(), // Tag type - *pseudoData.mPseudoType, + pseudoData.mPseudoType, // Use the namespace of the rtc frame iter.item().mNameSpaceID, // no pending binding diff --git a/layout/base/nsCSSFrameConstructor.h b/layout/base/nsCSSFrameConstructor.h index 91da16ffe9b4..3340daf4775e 100644 --- a/layout/base/nsCSSFrameConstructor.h +++ b/layout/base/nsCSSFrameConstructor.h @@ -782,7 +782,7 @@ private: for a table pseudo-frame */ struct PseudoParentData { const FrameConstructionData mFCData; - nsICSSAnonBoxPseudo* const* mPseudoType; + nsICSSAnonBoxPseudo* const mPseudoType; }; /* Array of such structures that we use to properly construct table pseudo-frames as needed */ From 1ad4d0e314c5710960a6a6272a49429735e23535 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 3 Apr 2018 22:15:31 +1000 Subject: [PATCH 87/88] Bug 1451169 - Reduce indirection for static pointers in txCoreFunctionCall.cpp. r=erahm The patch also adds more `const` to txCoreFunctionDescriptor. MozReview-Commit-ID: 6VFyAcjD98F --HG-- extra : rebase_source : db054286e7e236775d686e406c6e05a18d5b5f35 --- dom/xslt/xpath/txCoreFunctionCall.cpp | 66 +++++++++++++-------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/dom/xslt/xpath/txCoreFunctionCall.cpp b/dom/xslt/xpath/txCoreFunctionCall.cpp index 9de3d744d3da..e10c543ed5e3 100644 --- a/dom/xslt/xpath/txCoreFunctionCall.cpp +++ b/dom/xslt/xpath/txCoreFunctionCall.cpp @@ -21,46 +21,46 @@ using namespace mozilla; struct txCoreFunctionDescriptor { - int8_t mMinParams; - int8_t mMaxParams; - Expr::ResultType mReturnType; - nsStaticAtom** mName; + const int8_t mMinParams; + const int8_t mMaxParams; + const Expr::ResultType mReturnType; + const nsStaticAtom* const mName; }; // This must be ordered in the same order as txCoreFunctionCall::eType. // If you change one, change the other. static const txCoreFunctionDescriptor descriptTable[] = { - { 1, 1, Expr::NUMBER_RESULT, &nsGkAtoms::count }, // COUNT - { 1, 1, Expr::NODESET_RESULT, &nsGkAtoms::id }, // ID - { 0, 0, Expr::NUMBER_RESULT, &nsGkAtoms::last }, // LAST - { 0, 1, Expr::STRING_RESULT, &nsGkAtoms::localName }, // LOCAL_NAME - { 0, 1, Expr::STRING_RESULT, &nsGkAtoms::namespaceUri }, // NAMESPACE_URI - { 0, 1, Expr::STRING_RESULT, &nsGkAtoms::name }, // NAME - { 0, 0, Expr::NUMBER_RESULT, &nsGkAtoms::position }, // POSITION + { 1, 1, Expr::NUMBER_RESULT, nsGkAtoms::count }, // COUNT + { 1, 1, Expr::NODESET_RESULT, nsGkAtoms::id }, // ID + { 0, 0, Expr::NUMBER_RESULT, nsGkAtoms::last }, // LAST + { 0, 1, Expr::STRING_RESULT, nsGkAtoms::localName }, // LOCAL_NAME + { 0, 1, Expr::STRING_RESULT, nsGkAtoms::namespaceUri }, // NAMESPACE_URI + { 0, 1, Expr::STRING_RESULT, nsGkAtoms::name }, // NAME + { 0, 0, Expr::NUMBER_RESULT, nsGkAtoms::position }, // POSITION - { 2, -1, Expr::STRING_RESULT, &nsGkAtoms::concat }, // CONCAT - { 2, 2, Expr::BOOLEAN_RESULT, &nsGkAtoms::contains }, // CONTAINS - { 0, 1, Expr::STRING_RESULT, &nsGkAtoms::normalizeSpace }, // NORMALIZE_SPACE - { 2, 2, Expr::BOOLEAN_RESULT, &nsGkAtoms::startsWith }, // STARTS_WITH - { 0, 1, Expr::STRING_RESULT, &nsGkAtoms::string }, // STRING - { 0, 1, Expr::NUMBER_RESULT, &nsGkAtoms::stringLength }, // STRING_LENGTH - { 2, 3, Expr::STRING_RESULT, &nsGkAtoms::substring }, // SUBSTRING - { 2, 2, Expr::STRING_RESULT, &nsGkAtoms::substringAfter }, // SUBSTRING_AFTER - { 2, 2, Expr::STRING_RESULT, &nsGkAtoms::substringBefore }, // SUBSTRING_BEFORE - { 3, 3, Expr::STRING_RESULT, &nsGkAtoms::translate }, // TRANSLATE + { 2, -1, Expr::STRING_RESULT, nsGkAtoms::concat }, // CONCAT + { 2, 2, Expr::BOOLEAN_RESULT, nsGkAtoms::contains }, // CONTAINS + { 0, 1, Expr::STRING_RESULT, nsGkAtoms::normalizeSpace }, // NORMALIZE_SPACE + { 2, 2, Expr::BOOLEAN_RESULT, nsGkAtoms::startsWith }, // STARTS_WITH + { 0, 1, Expr::STRING_RESULT, nsGkAtoms::string }, // STRING + { 0, 1, Expr::NUMBER_RESULT, nsGkAtoms::stringLength }, // STRING_LENGTH + { 2, 3, Expr::STRING_RESULT, nsGkAtoms::substring }, // SUBSTRING + { 2, 2, Expr::STRING_RESULT, nsGkAtoms::substringAfter }, // SUBSTRING_AFTER + { 2, 2, Expr::STRING_RESULT, nsGkAtoms::substringBefore }, // SUBSTRING_BEFORE + { 3, 3, Expr::STRING_RESULT, nsGkAtoms::translate }, // TRANSLATE - { 0, 1, Expr::NUMBER_RESULT, &nsGkAtoms::number }, // NUMBER - { 1, 1, Expr::NUMBER_RESULT, &nsGkAtoms::round }, // ROUND - { 1, 1, Expr::NUMBER_RESULT, &nsGkAtoms::floor }, // FLOOR - { 1, 1, Expr::NUMBER_RESULT, &nsGkAtoms::ceiling }, // CEILING - { 1, 1, Expr::NUMBER_RESULT, &nsGkAtoms::sum }, // SUM + { 0, 1, Expr::NUMBER_RESULT, nsGkAtoms::number }, // NUMBER + { 1, 1, Expr::NUMBER_RESULT, nsGkAtoms::round }, // ROUND + { 1, 1, Expr::NUMBER_RESULT, nsGkAtoms::floor }, // FLOOR + { 1, 1, Expr::NUMBER_RESULT, nsGkAtoms::ceiling }, // CEILING + { 1, 1, Expr::NUMBER_RESULT, nsGkAtoms::sum }, // SUM - { 1, 1, Expr::BOOLEAN_RESULT, &nsGkAtoms::boolean }, // BOOLEAN - { 0, 0, Expr::BOOLEAN_RESULT, &nsGkAtoms::_false }, // _FALSE - { 1, 1, Expr::BOOLEAN_RESULT, &nsGkAtoms::lang }, // LANG - { 1, 1, Expr::BOOLEAN_RESULT, &nsGkAtoms::_not }, // _NOT - { 0, 0, Expr::BOOLEAN_RESULT, &nsGkAtoms::_true } // _TRUE + { 1, 1, Expr::BOOLEAN_RESULT, nsGkAtoms::boolean }, // BOOLEAN + { 0, 0, Expr::BOOLEAN_RESULT, nsGkAtoms::_false }, // _FALSE + { 1, 1, Expr::BOOLEAN_RESULT, nsGkAtoms::lang }, // LANG + { 1, 1, Expr::BOOLEAN_RESULT, nsGkAtoms::_not }, // _NOT + { 0, 0, Expr::BOOLEAN_RESULT, nsGkAtoms::_true } // _TRUE }; @@ -723,7 +723,7 @@ txCoreFunctionCall::getTypeFromAtom(nsAtom* aName, eType& aType) { uint32_t i; for (i = 0; i < ArrayLength(descriptTable); ++i) { - if (aName == *descriptTable[i].mName) { + if (aName == descriptTable[i].mName) { aType = static_cast(i); return true; @@ -737,6 +737,6 @@ txCoreFunctionCall::getTypeFromAtom(nsAtom* aName, eType& aType) void txCoreFunctionCall::appendName(nsAString& aDest) { - aDest.Append((*descriptTable[mType].mName)->GetUTF16String()); + aDest.Append(descriptTable[mType].mName->GetUTF16String()); } #endif From dbb95d3a789ce70bac944898f7ab29193f4ff0f1 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Wed, 4 Apr 2018 23:05:00 -0400 Subject: [PATCH 88/88] Bug 1450162. Add a crash test that invalidates our previous assumptions. r=mstange --- ...lob-merging-and-retained-display-list.html | 62 +++++++++++++++++++ layout/svg/crashtests/crashtests.list | 1 + 2 files changed, 63 insertions(+) create mode 100644 layout/svg/crashtests/blob-merging-and-retained-display-list.html diff --git a/layout/svg/crashtests/blob-merging-and-retained-display-list.html b/layout/svg/crashtests/blob-merging-and-retained-display-list.html new file mode 100644 index 000000000000..56ca743dc91e --- /dev/null +++ b/layout/svg/crashtests/blob-merging-and-retained-display-list.html @@ -0,0 +1,62 @@ + + + + + + + + diff --git a/layout/svg/crashtests/crashtests.list b/layout/svg/crashtests/crashtests.list index dd059b263241..493ef24b51dd 100644 --- a/layout/svg/crashtests/crashtests.list +++ b/layout/svg/crashtests/crashtests.list @@ -206,3 +206,4 @@ load 1402124.html load 1402486.html load conditional-outer-svg-nondirty-reflow-assert.xhtml load extref-test-1.xhtml +load blob-merging-and-retained-display-list.html