Skip to content

Commit 7750ea9

Browse files
author
David Håsäther
committed
Move return values to its own section (this commit is a but messed up, didn't commit after merging).
1 parent 533708e commit 7750ea9

File tree

82 files changed

+1549
-554
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+1549
-554
lines changed

src/build-application/build_application.js

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,29 @@ window.app.MIN_SUPPORTED_CORE_VERSION = 167;
6161

6262
window.cls.MessageMixin.apply(window.app); // Give the app object message handling powers
6363

64+
window.app.profiles = {};
65+
window.app.profiles.DEFAULT = 1;
66+
window.app.profiles.PROFILER = 2;
67+
window.app.profiles.HTTP_PROFILER = 3;
68+
window.app.profiles[window.app.profiles.DEFAULT] = ["window-manager",
69+
"console-logger",
70+
"exec",
71+
"ecmascript-debugger",
72+
"cookie-manager",
73+
"resource-manager",
74+
"document-manager"];
75+
window.app.profiles[window.app.profiles.DEFAULT].is_enabled = false;
76+
window.app.profiles[window.app.profiles.PROFILER] = ["window-manager",
77+
"exec",
78+
"profiler",
79+
"overlay"];
80+
window.app.profiles[window.app.profiles.PROFILER].is_enabled = false;
81+
window.app.profiles[window.app.profiles.HTTP_PROFILER] = ["window-manager",
82+
"resource-manager",
83+
"document-manager",
84+
"exec"];
85+
window.app.profiles[window.app.profiles.HTTP_PROFILER].is_enabled = false;
86+
6487
window.app.build_application = function(on_services_created, on_services_enabled)
6588
{
6689

@@ -157,15 +180,9 @@ window.app.build_application = function(on_services_created, on_services_enabled
157180
{
158181
on_services_created(service_descriptions);
159182
}
160-
for (service_name in service_descriptions)
161-
{
162-
if(service_name in window.services &&
163-
window.services[service_name].is_implemented &&
164-
service_name != "scope")
165-
{
166-
window.services['scope'].requestEnable(0,[service_name]);
167-
}
168-
}
183+
184+
window.services.scope.enable_profile(window.settings.general.get("profile-mode") ||
185+
window.app.profiles.DEFAULT);
169186
}
170187

171188
var create_raw_interface = function(service_name)
@@ -188,7 +205,7 @@ window.app.build_application = function(on_services_created, on_services_enabled
188205
var tracker = new cls.UserTracker(trackerurl);
189206
var cb = function(status, url)
190207
{
191-
if (status != 200)
208+
if (status != 200 && !cls.ScopeHTTPInterface.is_enabled)
192209
{
193210
opera.postError("Usertracker could not send heartbeat to tracker server at " + url + ". Got status " + status);
194211
}
@@ -217,7 +234,9 @@ window.app.build_application = function(on_services_created, on_services_enabled
217234
'ecmascript-debugger',
218235
'cookie-manager',
219236
'resource-manager',
220-
'document-manager'
237+
'document-manager',
238+
'profiler',
239+
'overlay'
221240
].forEach(create_raw_interface);
222241
var params = this.helpers.parse_url_arguments();
223242
if(params.debug)

src/build-application/build_ecmascript_debugger_6_0.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,18 @@ window.app.builders.EcmascriptDebugger["6.0"] = function(service)
8484
'scroll mono');
8585

8686
/* Runtime State */
87-
new SidePanelView('scripts-side-panel',
88-
ui_strings.M_VIEW_LABEL_RUNTIME_STATE,
89-
['watches', 'callstack', 'inspection'],
90-
// default expanded flags for the view list
91-
[false, true, true]);
87+
new cls.JSSidePanelView('scripts-side-panel',
88+
ui_strings.M_VIEW_LABEL_RUNTIME_STATE,
89+
['watches', 'return-values', 'callstack', 'inspection'],
90+
// default expanded flags for the view list
91+
[false, true, true]);
92+
93+
/* Return Values */
94+
cls.ReturnValuesView.prototype = ViewBase;
95+
new cls.ReturnValuesView('return-values',
96+
"Return Values",
97+
'scroll mono');
98+
cls.ReturnValuesView.create_ui_widgets();
9299

93100
/* Callstack */
94101
cls.CallstackView.prototype = ViewBase;
@@ -153,11 +160,11 @@ window.app.builders.EcmascriptDebugger["6.0"] = function(service)
153160
'scroll css-layout');
154161

155162
/* Runtime State */
156-
new SidePanelView('breakpoints-side-panel',
157-
ui_strings.M_VIEW_LABEL_BREAKPOINTS,
158-
['breakpoints', 'event-breakpoints'],
159-
// default expanded flags for the view list
160-
[true, false]);
163+
new cls.JSSidePanelView('breakpoints-side-panel',
164+
ui_strings.M_VIEW_LABEL_BREAKPOINTS,
165+
['breakpoints', 'event-breakpoints'],
166+
// default expanded flags for the view list
167+
[true, false]);
161168

162169
/* Event Breakpoints */
163170
window.event_breakpoints = cls.EventBreakpoints.get_instance();

src/client-en.xml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ window.load_screen_timeout = window.setTimeout(function()
196196
<link rel="stylesheet" href="./ecma-debugger/breakpoints/style.css"/>
197197
<link rel="stylesheet" href="./storage/storage_style.css"/>
198198
<link rel="stylesheet" href="./screenshot/style.css"/>
199+
<link rel="stylesheet" href="./profiler/profiler_style.css"/>
199200
<link rel="stylesheet" href="./ui-scripts/tooltip/tooltip.css"/>
200201

201202

@@ -249,7 +250,6 @@ window.load_screen_timeout = window.setTimeout(function()
249250
<script src="./lib/test_framework.js"/>
250251

251252

252-
253253
<script src="./ui-scripts/ui.js"/>
254254
<script src="./ui-scripts/tabbar.js"/>
255255
<script src="./ui-scripts/actions/actionbroker.js"/>
@@ -327,6 +327,7 @@ window.load_screen_timeout = window.setTimeout(function()
327327
<script src="./build-application/build_ecmascript_debugger_6_0.js"></script>
328328
<script src="./build-application/build_cookie_manager_1_0.js"></script>
329329
<script src="./build-application/build_resource_manager_1_0.js"></script>
330+
<script src="./build-application/build_profiler_1_0.js"></script>
330331
<script src="./build-application/build_document_manager_1_0.js"></script>
331332

332333
<script src="./debug/debug.js"/>
@@ -367,7 +368,10 @@ window.load_screen_timeout = window.setTimeout(function()
367368
<script src="./ecma-debugger/stop_at.js"/>
368369
<script src="./ecma-debugger/runtime_onload_handler.js"/>
369370
<script src="./ecma-debugger/views-runtimes.js"/>
371+
<script src="./ecma-debugger/view_return_values.js"/>
372+
<script src="./ecma-debugger/view_callstack.js"/>
370373
<script src="./ecma-debugger/views.js"/>
374+
<script src="./ecma-debugger/view_js_sidepanel.js"/>
371375

372376
<script src="./ecma-debugger/objectinspection.6.0/prettyprinter.js"/>
373377
<script src="./ecma-debugger/objectinspection.6.0/inspectiontooltip.js"/>
@@ -466,6 +470,14 @@ window.load_screen_timeout = window.setTimeout(function()
466470
<script src="./repl/dfcommands.js"/>
467471
<script src="./repl/runtimeselect.js"/>
468472

473+
<script src="./overlay/overlay_service.js"/>
474+
475+
<script src="./profiler/profiler.1.0.responses.getevents.js"/>
476+
<script src="./profiler/profiler.1.0.responses.stopprofiler.js"/>
477+
<script src="./profiler/profiler_service.js"/>
478+
<script src="./profiler/profiler_view.js"/>
479+
<script src="./profiler/profiler_templates.js"/>
480+
469481

470482
<script src="./resource-manager/resource_service.js"/>
471483

src/client/client.js

Lines changed: 49 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ window.cls.Client = function()
142142

143143
this.setup = function()
144144
{
145+
window.services.scope.reset();
145146
var port = _get_port_number();
146147
var client = {
147148
id: clients.length + 1,
@@ -157,6 +158,7 @@ window.cls.Client = function()
157158
{
158159
// implement the scope DOM API
159160
cls.ScopeHTTPInterface.call(opera /*, force_stp_0 */);
161+
cls.ScopeHTTPInterface.is_enabled = true;
160162
}
161163

162164
if (!opera.stpVersion)
@@ -333,8 +335,12 @@ window.cls.Client = function()
333335
new CompositeView('console_panel',
334336
ui_strings.M_VIEW_LABEL_COMMAND_LINE,
335337
layouts.console_rough_layout);
336-
337-
};
338+
new CompositeView('profiler_mode',
339+
ui_strings.M_VIEW_LABEL_PROFILER,
340+
layouts.profiler_rough_layout,
341+
null,
342+
services);
343+
}
338344

339345
this.create_window_controls = function()
340346
{
@@ -361,7 +367,8 @@ window.cls.Client = function()
361367
controls.push(new Button("top-window-close", "", ui_strings.S_BUTTON_LABEL_CLOSE_WINDOW));
362368
}
363369

364-
document.documentElement.render(templates.window_controls(controls));
370+
var win_ctrls = document.documentElement.render(templates.window_controls(controls));
371+
window.messages.post("window-controls-created", {window_controls: win_ctrls});
365372

366373
var button = UI.get_instance().get_button("toggle-remote-debug-overlay");
367374
if (this.current_client && this.connection_is_remote(this.current_client))
@@ -450,31 +457,41 @@ window.cls.Client = function()
450457
if (last_selected_view)
451458
{
452459
var esdi = window.services['ecmascript-debugger'];
453-
var cb = this._on_ecmascript_enabled.bind(this, last_selected_view);
454-
esdi.add_listener('enable-success', cb);
460+
this._on_profile_enabled_cb = this._profile_enabled.bind(this, last_selected_view);
461+
window.messages.addListener("profile-enabled", this._on_profile_enabled_cb);
455462
}
456463
};
457464

458-
this._on_ecmascript_enabled = function(last_selected_view)
465+
this._profile_enabled = function(last_selected_view, msg)
459466
{
460-
var tag = tagManager.set_callback(null, function(status, message)
467+
if (msg.profile == window.app.profiles.DEFAULT)
461468
{
462-
const OBJECT_ID = 0;
463-
if (!message[OBJECT_ID])
469+
var tag = window.tag_manager.set_callback(this, function(status, message)
464470
{
465-
// if last_selected_view is hidden and the tab has a fallback_view_id, use that.
466-
if (
467-
views[last_selected_view] &&
468-
views[last_selected_view].is_hidden &&
469-
views[last_selected_view].fallback_view_id
470-
)
471-
{
472-
last_selected_view = views[last_selected_view].fallback_view_id;
473-
}
474-
UI.get_instance().show_view(last_selected_view);
475-
}
476-
});
477-
window.services['ecmascript-debugger'].requestGetSelectedObject(tag);
471+
const OBJECT_ID = 0;
472+
if (!message[OBJECT_ID])
473+
this._show_last_selected_view(last_selected_view);
474+
});
475+
var esdi = window.services["ecmascript-debugger"];
476+
esdi.requestGetSelectedObject(tag);
477+
}
478+
else
479+
this._show_last_selected_view(last_selected_view);
480+
481+
window.messages.removeListener("profile-enabled", this._on_profile_enabled_cb);
482+
483+
};
484+
485+
this._show_last_selected_view = function(last_selected_view)
486+
{
487+
// if last_selected_view is hidden and the tab has a fallback_view_id, use that.
488+
if (window.views[last_selected_view] &&
489+
window.views[last_selected_view].is_hidden &&
490+
window.views[last_selected_view].fallback_view_id)
491+
{
492+
last_selected_view = window.views[last_selected_view].fallback_view_id;
493+
}
494+
UI.get_instance().show_view(last_selected_view);
478495
};
479496

480497
window.app.addListener('services-created', this.on_services_created.bind(this));
@@ -498,7 +515,15 @@ ui_framework.layouts.error_console_rough_layout =
498515
]
499516
}
500517
]
501-
};
518+
}
519+
520+
ui_framework.layouts.profiler_rough_layout =
521+
{
522+
dir: 'v',
523+
width: 1000,
524+
height: 1000,
525+
children: [{ height: 1000, tabbar: { tabs: ["profiler_all"], is_hidden: true } }]
526+
}
502527

