Originally, long ago, the builtin prototype object of a class was always an
actual instance of that class. For many of the oldest classes, this is still
true. Array.isArray(Array.prototype) is true; Function.prototype is callable;
and so on.
As it turns out, this is a bad idea. Prototypes are a lot like uninitialized
objects; thus it was a common bug to have code like
if (!obj->is<WidgetObject>()) { // safety check
return ThrowTypeError(cx, ...);
}
obj->as<WidgetObject>().getWidgetPrivateData()->doThings(); // BUG
This would crash when obj happened to be Widget.prototype, because that would
sneak past the safety check, and then `getWidgetPrivateData()` would typically
return null. Extra checks everywhere. The solution is for each builtin class to
have a class_ (for instances) and a protoClass_ (for the prototype object) that
share a single ClassSpec (for the benefit of the X-ray wrapper machinery).
(This problem was a pain for the spec, too. The standard committee has stopped
making prototype objects special in this way. The newer ones are just plain
objects with no internal slots, and where possible, old stuff like
Date.prototype was retroactively changed.)
GenericCreatePrototype never got the memo. This patch fixes it.
Differential Revision: https://phabricator.services.mozilla.com/D7666
--HG--
extra : moz-landing-system : lando
When calculating which regions of a layer to invalidate we usually
apply a shift to the area to account for changes in scroll offset. For
items within flattened transforms we do not do this, because the
transform itself includes the scroll offset. However, when calculating
the old area of an invalidated frame, we use the old transform. This
includes the previous scroll offset rather than the current, so we
must therefore still apply the shift.
Not doing so was causing the incorrect region to be invalidated, and
content to be rendered at the wrong location.
Differential Revision: https://phabricator.services.mozilla.com/D8080
--HG--
extra : moz-landing-system : lando
When OOMing when allocating the temporary buffer, we return an error from the
ctor via an output parameter, and make the ConvolverNode output silence.
Additionaly, a warning is issued each time we fail to set a buffer to the buffer
property of a ConvolverNode.
Differential Revision: https://phabricator.services.mozilla.com/D6936
--HG--
extra : moz-landing-system : lando
This introduces constants for the addon states and migrates ADBAddon to a class
Differential Revision: https://phabricator.services.mozilla.com/D7881
--HG--
extra : moz-landing-system : lando
We've added nsIWidget::GetDesktopToDeviceScaleByScreen which will return scale factor of the newly placed window
according to its position on the display. This change is to move implementation to the nsIWidget derived classes.
We need that for GTK Wayland, because on the Wayland we cannot determine absolute position of the window, we
need to use parent's window scale factor. For other platforms the GetDesktopToDeviceScaleByScreen is implemented
in nsBaseWidget.
Differential Revision: https://phabricator.services.mozilla.com/D7290
--HG--
extra : moz-landing-system : lando
gfritzsche asked me to use this method to add compatibility to measure the time in seconds.
At the moment we are forced to clone `devtools/client/shared/TelemetryStopwatch.jsm` so that we can get it working the way we need.
The problem is that it measure time in ms when using start() finish() etc. and that creates too many entries in our charts and makes them next to impossible to read.
It would be much better if we could measure the time in seconds instead.
Differential Revision: https://phabricator.services.mozilla.com/D4936
--HG--
extra : moz-landing-system : lando
Now that xpcshell no longer uses ParentProcessTargetActor, we can remove comments about it using it.
We can also remove a couple of null checks against docShell that were specific to this usecase.
MozReview-Commit-ID: 67sugv4bZC3
Depends on D7416
Differential Revision: https://phabricator.services.mozilla.com/D7726
--HG--
extra : moz-landing-system : lando
Fix a bug that the current MediaRecorder's state error cases does not match the W3C spec.
pause() and resume() should throw an INVAILD_STATE_ERR only when it is inactive state, making them
independant.
Simply changing if statements is enough because the underlying encoder object (TrackEncoder) will
ignore Suspend/Resume calls when it is already suspended/recording so there won't be side-effects by
multiple pause()/resume() calls.
Differential Revision: https://phabricator.services.mozilla.com/D7910
--HG--
extra : moz-landing-system : lando
Chrome sets both KeyboardEvent.keyCode and KeyboardEvent.charCode of "keypress"
event to same value. On the other hand, our traditional behavior is, sets
one of them to 0.
Therefore, we need to set keyCode value to charCode value if the keypress
event is caused by a non-function key, i.e., it may be a printable key with
specific modifier state and/or different keyboard layout for compatibility
with Chrome. Similarly, we need to set charCode value to keyCode value if
the keypress event is caused by a function key which is not mapped to producing
a character.
Note that this hack is for compatibility with Chrome. So, for now, it's enough
to change the behavior only for "keypress" event handlers in web content. If
we completely change the behavior, we need to fix a lot of default handlers
and mochitests too. However, it's really difficult because default handlers
check whether keypress events are printable or not with following code:
> if (event.charCode &&
> !event.altKey && !event.ctrlKey && !event.metaKey) {
or
> if (!event.keyCode &&
> !event.altKey && !event.ctrlKey && !event.metaKey) {
So, until we stop dispatching "keypress" events for non-printable keys,
we need complicated check in each of them.
And also note that this patch changes the behavior of KeyboardEvent::KeyCode()
when spoofing is enabled and the instance is initialized by initKeyEvent() or
initKeyboardEvent(). That was changed by bug 1222285 unexpectedly and keeping
the behavior makes patched code really ugly. Therefore, this takes back the
old behavior even if spoofing is enabled.
Differential Revision: https://phabricator.services.mozilla.com/D7974
--HG--
extra : moz-landing-system : lando