Permalink
Browse files

The debugger has to be explicitly enabled.

Only once per debugging session though..
  • Loading branch information...
1 parent 35c8c1b commit e2e45495be33ea295d4c864f947c652ff5ad5319 @ingemaradahl committed Aug 24, 2012
Showing with 53 additions and 14 deletions.
  1. +1 −1 src/ecma-debugger/stop_at.js
  2. +14 −5 src/webgl/start_view.js
  3. +1 −1 src/webgl/views.js
  4. +7 −2 src/webgl/webgl.js
  5. +30 −5 src/webgl/webgl_templates.js
@@ -418,7 +418,7 @@ cls.EcmascriptDebugger["6.0"].StopAt = function()
stopAt.stopped_reason == 'new script')
{
runtime_id = stopAt.runtime_id;
- if (!webgl.injected)
+ if (!webgl.injected && webgl.enabled)
{
var continue_callback = (function () { this.__continue('run'); }).bind(this);
webgl.inject(stopAt.runtime_id, continue_callback);
View
@@ -21,11 +21,13 @@ cls.WebGLStartView = function(id, name, container_class)
{
if (!this._container) return;
- var state = window.webgl.injected
- ? snapshot_present
- ? "select"
- : "snapshot"
- : "init";
+ var state = window.webgl.enabled
+ ? window.webgl.injected
+ ? snapshot_present
+ ? "select"
+ : "snapshot"
+ : "init"
+ : "enable";
this._container.clearAndRender(window.templates.webgl.start_view(state, info_open));
};
@@ -34,6 +36,12 @@ cls.WebGLStartView = function(id, name, container_class)
this._container = null;
};
+ var on_enable = function(event, target)
+ {
+ webgl.enable();
+ runtimes.reloadWindow();
+ };
+
var on_settings = function(msg)
{
if (msg.id === "webgl-snapshot")
@@ -140,6 +148,7 @@ cls.WebGLStartView = function(id, name, container_class)
messages.addListener('webgl-clear', on_clear.bind(this));
var eh = window.eventHandlers;
+ eh.click["webgl-enable"] = on_enable.bind(this);
eh.click["webgl-open-settings"] = on_open_settings.bind(this);
eh.click["webgl-info-box-toggle"] = on_toggle_info.bind(this);
View
@@ -173,7 +173,7 @@ cls.WebGLGeneralView.create_ui_widgets = function()
'webgl-general',
// key-value map
{
- 'enable-debugger' : true,
+ 'enable-debugger' : true, // TODO: Actually use this setting for hiding the webgl-mode tab
'highlight-objects' : true,
'first-run' : true,
View
@@ -8,6 +8,7 @@ cls.WebGL.WebGLDebugger = function ()
{
this.injected = false;
this.runtime_id = -1;
+ this.enabled = false;
/* Context IDs for wrapped contexts. NOT an object id */
this.contexts = [];
@@ -38,10 +39,14 @@ cls.WebGL.WebGLDebugger = function ()
/* Contains shader used when displaying textures and buffers in the debugger */
this.shaders = {};
+ this.enable = function ()
+ {
+ this.enabled = true;
+ };
+
this.inject = function (rt_id, cont_callback)
{
- // TODO: Better disabling
- if (this.runtime_id !== rt_id && window.settings['webgl-general'].map['enable-debugger'])
+ if (this.runtime_id !== rt_id)
{
this.runtime_id = rt_id;
window.host_tabs.activeTab.addEventListener("webgl-debugger-ready",
@@ -1637,10 +1637,18 @@ window.templates.webgl.collapse_box = function(title, string, button, custom, in
window.templates.webgl.start_view = function(state, info_open)
{
var html = ["div"];
- html.push(["h2", "Welcome to the Dragonfly WebGL Debugger"]);
+
+ // TODO: Do this check at a better place :/
+ if (!window.services["ecmascript-debugger"].is_enabled)
+ {
+ return window.templates.disabled_view();
+ }
+
+ // Add the pre-compositing warning if applicable
switch (state)
{
+ case "enable":
case "init":
var warning = window.settings["webgl-snapshot"].map["pre-composite-capture"];
if (warning)
@@ -1657,14 +1665,31 @@ window.templates.webgl.start_view = function(state, info_open)
];
html.push(warning_html);
}
+ break;
+ }
+ switch (state)
+ {
+ case "enable":
html.push(window.templates.webgl.info_box(
- "Refresh the page you want to debug",
- "The WebGL Debugger needs to be present from the start of the " +
+ "Enable the WebGL debugger",
+ "Click the button below to enable the WebGL debugger. This will " +
+ "refresh the current debugging context window",
+ [ "span", "Enable the WebGL debugger",
+ "class", "ui-button",
+ "handler", "webgl-enable",
+ "tabindex", "1"
+ ]
+ ));
+ break;
+ case "init":
+ html.push(window.templates.webgl.info_box(
+ "Refresh the window you want to debug",
+ "The WebGL debugger needs to be present from the start of the " +
"execution of the application you want to debug. Click the button " +
"below to refresh.",
- [ "span", "Initialize WebGL Debugger",
- "class", "ui-button reload-window",
+ [ "span", "Refresh window",
+ "class", "ui-button",
"handler", "reload-window",
"tabindex", "1"
]

1 comment on commit e2e4549

Owner

Also, this commit disables the WebGL debugger when Dragonfly is in profiler mode, albeit in a very ugly way :(

Please sign in to comment.