503528
ui_framework.layouts.environment_rough_layout =
504529
{
@@ -657,6 +682,7 @@ ui_framework.layouts.main_layout =
657682
'network_mode',
658683
'resource_panel',
659684
'storage',
685+
'profiler_mode',
660686
{view: 'console_mode', tab_class: ErrorConsoleTab},
661687
'utils',
662688
'console_panel'

src/console-logger/console.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,13 @@ cls.ConsoleLogger.ErrorConsoleDataBase = function()
111111
topCell.disableTab(view_id, true);
112112
};
113113
this._update_views(true);
114-
}
114+
};
115+
116+
this._on_profile_disabled = function(msg)
117+
{
118+
if (msg.profile == window.app.profiles.DEFAULT)
119+
this.clear_all();
120+
};
115121

116122
/**
117123
* Toggle an entry.
@@ -309,6 +315,7 @@ cls.ConsoleLogger.ErrorConsoleDataBase = function()
309315

310316
window.messages.addListener("setting-changed", this._on_setting_change.bind(this));
311317
window.messages.addListener("debug-context-selected", this.clear_all.bind(this));
318+
window.messages.addListener("profile-disabled", this._on_profile_disabled.bind(this));
312319

313320
var logger = window.services["console-logger"];
314321
logger.add_listener("consolemessage", this._on_console_message.bind(this));
@@ -329,6 +336,12 @@ cls.ConsoleLogger["2.1"].ErrorConsoleData = function()
329336
services['console-logger'].requestListMessages(tag);
330337
};
331338

339+
this._on_profile_enabled = function(msg)
340+
{
341+
if (msg.profile == window.app.profiles.DEFAULT)
342+
this._on_window_filter_change();
343+
};
344+
332345
this._on_list_messages = function(status, message)
333346
{
334347
const DATA = 0;
@@ -352,6 +365,7 @@ cls.ConsoleLogger["2.1"].ErrorConsoleData = function()
352365
this._init = function()
353366
{
354367
services["ecmascript-debugger"].addListener("window-filter-change", this._on_window_filter_change.bind(this));
368+
window.messages.addListener("profile-enabled", this._on_profile_enabled.bind(this));
355369
this.init();
356370
}
357371
this._init();
@@ -377,6 +391,7 @@ var ErrorConsoleViewPrototype = function()
377391
this._render_timeout = 0;
378392
this._rendertime = 0;
379393
this.needs_instant_update = false;
394+
this.required_services = ["console-logger"];
380395

381396
this.createView = function(container)
382397
{
@@ -416,6 +431,11 @@ var ErrorConsoleViewPrototype = function()
416431
}
417432
};
418433

434+
this.create_disabled_view = function(container)
435+
{
436+
container.clearAndRender(window.templates.disabled_view());
437+
};
438+
419439
this._create_delayed = function()
420440
{
421441
this._render_timeout = 0;

src/cookie-manager/cookie_manager_data.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,15 @@ cls.CookieManager.CookieDataBase = function()
156156
}
157157
};
158158

159+
this._on_profile_disabled = function(msg)
160+
{
161+
if (msg.profile == window.app.profiles.DEFAULT)
162+
{
163+
this.cookie_list = [];
164+
this._rts = {};
165+
}
166+
};
167+
159168
this._request_location_object_id = function(rt_id, active_tab_counter)
160169
{
161170
var script = "location";
@@ -342,6 +351,7 @@ cls.CookieManager.CookieDataBase = function()
342351
this._rts = {};
343352
this._active_tab_count = 0;
344353
window.messages.addListener('active-tab', this._on_active_tab.bind(this));
354+
window.messages.addListener('profile-disabled', this._on_profile_disabled.bind(this));
345355
};
346356
};
347357

src/cookie-manager/cookie_manager_views.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ cls.CookieManager.CookieManagerViewBase = function()
1515

1616
this._init = function(id, name, container_class, data_reference)
1717
{
18+
this.required_services = ["cookie-manager", "ecmascript-debugger"];
1819
this.init(id, name, container_class, null, "cookiemanager-container");
1920

2021
this.shared_shortcuts = "storage";
@@ -192,6 +193,11 @@ cls.CookieManager.CookieManagerViewBase = function()
192193
window.messages.addListener("debug-context-selected", this._clear_container.bind(this));
193194
};
194195

196+
this.create_disabled_view = function(container)
197+
{
198+
container.clearAndRender(window.templates.disabled_view());
199+
};
200+
195201
this._make_sorter = function(prop)
196202
{
197203
return function(obj_a, obj_b) {

0 commit comments

Comments
 (0)