~chromium-team/chromium-browser/focal-stable

« back to all changes in this revision

Viewing changes to debian/tests/data/HTML5test/backend/models/results.php

  • Committer: Olivier Tilloy
  • Date: 2019-06-12 07:56:52 UTC
  • mfrom: (1494.1.4 eoan-snap)
  • Revision ID: olivier.tilloy@canonical.com-20190612075652-2mej8weep7syq5j9
* Upstream release: 75.0.3770.80
  - CVE-2019-5828: Use after free in ServiceWorker.
  - CVE-2019-5829: Use after free in Download Manager.
  - CVE-2019-5830: Incorrectly credentialed requests in CORS.
  - CVE-2019-5831: Incorrect map processing in V8.
  - CVE-2019-5832: Incorrect CORS handling in XHR.
  - CVE-2019-5833: Inconsistent security UI placement.
  - CVE-2019-5834: URL spoof in Omnibox on iOS.
  - CVE-2019-5835: Out of bounds read in Swiftshader.
  - CVE-2019-5836: Heap buffer overflow in Angle.
  - CVE-2019-5837: Cross-origin resources size disclosure in Appcache.
  - CVE-2019-5838: Overly permissive tab access in Extensions.
  - CVE-2019-5839: Incorrect handling of certain code points in Blink.
  - CVE-2019-5840: Popup blocker bypass.
* Install the chromium snap in place of the debian packages, and make the wrapper script rename the desktop file in well-known desktop launchers (currently GNOME Shell and Unity)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
 
