зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1160828 - Return null when attempting to get the current selection from a graph that is not yet ready. r=vp
--HG-- extra : rebase_source : 7e97e63a6283d1fb169e83697aaa8093e223bad1
This commit is contained in:
Родитель
02c0af8d5c
Коммит
c88d11bc96
|
@ -344,9 +344,14 @@ GraphsController.prototype = {
|
|||
return this._getPrimaryLink().setMappedSelection(selection, { mapStart, mapEnd });
|
||||
},
|
||||
|
||||
/**
|
||||
* Fetches the currently mapped selection. If graphs are not yet rendered,
|
||||
* (which throws in Graphs.jsm), return null.
|
||||
*/
|
||||
getMappedSelection: function ({ mapStart, mapEnd }) {
|
||||
if (this._getPrimaryLink()) {
|
||||
return this._getPrimaryLink().getMappedSelection({ mapStart, mapEnd });
|
||||
let primary = this._getPrimaryLink();
|
||||
if (primary && primary.hasData()) {
|
||||
return primary.getMappedSelection({ mapStart, mapEnd });
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
*/
|
||||
|
||||
let test = Task.async(function*() {
|
||||
let { target, panel, toolbox } = yield initPerformance(SIMPLE_URL);
|
||||
let { EVENTS, PerformanceController, DetailsView, DetailsSubview } = panel.panelWin;
|
||||
var { target, panel, toolbox } = yield initPerformance(SIMPLE_URL);
|
||||
var { EVENTS, PerformanceController, DetailsView, DetailsSubview } = panel.panelWin;
|
||||
|
||||
// Enable memory to test the memory-calltree and memory-flamegraph.
|
||||
Services.prefs.setBoolPref(MEMORY_PREF, true);
|
||||
|
@ -80,6 +80,25 @@ let test = Task.async(function*() {
|
|||
is(importedData.configuration.withMemory, originalData.configuration.withMemory,
|
||||
"The imported data is identical to the original data (9).");
|
||||
|
||||
yield teardown(panel);
|
||||
|
||||
// Test that when importing and no graphs rendered yet,
|
||||
// we do not get a getMappedSelection error
|
||||
// bug 1160828
|
||||
var { target, panel, toolbox } = yield initPerformance(SIMPLE_URL);
|
||||
var { EVENTS, PerformanceController, DetailsView, DetailsSubview, OverviewView, WaterfallView } = panel.panelWin;
|
||||
yield PerformanceController.clearRecordings();
|
||||
|
||||
rerendered = once(WaterfallView, EVENTS.WATERFALL_RENDERED);
|
||||
imported = once(PerformanceController, EVENTS.RECORDING_IMPORTED);
|
||||
yield PerformanceController.importRecording("", file);
|
||||
|
||||
yield imported;
|
||||
ok(true, "The recording data appears to have been successfully imported.");
|
||||
|
||||
yield rerendered;
|
||||
ok(true, "The imported data was re-rendered.");
|
||||
|
||||
yield teardown(panel);
|
||||
finish();
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче