gecko-dev/dom/bindings
Boris Zbarsky e379022658 Bug 1551282 and bug 1553436. Allow pages to override window.u2f but not the "sign" and "register" properties on the U2F object. r=jcj,smaug
There are two related problems this patch is trying to address.  The first, and
simpler, one is bug 1553436: there are websites that use existing variables and
functions named "u2f" and adding a non-replaceable readonly property with that
name on Window breaks them.  The fix for this is straightforward: mark the
property [Replaceable].

The second problem, covered by bug 1551282, involves sites that use the Google
U2F polyfill.  The relevant parts of that polyfill look like this:

  'use strict';
  var u2f = u2f || {};
  u2f.register = some_function_that_only_works_right_in_Chrome;
  u2f.sign = some_function_that_only_works_right_in_Chrome;

The failure mode for that code before this fix is that the assignment to "u2f"
throws because it's a readonly property and we're in strict mode, so any code
the page concatenates in the same file after the polyfill does not get run.
That's what bug 1551282 is about.  The [Replaceable] annotation fixes that
issue, because now the polyfill gets the value of window.u2f and then redefines
the property (via the [Replaceable] setter) to be a value property with that
value.  So far, so good.

But then we need to prevent the sets of u2f.register
and u2f.sign from taking effect, because if they are allowed to happen, the
actual sign/register functionality on the page will not work in Firefox.  We
can't just make the properties readonly, because then the sets will throw due
to being in strict mode, and we still have bug 1551282.  The proposed fix is to
make these accessor properties with a no-op setter, which is exactly what
[LenientSetter] gives us.

The rest of the patch is just setting up infrastructure for generating the
normal bits we would generate if "sign" and "register" were methods and using
that to create the JSFunctions at the point when the getter is called.  The
JSFunctions then get cached on the u2f instance object.

Differential Revision: https://phabricator.services.mozilla.com/D32357

