Skip to content

Commit

Permalink
Fix React to work with QtWebKit
Browse files Browse the repository at this point in the history
We learned that the underlying issue was related to react-dom's SyntheticEvent.augmentClass function being undefined.

This seems to be caused by attempted property assignment after the SyntheticEvent had been replaced by a Proxy of itself. This works fine in Chromium et al, but QtWebKit doesn't deal with Proxy Event objects well.
Moving the augmentClass definition and assignment up above the Proxy stuff resolves the issue in a PR to React: facebook/react#10011
  • Loading branch information
pivotalgeorge authored and dpage committed Jun 21, 2017
1 parent a45b87d commit 5cfa22c
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 108 deletions.
45 changes: 23 additions & 22 deletions web/pgadmin/static/vendor/react-dom/dist/react-dom-server.js
Expand Up @@ -12136,6 +12136,29 @@ _assign(SyntheticEvent.prototype, {

SyntheticEvent.Interface = EventInterface;

/**
* Helper to reduce boilerplate when creating subclasses.
*
* @param {function} Class
* @param {?object} Interface
*/
SyntheticEvent.augmentClass = function (Class, Interface) {
var Super = this;

var E = function () {};
E.prototype = Super.prototype;
var prototype = new E();

_assign(prototype, Class.prototype);
Class.prototype = prototype;
Class.prototype.constructor = Class;

Class.Interface = _assign({}, Super.Interface, Interface);
Class.augmentClass = Super.augmentClass;

PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
};

if ("development" !== 'production') {
if (isProxySupported) {
/*eslint-disable no-func-assign */
Expand All @@ -12159,28 +12182,6 @@ if ("development" !== 'production') {
/*eslint-enable no-func-assign */
}
}
/**
* Helper to reduce boilerplate when creating subclasses.
*
* @param {function} Class
* @param {?object} Interface
*/
SyntheticEvent.augmentClass = function (Class, Interface) {
var Super = this;

var E = function () {};
E.prototype = Super.prototype;
var prototype = new E();

_assign(prototype, Class.prototype);
Class.prototype = prototype;
Class.prototype.constructor = Class;

Class.Interface = _assign({}, Super.Interface, Interface);
Class.augmentClass = Super.augmentClass;

PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
};

PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler);

Expand Down
16 changes: 1 addition & 15 deletions web/pgadmin/static/vendor/react-dom/dist/react-dom-server.min.js

Large diffs are not rendered by default.

45 changes: 23 additions & 22 deletions web/pgadmin/static/vendor/react-dom/dist/react-dom.js
Expand Up @@ -14072,6 +14072,29 @@ _assign(SyntheticEvent.prototype, {

SyntheticEvent.Interface = EventInterface;

/**
* Helper to reduce boilerplate when creating subclasses.
*
* @param {function} Class
* @param {?object} Interface
*/
SyntheticEvent.augmentClass = function (Class, Interface) {
var Super = this;

var E = function () {};
E.prototype = Super.prototype;
var prototype = new E();

_assign(prototype, Class.prototype);
Class.prototype = prototype;
Class.prototype.constructor = Class;

Class.Interface = _assign({}, Super.Interface, Interface);
Class.augmentClass = Super.augmentClass;

PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
};

if ("development" !== 'production') {
if (isProxySupported) {
/*eslint-disable no-func-assign */
Expand All @@ -14095,28 +14118,6 @@ if ("development" !== 'production') {
/*eslint-enable no-func-assign */
}
}
/**
* Helper to reduce boilerplate when creating subclasses.
*
* @param {function} Class
* @param {?object} Interface
*/
SyntheticEvent.augmentClass = function (Class, Interface) {
var Super = this;

var E = function () {};
E.prototype = Super.prototype;
var prototype = new E();

_assign(prototype, Class.prototype);
Class.prototype = prototype;
Class.prototype.constructor = Class;

Class.Interface = _assign({}, Super.Interface, Interface);
Class.augmentClass = Super.augmentClass;

PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
};

PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler);

Expand Down
16 changes: 1 addition & 15 deletions web/pgadmin/static/vendor/react-dom/dist/react-dom.min.js

Large diffs are not rendered by default.

47 changes: 24 additions & 23 deletions web/pgadmin/static/vendor/react-dom/lib/SyntheticEvent.js
Expand Up @@ -182,6 +182,29 @@ _assign(SyntheticEvent.prototype, {

SyntheticEvent.Interface = EventInterface;

/**
* Helper to reduce boilerplate when creating subclasses.
*
* @param {function} Class
* @param {?object} Interface
*/
SyntheticEvent.augmentClass = function (Class, Interface) {
var Super = this;

var E = function () {};
E.prototype = Super.prototype;
var prototype = new E();

_assign(prototype, Class.prototype);
Class.prototype = prototype;
Class.prototype.constructor = Class;

Class.Interface = _assign({}, Super.Interface, Interface);
Class.augmentClass = Super.augmentClass;

PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
};

if (process.env.NODE_ENV !== 'production') {
if (isProxySupported) {
/*eslint-disable no-func-assign */
Expand All @@ -205,28 +228,6 @@ if (process.env.NODE_ENV !== 'production') {
/*eslint-enable no-func-assign */
}
}
/**
* Helper to reduce boilerplate when creating subclasses.
*
* @param {function} Class
* @param {?object} Interface
*/
SyntheticEvent.augmentClass = function (Class, Interface) {
var Super = this;

var E = function () {};
E.prototype = Super.prototype;
var prototype = new E();

_assign(prototype, Class.prototype);
Class.prototype = prototype;
Class.prototype.constructor = Class;

Class.Interface = _assign({}, Super.Interface, Interface);
Class.augmentClass = Super.augmentClass;

PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
};

PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler);

Expand Down Expand Up @@ -264,4 +265,4 @@ function getPooledWarningPropertyDefinition(propName, getVal) {
var warningCondition = false;
process.env.NODE_ENV !== 'production' ? warning(warningCondition, 'This synthetic event is reused for performance reasons. If you\'re seeing this, ' + 'you\'re %s `%s` on a released/nullified synthetic event. %s. ' + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0;
}
}
}
14 changes: 3 additions & 11 deletions web/yarn.lock
Expand Up @@ -1199,15 +1199,7 @@ concat-stream@1.5.0:
readable-stream "~2.0.0"
typedarray "~0.0.5"

concat-stream@^1.5.2:
version "1.6.0"
resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7"
dependencies:
inherits "^2.0.3"
readable-stream "^2.2.2"
typedarray "^0.0.6"

concat-stream@~1.5.0, concat-stream@~1.5.1:
concat-stream@^1.5.2, concat-stream@~1.5.0, concat-stream@~1.5.1:
version "1.5.2"
resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.5.2.tgz#708978624d856af41a5a741defdd261da752c266"
dependencies:
Expand Down Expand Up @@ -3649,7 +3641,7 @@ read-pkg@^1.0.0:
normalize-package-data "^2.3.2"
path-type "^1.0.0"

readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.2.6:
readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.6:
version "2.3.0"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.0.tgz#640f5dcda88c91a8dc60787145629170813a1ed2"
dependencies:
Expand Down Expand Up @@ -4310,7 +4302,7 @@ type-is@~1.6.15:
media-typer "0.3.0"
mime-types "~2.1.15"

typedarray@^0.0.6, typedarray@~0.0.5:
typedarray@~0.0.5:
version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"

Expand Down

0 comments on commit 5cfa22c

Please sign in to comment.