@qooxdoo/framework 7.8.0 → 7.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Manifest.json +2 -2
- package/lib/compiler/compile-info.json +100 -98
- package/lib/compiler/index.js +2130 -1261
- package/lib/resource/qx/tool/website/build/404.html +3 -25
- package/lib/resource/qx/tool/website/build/about.html +3 -25
- package/lib/resource/qx/tool/website/build/assets/common.js +20 -0
- package/lib/resource/qx/tool/website/build/diagnostics/dependson.html +3 -25
- package/lib/resource/qx/tool/website/build/diagnostics/requiredby.html +3 -22
- package/lib/resource/qx/tool/website/build/index.html +3 -25
- package/lib/resource/qx/tool/website/partials/footer.html +3 -21
- package/lib/resource/qx/tool/website/partials/head.html +0 -1
- package/package.json +1 -1
- package/source/class/qx/Bootstrap.js +6 -3
- package/source/class/qx/Promise.js +93 -6964
- package/source/class/qx/core/Environment.js +1 -0
- package/source/class/qx/data/marshal/Json.js +64 -11
- package/source/class/qx/lang/Type.js +36 -3
- package/source/class/qx/promise/BluebirdImpl.js +6918 -0
- package/source/class/qx/promise/NativeWrapper.js +738 -0
- package/source/class/qx/test/Promise.js +1145 -22
- package/source/class/qx/test/data/controller/List.js +6 -0
- package/source/class/qx/test/data/marshal/Json.js +29 -0
- package/source/class/qx/test/io/request/Xhr.js +16 -0
- package/source/class/qx/test/lang/Type.js +151 -0
- package/source/class/qx/theme/indigo/ColorDark.js +1 -1
- package/source/class/qx/ui/core/MPlacement.js +18 -7
- package/source/class/qx/ui/table/pane/Scroller.js +1 -1
- package/source/class/qx/util/ConcurrencyLimiter.js +78 -0
- package/source/resource/qx/tool/website/build/404.html +3 -25
- package/source/resource/qx/tool/website/build/about.html +3 -25
- package/source/resource/qx/tool/website/build/assets/common.js +20 -0
- package/source/resource/qx/tool/website/build/diagnostics/dependson.html +3 -25
- package/source/resource/qx/tool/website/build/diagnostics/requiredby.html +3 -22
- package/source/resource/qx/tool/website/build/index.html +3 -25
- package/source/resource/qx/tool/website/partials/footer.html +3 -21
- package/source/resource/qx/tool/website/partials/head.html +0 -1
- package/lib/resource/qx/tool/website/build/assets/bluebird.min.js +0 -4615
- package/lib/resource/qx/tool/website/src/assets/bluebird.min.js +0 -4615
- package/source/resource/qx/tool/website/build/assets/bluebird.min.js +0 -4615
- package/source/resource/qx/tool/website/src/assets/bluebird.min.js +0 -4615
|
@@ -891,6 +891,7 @@ qx.Bootstrap.define("qx.core.Environment", {
|
|
|
891
891
|
"qx.dynlocale": true,
|
|
892
892
|
"qx.dyntheme": true,
|
|
893
893
|
"qx.blankpage": "qx/static/blank.html",
|
|
894
|
+
"qx.data.marshal.Json.breakOnNonPojos": false,
|
|
894
895
|
"qx.debug.databinding": false,
|
|
895
896
|
"qx.debug.dispose": false,
|
|
896
897
|
"qx.debug.startupTimings": false,
|
|
@@ -37,6 +37,10 @@ qx.Class.define("qx.data.marshal.Json", {
|
|
|
37
37
|
},
|
|
38
38
|
|
|
39
39
|
statics: {
|
|
40
|
+
/**
|
|
41
|
+
* Set to true when a warning has been shown that we are using the deprecated behaviour of trying to marshall non-POJO objects into Qooxdoo objects.
|
|
42
|
+
*/
|
|
43
|
+
__shownNotBreakingOnNonPojosWarning: false,
|
|
40
44
|
$$instance: null,
|
|
41
45
|
|
|
42
46
|
/**
|
|
@@ -76,6 +80,25 @@ qx.Class.define("qx.data.marshal.Json", {
|
|
|
76
80
|
Object.keys(data).sort().join('"') +
|
|
77
81
|
(includeBubbleEvents === true ? "♥" : "")
|
|
78
82
|
);
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* If the environment setting "qx.data.marshal.Json.breakOnNonPojos" is not set,
|
|
87
|
+
* it means we are using the old behaviour of marshalling non-POJO objects.
|
|
88
|
+
* A warning is shown if it hasn't been shown already.
|
|
89
|
+
*/
|
|
90
|
+
checkIfWarnAboutNotBreakingOnNonPojos() {
|
|
91
|
+
if (
|
|
92
|
+
!qx.core.Environment.get("qx.data.marshal.Json.breakOnNonPojos") &&
|
|
93
|
+
!this.__shownNotBreakingOnNonPojosWarning
|
|
94
|
+
) {
|
|
95
|
+
console.warn(
|
|
96
|
+
`Using deprecated behaviour of not breaking on non-POJOs when marshalling.
|
|
97
|
+
Please set the environment setting "qx.data.marshal.Json.breakOnNonPojos" to enable the new behaviour.
|
|
98
|
+
The old behaviour will be removed in the next major release of Qooxdoo.`
|
|
99
|
+
);
|
|
100
|
+
this.__shownNotBreakingOnNonPojosWarning = true;
|
|
101
|
+
}
|
|
79
102
|
}
|
|
80
103
|
},
|
|
81
104
|
|
|
@@ -170,12 +193,26 @@ qx.Class.define("qx.data.marshal.Json", {
|
|
|
170
193
|
* @param depth {Number} The depth of the data relative to the data's root.
|
|
171
194
|
*/
|
|
172
195
|
__toClass(data, includeBubbleEvents, parentProperty, depth) {
|
|
196
|
+
const breakOnNonPojos = qx.core.Environment.get(
|
|
197
|
+
"qx.data.marshal.Json.breakOnNonPojos"
|
|
198
|
+
);
|
|
199
|
+
this.constructor.checkIfWarnAboutNotBreakingOnNonPojos();
|
|
200
|
+
|
|
173
201
|
// break on all primitive json types and qooxdoo objects
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
202
|
+
let shouldBreak;
|
|
203
|
+
if (breakOnNonPojos) {
|
|
204
|
+
shouldBreak =
|
|
205
|
+
!qx.lang.Type.isPojo(data) ||
|
|
206
|
+
!!data.$$isString || // check for localized strings
|
|
207
|
+
data instanceof qx.core.Object;
|
|
208
|
+
} else {
|
|
209
|
+
shouldBreak =
|
|
210
|
+
!qx.lang.Type.isObject(data) ||
|
|
211
|
+
!!data.$$isString || // check for localized strings
|
|
212
|
+
data instanceof qx.core.Object;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (shouldBreak) {
|
|
179
216
|
// check for arrays
|
|
180
217
|
if (data instanceof Array || qx.Bootstrap.getClass(data) == "Array") {
|
|
181
218
|
for (var i = 0; i < data.length; i++) {
|
|
@@ -405,15 +442,31 @@ qx.Class.define("qx.data.marshal.Json", {
|
|
|
405
442
|
* @return {qx.core.Object} The created model object.
|
|
406
443
|
*/
|
|
407
444
|
__toModel(data, includeBubbleEvents, parentProperty, depth) {
|
|
445
|
+
const breakOnNonPojos = qx.core.Environment.get(
|
|
446
|
+
"qx.data.marshal.Json.breakOnNonPojos"
|
|
447
|
+
);
|
|
448
|
+
this.constructor.checkIfWarnAboutNotBreakingOnNonPojos();
|
|
449
|
+
|
|
408
450
|
var isObject = qx.lang.Type.isObject(data);
|
|
451
|
+
var isPojo = qx.lang.Type.isPojo(data);
|
|
452
|
+
|
|
409
453
|
var isArray =
|
|
410
454
|
data instanceof Array || qx.Bootstrap.getClass(data) == "Array";
|
|
411
455
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
456
|
+
let shouldBreak;
|
|
457
|
+
if (breakOnNonPojos) {
|
|
458
|
+
shouldBreak =
|
|
459
|
+
(!isPojo && !isArray) ||
|
|
460
|
+
!!data.$$isString || // check for localized strings
|
|
461
|
+
data instanceof qx.core.Object;
|
|
462
|
+
} else {
|
|
463
|
+
shouldBreak =
|
|
464
|
+
(!isObject && !isArray) ||
|
|
465
|
+
!!data.$$isString || // check for localized strings
|
|
466
|
+
data instanceof qx.core.Object;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
if (shouldBreak) {
|
|
417
470
|
return data;
|
|
418
471
|
|
|
419
472
|
// ignore rules
|
|
@@ -451,7 +504,7 @@ qx.Class.define("qx.data.marshal.Json", {
|
|
|
451
504
|
);
|
|
452
505
|
}
|
|
453
506
|
return array;
|
|
454
|
-
} else if (isObject) {
|
|
507
|
+
} else if (breakOnNonPojos ? isPojo : isObject) {
|
|
455
508
|
// create an instance for the object
|
|
456
509
|
var hash = this.__jsonToBestHash(data, includeBubbleEvents);
|
|
457
510
|
var model = this.__createInstance(hash, data, parentProperty, depth);
|
|
@@ -52,15 +52,48 @@ qx.Bootstrap.define("qx.lang.Type", {
|
|
|
52
52
|
isArray: qx.Bootstrap.isArray,
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
|
-
* Whether the value is an object. Note that built-in types like Window are
|
|
56
|
-
* not reported to be objects.
|
|
57
55
|
*
|
|
56
|
+
* Whether the value is an POJO (ie {})
|
|
57
|
+
* or an object which is created from a ES6-style class or prototypical-inheritance-based class;
|
|
58
|
+
* if you need to determine whether something is a POJO and not created from a class, use isPojo instead
|
|
59
|
+
*
|
|
60
|
+
* Note that built-in types like Window are not deemed to be objects.
|
|
58
61
|
* @signature function(value)
|
|
59
|
-
* @param
|
|
62
|
+
* @param {*} value value to check.
|
|
60
63
|
* @return {Boolean} Whether the value is an object.
|
|
61
64
|
*/
|
|
62
65
|
isObject: qx.Bootstrap.isObject,
|
|
63
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Whether the value is strictly a POJO.
|
|
69
|
+
* Its prototype chain must not contain any constructors which are not the Object constructor i.e. traditional prototype-based classes or ES6 classes.
|
|
70
|
+
*
|
|
71
|
+
* @param {*} value
|
|
72
|
+
* @returns {Boolean} Whether the value is strictly a POJO.
|
|
73
|
+
*/
|
|
74
|
+
isPojo(value) {
|
|
75
|
+
if (qx.Bootstrap.getClass(value) != "Object") {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let prototype = Object.getPrototypeOf(value);
|
|
80
|
+
while (true) {
|
|
81
|
+
if (prototype === Object.prototype) {
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (
|
|
86
|
+
prototype.constructor &&
|
|
87
|
+
prototype.constructor !== Object.prototype.constructor
|
|
88
|
+
) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
//loop tail
|
|
93
|
+
prototype = Object.getPrototypeOf(prototype);
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
|
|
64
97
|
/**
|
|
65
98
|
* Whether the value is a function.
|
|
66
99
|
*
|