3
 
        class Results {
4
 
 
5
 
 
6
 
 
7
 
                static function getTimeline($id, $type, $release) {
8
 
                        $db = Factory::Database();
9
 
 
10
 
                        $results = array();
11
 
 
12
 
                        $result = $db->query("
13
 
                                SELECT
14
 
                                        v.platform, IFNULL(v.version,'') AS version, v.nickname, v.releasedate, v.status, f.score, f.results
15
 
                                FROM
16
 
                                        data_platforms AS p
17
 
                                        LEFT JOIN data_versions AS v ON (p.platform = v.platform)
18
 
                                        LEFT JOIN scores AS s ON (v.platform = s.platform AND (v.version = s.version OR (v.version IS NULL AND s.version IS NULL)))
19
 
                                        LEFT JOIN fingerprints AS f ON (s.fingerprint = f.fingerprint)
20
 
                                WHERE
21
 
                                        (p.platform = '" . $db->escape_string($id) . "' OR p.related = '" . $db->escape_string($id) . "') AND
22
 
                                        FIND_IN_SET('" . $db->escape_string($type) . "',p.type) AND
23
 
                                        FIND_IN_SET('" . $db->escape_string($type) . "',v.type) AND
24
 
                                        v.status != 'experimental' AND
25
 
                                        s.release = '" . $release . "'
26
 
                                ORDER BY
27
 
                                        IF(v.status='upcoming',1,0) DESC, v.releasedate DESC, p.related, v.version DESC
28
 
                        ");
29
 
 
30
 
                        while ($row = $result->fetch_object()) {
31
 
                                $results[] = $row;
32
 
                        }
33
 
 
34
 
                        for ($i = 0; $i < count($results) - 1; $i++) {
35
 
                                $results[$i]->changes = Results::getDiff($results[$i]->results, $results[$i + 1]->results);
36
 
                        }
37
 
 
38
 
                        for ($i = 0; $i < count($results); $i++) {
39
 
                                unset($results[$i]->results);
40
 
                        }
41
 
 
42
 
                        return $results;
43
 
                }
44
 
 
45
 
                static function getArray($string) {
46
 
                        $result = array();
47
 
 
48
 
                        $array = explode(',', $string);
49
 
 
50
 
                        for ($i = 0; $i < count($array); $i++) {
51
 
                                $item = explode('=', $array[$i]);
52
 
                                $result[$item[0]] = $item[1];
53
 
                        }
54
 
 
55
 
                        return $result;
56
 
                }
57
 
 
58
 
                static function getDiff($current, $previous) {
59
 
                        $current = Results::getArray($current);
60
 
                        $previous = Results::getArray($previous);
61
 
 
62
 
                        $changes = array();
63
 
 
64
 
                        foreach ($previous AS $p => $value) {
65
 
                                if (preg_match("/\.codecs\./", $p)) continue;
66
 
 
67
 
                                if ($previous[$p] == 33) $previous[$p] = 1;
68
 
                                if ($current[$p] == 33) $current[$p] = 1;
69
 
 
70
 
                                if ($previous[$p] != $current[$p]) {
71
 
                                        $changes[] = (object) array(
72
 
                                                'id'    => $p,
73
 
                                                'from'  => $previous[$p],
74
 
                                                'to'    => $current[$p]
75
 
                                        );
76
 
                                }
77
 
                        }
78
 
 
79
 
                        return $changes;
80
 
                }
81
 
 
82
 
 
83
 
                static function getByFeature($id, $release) {
84
 
                        $db = Factory::Database();
85
 
 
86
 
                        $results = array();
87
 
 
88
 
                        $result = $db->query("
89
 
                                SELECT
90
 
                                        IFNULL(SUBSTRING_INDEX(SUBSTRING_INDEX(f.results,'" . $db->escape_string($id) . "=',-1),',',1),0) as supported,
91
 
                                        v.platform, IFNULL(v.version,'') AS version
92
 
                                FROM
93
 
                                        data_versions AS v
94
 
                                        LEFT JOIN scores AS s ON (v.platform = s.platform AND (v.version = s.version OR (v.version IS NULL AND s.version IS NULL)))
95
 
                                        LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint)
96
 
                                WHERE
97
 
                                        s.release = '" . $release . "'
98
 
                        ");
99
 
 
100
 
                        while ($row = $result->fetch_object()) {
101
 
                                $results[] = $row->platform . '-' . $row->version . '=' . $row->supported;
102
 
                        }
103
 
 
104
 
                        return $results;
105
 
                }
106
 
 
107
 
                static function getByBrowser($browser, $release) {
108
 
                        $db = Factory::Database();
109
 
 
110
 
                        $browser = explode('-', $browser);
111
 
 
112
 
                        if (count($browser) > 1) {
113
 
                                list($browserPlatform, $browserVersion) = $browser;
114
 
 
115
 
                                $result = $db->query("
116
 
                                        SELECT
117
 
                                                v.platform, IFNULL(v.version,'') AS version, v.nickname, f.score, f.points, f.results
118
 
                                        FROM
119
 
                                                data_versions AS v
120
 
                                                LEFT JOIN scores AS s ON (v.platform = s.platform AND (v.version = s.version OR (v.version IS NULL AND s.version IS NULL)))
121
 
                                                LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint)
122
 
                                        WHERE
123
 
                                                s.release = '" . $release . "' AND
124
 
                                                v.platform = '" . $db->escape_string($browserPlatform) . "' AND
125
 
                                                v.version = '" . $db->escape_string($browserVersion) . "'
126
 
                                ");
127
 
 
128
 
                                if ($row = $result->fetch_object()) {
129
 
                                        return $row;
130
 
                                }
131
 
 
132
 
                                return;
133
 
                        }
134
 
                        else {
135
 
                                $browserPlatform = $browser[0];
136
 
                        }
137
 
 
138
 
                        $result = $db->query("
139
 
                                SELECT
140
 
                                        v.platform, IFNULL(v.version,'') AS version, v.nickname, f.score, f.points, f.results
141
 
                                FROM
142
 
                                        data_versions AS v
143
 
                                        LEFT JOIN scores AS s ON (v.platform = s.platform AND (v.version = s.version OR (v.version IS NULL AND s.version IS NULL)))
144
 
                                        LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint)
145
 
                                WHERE
146
 
                                        s.release = '" . $release . "' AND
147
 
                                        v.platform = '" . $db->escape_string($browserPlatform) . "' AND
148
 
                                        v.version IS NULL
149
 
                                ORDER BY
150
 
                                        v.releasedate DESC
151
 
                        ");
152
 
 
153
 
                        if ($row = $result->fetch_object()) {
154
 
                                return $row;
155
 
                        }
156
 
                }
157
 
 
158
 
 
159
 
 
160
 
                static function getByUniqueId($id) {
161
 
                        $db = Factory::Database();
162
 
 
163
 
                        $result = $db->query("
164
 
                                SELECT
165
 
                                        r.release, r.uniqueid AS id, 'Unique id' AS nickname, f.score, f.maximum, f.points, f.results, humanReadable, useragentHeader AS useragent, deviceWidth, deviceHeight, f.fingerprint
166
 
                                FROM
167
 
                                        results AS r
168
 
                                        LEFT JOIN fingerprints AS f ON (r.fingerprint = f.fingerprint)
169
 
                                WHERE
170
 
                                        r.uniqueid ='" . $db->escape_string($id) . "'
171
 
                        ");
172
 
 
173
 
                        if ($row = $result->fetch_object()) {
174
 
 
175
 
                                // Update use counter
176
 
                                $db->query('
177
 
                                        UPDATE
178
 
                                                results
179
 
                                        SET
180
 
                                                used = used + 1,
181
 
                                                lastUsed = NOW()
182
 
                                        WHERE
183
 
                                                uniqueid = "' . $db->escape_string($id) . '"
184
 
                                ');
185
 
 
186
 
                                return $row;
187
 
                        }
188
 
 
189
 
 
190
 
                        /*  Quick hack to make older ids work again */
191
 
 
192
 
                        $result = $db->query("
193
 
                                SELECT
194
 
                                        r.version as `release`, r.uniqueid AS id, 'Unique id' AS nickname, f.score, f.maximum, f.points, f.results, humanReadable, useragentHeader AS useragent, deviceWidth, deviceHeight, f.fingerprint
195
 
                                FROM
196
 
                                        html5test5.results AS r
197
 
                                        LEFT JOIN html5test5.fingerprints AS f ON (r.fingerprint = f.fingerprint)
198
 
                                WHERE
199
 
                                        r.uniqueid ='" . $db->escape_string($id) . "'
200
 
                        ");
201
 
 
202
 
                        if ($row = $result->fetch_object()) {
203
 
 
204
 
                                // Update use counter
205
 
                                $db->query('
206
 
                                        UPDATE
207
 
                                                html5test5.results
208
 
                                        SET
209
 
                                                used = used + 1,
210
 
                                                lastUsed = NOW()
211
 
                                        WHERE
212
 
                                                uniqueid = "' . $db->escape_string($id) . '"
213
 
                                ');
214
 
 
215
 
                                return $row;
216
 
                        }
217
 
                }
218
 
 
219
 
 
220
 
                static function getByFingerprint($id) {
221
 
                        $db = Factory::Database();
222
 
 
223
 
                        $res = $db->query("
224
 
                                SELECT
225
 
                                        score, maximum, points, results
226
 
                                FROM
227
 
                                        fingerprints
228
 
                                WHERE
229
 
                                        fingerprint ='" . $db->escape_string($id) . "'
230
 
                        ");
231
 
 
232
 
                        if ($row = $res->fetch_object()) {
233
 
                                return $row;
234
 
                        }
235
 
                }
236
 
 
237
 
 
238
 
                static function export($release) {
239
 
                        $db = Factory::Database();
240
 
 
241
 
                        $browsers = array();
242
 
 
243
 
                        $res = $db->query("
244
 
                                SELECT
245
 
                                        *
246
 
                                FROM
247
 
                                        data_platforms
248
 
                                ORDER BY
249
 
                                        name
250
 
                        ");
251
 
 
252
 
                        echo mysql_error();
253
 
 
254
 
                        while ($row = $res->fetch_object()) {
255
 
                                $browser = (object) array(
256
 
                                        'name'          => $row->name,
257
 
                                        'kind'          => $row->kind,
258
 
                                        'versions'      => array()
259
 
                                );
260
 
 
261
 
                                $vres = $db->query("
262
 
                                        SELECT
263
 
                                                *
264
 
                                        FROM
265
 
                                                data_versions
266
 
                                        WHERE
267
 
                                                platform = '" . addslashes($row->id) . "'
268
 
                                        ORDER BY
269
 
                                                version
270
 
                                ");
271
 
 
272
 
                                while ($vrow = $vres->fetch_object()) {
273
 
                                        $version = (object) array(
274
 
                                                'id'            => is_null($vrow->version) ? $vrow->platform : $vrow->platform . '-' . $vrow->version,
275
 
                                                'version'       => $vrow->version,
276
 
                                                'nickname'      => $vrow->nickname,
277
 
                                                'release'       => $vrow->release
278
 
                                        );
279
 
 
280
 
                                        $browser->versions[] = $version;
281
 
                                }
282
 
 
283
 
                                $browsers[] = $browser;
284
 
                        }
285
 
 
286
 
 
287
 
                        $results = array();
288
 
 
289
 
                        $res = $db->query("
290
 
                                SELECT
291
 
                                        v.platform, IFNULL(v.version,'') AS version, f.results
292
 
                                FROM
293
 
                                        data_versions AS v
294
 
                                        LEFT JOIN scores AS s ON (v.platform = s.platform AND (v.version = s.version OR (v.version IS NULL AND s.version IS NULL)))
295
 
                                        LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint)
296
 
                                WHERE
297
 
                                        s.release = '" . $release . "'
298
 
                                ORDER BY
299
 
                                        v.platform, v.version
300
 
                        ");
301
 
 
302
 
                        while ($row = $res->fetch_object()) {
303
 
                                $r = explode(',', $row->results);
304
 
 
305
 
                                for ($i = 0; $i < count($r); $i++) {
306
 
                                        list($key, $value) = explode('=', $r[$i]);
307
 
 
308
 
                                        if (!isset($results[$key]))     {
309
 
                                                $results[$key] = array();
310
 
                                        }
311
 
 
312
 
                                        $platform = $row->version == '' ? $row->platform : $row->platform . '-' . $row->version;
313
 
                                        $value = intval($value);
314
 
 
315
 
                                        if ($value & 1) {
316
 
                                                switch(true) {
317
 
                                                        case !! ($value & 2):   $results[$key][$platform] = 'yes:old';
318
 
                                                        case !! ($value & 4):   $results[$key][$platform] = 'yes:buggy';
319
 
                                                        case !! ($value & 8):   $results[$key][$platform] = 'yes:prefix';
320
 
                                                        default:                                $results[$key][$platform] = 'yes';
321
 
                                                }
322
 
                                        }
323
 
                                        else {
324
 
                                                switch(true) {
325
 
                                                        case !! ($value & 16):  $results[$key][$platform] = 'no:blocked';
326
 
                                                        default:                                $results[$key][$platform] = 'no';
327
 
                                                }
328
 
                                        }
329
 
                                }
330
 
                        }
331
 
 
332
 
 
333
 
                        return array(
334
 
                                'browsers'      => $browsers,
335
 
                                'results'       => $results
336
 
                        );
337
 
                }
338
 
        }
 
 
b'\\ No newline at end of file'