| Differences between
and this patch
- a/Websites/perf.webkit.org/ChangeLog +24 lines
Lines 1-3 a/Websites/perf.webkit.org/ChangeLog_sec1
1
2016-05-21  Ryosuke Niwa  <rniwa@webkit.org>
2
3
        Some applications truncates the last closing parenthesis in perf dashboard URL
4
        https://bugs.webkit.org/show_bug.cgi?id=157976
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Unfortunately, different applications use different heuristics to determine the end of each URL. Two trailing
9
        parentheses, for example, is just fine in Radar as well as Apple Mail if the URL is short enough. Using other
10
        characters such as ] and } wouldn't work either because they would be %-escaped. At that point, we might as well
11
        as %-escape everything.
12
13
        Work around the bug by parsing the URL as if it had one extra ')' if the parsing had failed. Also shorten the charts
14
        page's URL by avoid emitting "-null" for each pane when the pane doesn't have a currently selected point or selection.
15
        This improves the odds of the entire URL being recognized by various applications.
16
17
        We could, in theory, implement some sort of a URL shorter but that can wait until when we support real user accounts.
18
19
        * public/v3/pages/chart-pane.js:
20
        (ChartPane.prototype.serializeState): Don't serialize the selection or the current point if nothing is selected.
21
        * public/v3/pages/page-router.js:
22
        (PageRouter.prototype._deserializeHashQueryValue): Try parsing the value again with one extra ] at the end if
23
        the JSON parsing had failed.
24
1
2016-05-18  Ryosuke Niwa  <rniwa@webkit.org>
25
2016-05-18  Ryosuke Niwa  <rniwa@webkit.org>
2
26
3
        Perf dashboard "Add pane" should list first by test, then by machine
27
        Perf dashboard "Add pane" should list first by test, then by machine
- a/Websites/perf.webkit.org/public/v3/pages/chart-pane.js -7 / +9 lines
Lines 15-27 class ChartPane extends ChartPaneBase { a/Websites/perf.webkit.org/public/v3/pages/chart-pane.js_sec1
15
15
16
    serializeState()
16
    serializeState()
17
    {
17
    {
18
        var selection = this._mainChart ? this._mainChart.currentSelection() : null;
18
        var state = [this._platformId, this._metricId];
19
        var point = this._mainChart ? this._mainChart.currentPoint() : null;
19
        if (this._mainChart) {
20
        return [
20
            var selection = this._mainChart.currentSelection();
21
            this._platformId,
21
            if (selection)
22
            this._metricId,
22
                state[2] = selection;
23
            selection || (point && this._mainChartIndicatorWasLocked ? point.id : null),
23
            else if (this._mainChartIndicatorWasLocked)
24
        ];
24
                state[2] = this._mainChart.currentPoint().id;
25
        }
26
        return state;
25
    }
27
    }
26
28
27
    updateFromSerializedState(state, isOpen)
29
    updateFromSerializedState(state, isOpen)
- a/Websites/perf.webkit.org/public/v3/pages/page-router.js -1 / +16 lines
Lines 140-148 class PageRouter { a/Websites/perf.webkit.org/public/v3/pages/page-router.js_sec1
140
140
141
    _deserializeHashQueryValue(value)
141
    _deserializeHashQueryValue(value)
142
    {
142
    {
143
        var json = value.replace(/\(/g, '[').replace(/\)/g, ']').replace(/-/g, ',');
143
        try {
144
        try {
144
            return JSON.parse(value.replace(/\(/g, '[').replace(/\)/g, ']').replace(/-/g, ','));
145
            return JSON.parse(json);
145
        } catch (error) {
146
        } catch (error) {
147
148
            // Some applications don't linkify two consecutive closing parentheses: )).
149
            // Try fixing adding one extra parenthesis to see if that works.
150
            function count(regex)
151
            {
152
                var match = json.match(regex);
153
                return match ? match.length : 0;
154
            }
155
            var missingClosingBrackets = count(/\[/g) - count(/\]/g);
156
            var fix = new Array(missingClosingBrackets).fill(']').join('');
157
            try {
158
                return JSON.parse(json + fix);
159
            } catch (newError) { }
160
146
            return value;
161
            return value;
147
        }
162
        }
148
    }
163
    }

Return to Bug 157976