1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
|
import QtQuick 2.0
// this used to trigger crash: see QTBUG-23126
Item {
id: root
property bool success: false
// each of these property names have partial strings
// which are prehashed by v8 (random, cos, sin, ...)
property int randomProperty: 4
property real cosProperty: 1
property real cossin: 1
property real propertycos: 1
property real cos: 1
// these property names are entirely "new".
property string kqwpald: "hello"
property bool poiuyt: false
Component.onCompleted: {
success = true;
// 1: ensure that we can access the properties by name
if (root["random" + "Property"] != 4) {
success = false;
return;
}
if (root["cos" + "Property"] != 1) {
success = false;
return;
}
if (root["cos" + "sin"] != 1) {
success = false;
return;
}
if (root["property" + "cos"] != 1) {
success = false;
return;
}
if (root["" + "cos"] != 1) {
success = false;
return;
}
if (root["cos" + ""] != 1) {
success = false;
return;
}
if (root["kq" + "wpald"] != "hello") {
success = false;
return;
}
if (root["poiu" + "yt"] != false) {
success = false;
return;
}
// 2: ensure that similarly named properties don't cause crash
if (root["random" + "property"] == 4) {
success = false;
return;
}
if (root["cos" + "property"] == 1) {
success = false;
return;
}
if (root["cos" + "Sin"] == 1) {
success = false;
return;
}
if (root["property" + "Cos"] == 1) {
success = false;
return;
}
if (root["" + "Cos"] == 1) {
success = false;
return;
}
if (root["Cos" + ""] == 1) {
success = false;
return;
}
if (root["kq" + "Wpald"] == "hello") {
success = false;
return;
}
if (root["poiu" + "Yt"] == false) {
success = false;
return;
}
// 3: ensure that toString doesn't crash
root["random" + "Property"].toString();
root["cos" + "Property"].toString();
root["cos" + "Sin"] ? root["cos" + "Sin"].toString() : "";
root["property" + "Cos"] ? root["property" + "Cos"].toString() : "";
root["Cos" + ""] ? root["Cos" + ""].toString() : "";
root["" + "Cos"] ? root["" + "Cos"].toString() : "";
root["kq" + "Wpald"] ? root["kq" + "Wpald"].toString() : "";
root["poiu" + "Yt"] ? root["poiu" + "Yt"].toString() : "";
root["random" + "property"] ? root["random" + "property"].toString() : "";
root["cos" + "property"] ? root["cos" + "property"].toString() : "";
root["cos" + "sin"] ? root["cos" + "sin"].toString() : "";
root["property" + "cos"] ? root["property" + "cos"].toString() : "";
root["cos" + ""] ? root["cos" + ""].toString() : "";
root["" + "cos"] ? root["" + "cos"].toString() : "";
root["kq" + "wpald"] ? root["kq" + "wpald"].toString() : "";
root["poiu" + "yt"] ? root["poiu" + "yt"].toString() : "";
}
}
|