--HG--
extra : moz-landing-system : lando
2019-05-24 20:40:59 +00:00
..
crashtests
docs
mozwebidlcodegen Bug 1501124 - Switch BackstagePass to use WebIDLGlobalNameHash, r=bzbarsky 2018-10-25 10:24:36 -04:00
parser Bug 1551282 and bug 1553436. Allow pages to override window.u2f but not the "sign" and "register" properties on the U2F object. r=jcj,smaug 2019-05-24 20:40:59 +00:00
test Bug 1544834 - Replace deprecated generics in test code r=evilpie 2019-04-17 19:03:19 +00:00
AtomList.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
BindingDeclarations.h Bug 1515582. Remove the separate XBL scope setup. r=bholley 2019-02-11 21:51:47 +00:00
BindingUtils.cpp Bug 1549340 - Part 2: Use union instead of reinterpret_cast to initialize const char* with symbol for JSPropertySpec.name. r=jandem 2019-05-13 10:26:48 +00:00
BindingUtils.h Bug 1548798 - Switch SequenceRooter, RecordRooter and RootedUnion to use RootedContext. r=smaug 2019-05-03 16:07:21 +00:00
Bindings.conf Bug 1121623 part 10. Use a more-accurate default value for 'concrete' in Web IDL bindings. r=peterv 2019-05-24 10:43:37 +00:00
CallbackFunction.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
CallbackInterface.cpp Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
CallbackInterface.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
CallbackObject.cpp Bug 1547923 part 5. Start using nsIGlobalObject::GetGlobalJSObjectPreserveColor where possible. r=mccr8,jonco 2019-05-03 15:15:31 +00:00
CallbackObject.h Bug 1547923 part 5. Start using nsIGlobalObject::GetGlobalJSObjectPreserveColor where possible. r=mccr8,jonco 2019-05-03 15:15:31 +00:00
Codegen.py Bug 1551282 and bug 1553436. Allow pages to override window.u2f but not the "sign" and "register" properties on the U2F object. r=jcj,smaug 2019-05-24 20:40:59 +00:00
Configuration.py Bug 1121623 part 10. Use a more-accurate default value for 'concrete' in Web IDL bindings. r=peterv 2019-05-24 10:43:37 +00:00
DOMJSClass.h Bug 1534967 - Part 1: use RootedIdVector. r=jonco 2019-04-08 10:46:53 +08:00
DOMJSProxyHandler.cpp Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan 2019-04-12 13:14:25 +00:00
DOMJSProxyHandler.h Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan 2019-04-12 13:14:25 +00:00
DOMString.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
Date.cpp Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
Date.h Bug 1521907 part 3. Start using CheckedUnwrapStatic/Dynamic in bindings. r=peterv 2019-02-02 03:23:49 +00:00
ErrorIPCUtils.h Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre 2019-01-18 10:16:18 +01:00
ErrorResult.h Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre 2019-01-18 10:16:18 +01:00
Errors.msg Bug 1554195. Remove MSG_THIS_DOES_NOT_IMPLEMENT_INTERFACE. r=mccr8 2019-05-24 17:31:42 +00:00
Exceptions.cpp Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan 2019-03-13 10:19:06 +01:00
Exceptions.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
FakeString.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
GenerateCSS2PropertiesWebIDL.py Bug 1359269 - Part 10: Make it a hard error to apply TreatNullAs on non-types; r=bzbarsky 2019-03-02 04:22:05 +00:00
IterableIterator.cpp Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
IterableIterator.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
JSSlots.h
Makefile.in
NonRefcountedDOMObject.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
Nullable.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
PrimitiveConversions.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
ReadableStream.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
Record.h Bug 1534593 part 3. Initialize JSObject* entries in Record types. r=qdot 2019-04-16 19:18:52 +00:00
RemoteObjectProxy.cpp Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan 2019-04-12 13:14:25 +00:00
RemoteObjectProxy.h Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan 2019-04-12 13:14:25 +00:00
RootedDictionary.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
RootedOwningNonNull.h Bug 1547782 - Implement GCPolicy<T>::isValid for Gecko specializations r=jonco 2019-04-30 21:48:32 +00:00
RootedRefPtr.h Bug 1547782 - Implement GCPolicy<T>::isValid for Gecko specializations r=jonco 2019-04-30 21:48:32 +00:00
SimpleGlobalObject.cpp Bug 1513108 - Remove the separate class extension hook for getting a weakmap key delegate, r=jonco 2018-12-07 14:38:01 -08:00
SimpleGlobalObject.h Bug 1547923 part 3. Add nsIGlobalObject::GetGlobalJSObjectPreserveColor(). r=mccr8 2019-05-02 21:23:35 +00:00
SpiderMonkeyInterface.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
StructuredClone.cpp Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
StructuredClone.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
ToJSValue.cpp Bug 1529684 - Part 6: Store a mIsInProcess flag to preserve WindowProxy behaviour, r=farre 2019-03-14 18:50:54 +00:00
ToJSValue.h Bug 1521732 - Part 3: Use RootedValueVector instead. r=sfink,jonco 2019-03-26 13:58:20 +00:00
TypedArray.h Bug 1532005 - Implement a new js/public/ArrayBuffer.h header to centralize functionality for creating and interacting with ArrayBuffers. r=sfink 2019-03-04 15:19:16 -08:00
UnionMember.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
WebIDLGlobalNameHash.cpp Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan 2019-04-12 13:14:25 +00:00
WebIDLGlobalNameHash.h Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan 2019-04-12 13:14:25 +00:00
XrayExpandoClass.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
mach_commands.py
moz.build Bug 1535353 - update Core :: DOM: * bugzilla product and component meta data in moz.build files after reorganization in bug 1533440 r=hsinyi 2019-03-17 23:13:22 +00:00
nsIScriptError.idl Bug 1442778 - Add "chromeContext" parameter to console API and console service messages. r=smaug 2019-04-01 22:42:34 +00:00
nsScriptError.cpp Bug 1442778 - Add "chromeContext" parameter to console API and console service messages. r=smaug 2019-04-01 22:42:34 +00:00
nsScriptError.h Bug 1442778 - Add "chromeContext" parameter to console API and console service messages. r=smaug 2019-04-01 22:42:34 +00:00
nsScriptErrorWithStack.cpp Bug 1511393 - Use c-basic-offset: 2 in Emacs mode line for C/C++ code. r=nbp 2018-12-01 04:52:05 +09:00