Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' into task_DFL_2973_Make_Request_reviewed

  • Loading branch information...
commit 35d90d0b59a502f9e78f9c40815fed8f6307b11f 2 parents d56eb74 + 6d79eed
Daniel Herzog authored
Showing with 1,073 additions and 865 deletions.
  1. +27 −15 src/build-application/build_application.js
  2. +7 −0 src/build-application/build_overlay_1_0.js
  3. +4 −2 src/build-application/build_window_manager_2_0.js
  4. +3 −0  src/client-en.xml
  5. +124 −105 src/cookie-manager/cookie_manager_data.js
  6. +1 −0  src/ecma-debugger/dominspection/actions.js
  7. +2 −2 src/ecma-debugger/dominspection/domserializer.js
  8. +20 −19 src/ecma-debugger/dominspection/templates.js
  9. +31 −14 src/ecma-debugger/eventlisteners/evlisteners.css
  10. +2 −1  src/ecma-debugger/eventlisteners/evlistenertooltip.js
  11. +15 −9 src/ecma-debugger/helpers.js
  12. +70 −16 src/ecma-debugger/js-source-view.js
  13. +9 −0 src/ecma-debugger/objectinspection.6.0/baseview.js
  14. +48 −50 src/ecma-debugger/objectinspection.6.0/inspectablejsobject.js
  15. +1 −2  src/ecma-debugger/objectinspection.6.0/prettyprinter.js
  16. +17 −22 src/ecma-debugger/objectinspection.6.0/templates.js
  17. +5 −4 src/ecma-debugger/runtimes.js
  18. +12 −11 src/ecma-debugger/stop_at.js
  19. +20 −8 src/ecma-debugger/views.js
  20. +2 −1  src/ecma-debugger/watches/watches.js
  21. +68 −0 src/lib/dict.js
  22. +12 −58 src/lib/elementprototype.js
  23. +1 −1  src/lib/usertracker.js
  24. +9 −3 src/lib/xmlhttprequestprototype.js
  25. +10 −7 src/profiler/profiler_templates.js
  26. +1 −3 src/repl/friendlyprinter.js
  27. +1 −1  src/repl/listunpacker.js
  28. +3 −1 src/repl/repl_view.js
  29. +29 −16 src/scripts/messages.js
  30. +231 −233 src/scripts/spec_links.js
  31. +2 −0  src/shortcutconfig/shortcutconfig.js
  32. +3 −24 src/storage/data-storages.js
  33. +3 −1 src/storage/storage_style.css
  34. +2 −0  src/style/css_inspector_actions.js
  35. +7 −0 src/style/css_suggest_values.js
  36. +3 −0  src/style/stylesheets.js
  37. +53 −68 src/syntaxhighlight/js/syntax.js
  38. +3 −2 src/syntaxhighlight/js/tokenizer.js
  39. BIN  src/ui-images/icons/icon_refetch_listeners.png
  40. BIN  src/ui-images/icons/icon_reformat.png
  41. +1 −1  src/ui-scripts/Switches.js
  42. +2 −6 src/ui-scripts/actions/actionbroker.js
  43. +2 −0  src/ui-scripts/actions/actionhandlerinterface.js
  44. +3 −1 src/ui-scripts/actions/globalactionhandler.js
  45. +7 −5 src/ui-scripts/actions/keyidentifier.js
  46. +12 −16 src/ui-scripts/containers.js
  47. +29 −7 src/ui-scripts/dialog.js
  48. +1 −1  src/ui-scripts/overlay.js
  49. +1 −1  src/ui-scripts/sortable_table/sortable_table.js
  50. +11 −9 src/ui-scripts/tab.js
  51. +1 −1  src/ui-scripts/tabs.js
  52. +10 −9 src/ui-scripts/tooltip/tooltip.js
  53. +4 −0 src/ui-scripts/tooltip/tooltipcontext.js
  54. +12 −13 src/ui-scripts/view.js
  55. +9 −0 src/ui-strings/ui_strings-en.js
  56. +1 −15 src/ui-style/tabs.css
  57. +12 −11 src/ui-style/ui.css
  58. +31 −12 src/window-manager/window-manager.js
  59. +23 −23 test-scripts/innerHTML/dom_versus_inner_html.html
  60. +7 −7 test-scripts/innerHTML/templates_6_0_test.js
  61. +7 −7 test-scripts/innerHTML/templates_6_0_test_html5.js
  62. +7 −7 test-scripts/selector-matching-performance/test-selectors.js
  63. +16 −11 test-scripts/test-scripts/keyidentifier.html
  64. +3 −3 test-scripts/test-tokenizer/test-tokenizer.html
View
42 src/build-application/build_application.js
@@ -86,7 +86,7 @@ window.app.profiles[window.app.profiles.HTTP_PROFILER].is_enabled = false;
window.app.build_application = function(on_services_created, on_services_enabled)
{
-
+ var app_ctx = {messages: window.messages};
var _find_compatible_version = function(version, version_list)
{
var
@@ -147,6 +147,17 @@ window.app.build_application = function(on_services_created, on_services_enabled
builder = null,
numbers = null;
+ window.messages.clear_session_listeners();
+
+ var session_ctx =
+ {
+ messages: app_ctx.messages,
+ helpers: app_ctx.helpers,
+ tag_manager: app_ctx.tag_manager,
+ show_dragonfly_window: app_ctx.show_dragonfly_window,
+ services: app_ctx.services
+ };
+
for (service_name in service_descriptions)
{
service = service_descriptions[service_name];
@@ -166,7 +177,10 @@ window.app.build_application = function(on_services_created, on_services_enabled
// service_description is a dict of services
// with name and version for each service
// return false if the service shall not be enabled
- window.services[service_name].is_implemented = builder(service, service_descriptions);
+ var is_implemented = builder(service,
+ service_descriptions,
+ session_ctx);
+ window.services[service_name].is_implemented = is_implemented;
}
}
}
@@ -221,14 +235,15 @@ window.app.build_application = function(on_services_created, on_services_enabled
new cls.ServiceBase();
new ActionBroker();
- window.messages.addListener("application-setup", report_usage);
+ window.messages.addListener("application-setup", report_usage, true);
// global objects
- window.tagManager = window.tag_manager = new window.cls.TagManager();
- window.helpers = new cls.Helpers();
+ window.tagManager = window.tag_manager = app_ctx.tag_manager = new window.cls.TagManager();
+ window.helpers = app_ctx.helpers = new cls.Helpers();
// create window.services namespace and register it.
- cls.ServiceBase.register_services(new cls.Namespace("services"));
+ app_ctx.services = new cls.Namespace("services");
+ cls.ServiceBase.register_services(app_ctx.services);
[
'scope',
'console-logger',
@@ -246,6 +261,7 @@ window.app.build_application = function(on_services_created, on_services_enabled
{
cls.debug.create_debug_environment(params);
}
+ app_ctx.show_dragonfly_window = Boolean(params.showdfl);
var namespace = cls.Scope && cls.Scope["1.1"];
namespace.Service.apply(window.services.scope.constructor.prototype);
window.services.scope.is_implemented = true;
@@ -321,18 +337,14 @@ window.app.helpers.parse_url_arguments = function()
supported arguments:
- debug
- log-filter
+ - showdfl
*/
- var
- args = location.search.slice(1).split(';'),
- params = {},
- arg = '',
- i = 0;
-
- for( ; arg = args[i]; i++)
+ var args = location.search.slice(1).split(/[;&]/);
+ var params = {};
+ for (var i = 0, arg; arg = args[i]; i++)
{
arg = arg.split('=');
- params[arg[0].replace(/^ +/, '').replace(/ +$/, '')] =
- arg[1] && arg[1].replace(/^ +/, '').replace(/ +$/, '') || true;
+ params[arg[0].trim()] = arg[1] && arg[1].trim() || true;
}
return params;
}
View
7 src/build-application/build_overlay_1_0.js
@@ -0,0 +1,7 @@
+window.app.builders.Overlay || ( window.app.builders.Overlay = {} );
+
+window.app.builders.Overlay["1.0"] = function(service)
+{
+ return true;
+};
+
View
6 src/build-application/build_window_manager_2_0.js
@@ -4,13 +4,15 @@ window.app.builders.WindowManager || ( window.app.builders.WindowManager = {} );
/**
* @param {Object} service the service description of the according service on the host side
*/
-window.app.builders.WindowManager["2.0"] = function(service)
+window.app.builders.WindowManager["2.0"] = function(service,
+ service_descriptions,
+ session_ctx)
{
var namespace = cls.WindowManager && cls.WindowManager["2.0"];
var service_interface = window.services['window-manager'];
if(service_interface)
{
- window.window_manager_data = new namespace.WindowManagerData();
+ window.window_manager_data = new namespace.WindowManagerData(session_ctx);
window.window_manager_data.bind(service_interface);
window.windowsDropDown = new namespace.WindowsDropDown();
namespace.DebuggerMenu.prototype = new CstSelectWithAction();
View
3  src/client-en.xml
@@ -22,6 +22,7 @@
inset 0 0 0 2px rgba(255, 255, 255, 0.55);
vertical-align: middle;
-o-transition: background-color 0.2s;
+ transition: background-color 0.2s;
}
.ui-button:not([disabled]):active
@@ -225,6 +226,7 @@ window.load_screen_timeout = window.setTimeout(function()
<script src="./lib/stylesheetlistprototype.js"/>
<script src="./lib/xmlhttprequestprototype.js"/>
<script src="./lib/storageprototype.js"/>
+<script src="./lib/dict.js"/>
<script src="./scripts/Timeouts.js"/>
@@ -347,6 +349,7 @@ window.load_screen_timeout = window.setTimeout(function()
<script src="./build-application/build_resource_manager_1_0.js"></script>
<script src="./build-application/build_profiler_1_0.js"></script>
<script src="./build-application/build_document_manager_1_0.js"></script>
+<script src="./build-application/build_overlay_1_0.js"></script>
<script src="./debug/debug.js"/>
<script src="./debug/po_tester.js"/>
View
229 src/cookie-manager/cookie_manager_data.js
@@ -28,8 +28,16 @@ cls.CookieManager.Cookie = function(details, data)
}
}
+cls.CookieManager.Cookie.prototype = new function()
+{
+ this.__defineGetter__("rt_id", function() { return this._rt_id; });
+ this.__defineSetter__("rt_id", function() {});
+}
+
cls.CookieManager.CookieDataBase = function()
{
+ var SUCCESS = 0;
+
this.refetch = function(){};
this.remove_cookie = function(objectref, callback){};
this.remove_cookies = function(cookies){};
@@ -41,15 +49,21 @@ cls.CookieManager.CookieDataBase = function()
this.refetch = function()
{
- this._active_tab_count++;
this.cookie_list = [];
- for (var rt_id in this._rts) {
- this._request_location_object_id(Number(rt_id), this._active_tab_count);
+ for (var rt_id in this._rts)
+ {
+ this._request_location_object_id(Number(rt_id));
};
};
this.get_cookies = function()
{
+ if (!this._is_active)
+ {
+ this._is_active = true;
+ if (this._last_on_active_tab_msg)
+ this._on_active_tab(this._last_on_active_tab_msg)
+ }
return this.cookie_list;
};
@@ -131,29 +145,35 @@ cls.CookieManager.CookieDataBase = function()
this._on_active_tab = function(msg)
{
- this._active_tab_count++;
- this.cookie_list = [];
- for (var i=0; i < msg.runtimes_with_dom.length; i++)
+ if (this._is_active)
{
- var rt_id = msg.runtimes_with_dom[i];
- if (!this._rts[rt_id])
+ for (var i = 0, rt_id; rt_id = msg.runtimes_with_dom[i]; i++)
{
- this._rts[rt_id]={rt_id: rt_id};
- }
- this._request_location_object_id(rt_id, this._active_tab_count);
- };
+ if (!this._rts[rt_id])
+ {
+ this._rts[rt_id] = {rt_id: rt_id};
+ this._request_location_object_id(rt_id);
+ }
+ };
- // cleanup runtimes directory
- for (var rt in this._rts)
- {
- // rt is a string, rt_id is a number which can now be compared with what's in msg.runtimes_with_dom
- var rt_id = this._rts[rt].rt_id;
- if (msg.runtimes_with_dom.indexOf(rt_id) === -1)
+ // cleanup runtimes directory
+ for (var rt in this._rts)
{
- // runtime was not active and is to be removed from this._rts
- delete this._rts[rt_id];
+ // rt is a string, rt_id is a number which can now be compared with what's in msg.runtimes_with_dom
+ var rt_id = this._rts[rt].rt_id;
+ if (msg.runtimes_with_dom.indexOf(rt_id) === -1)
+ {
+ // runtime was not active and is to be removed from this._rts
+ delete this._rts[rt_id];
+ this.cookie_list = this.cookie_list.filter(function(cookie)
+ {
+ return cookie.rt_id != rt_id;
+ });
+ }
}
}
+ else
+ this._last_on_active_tab_msg = msg;
};
this._on_profile_disabled = function(msg)
@@ -165,24 +185,24 @@ cls.CookieManager.CookieDataBase = function()
}
};
- this._request_location_object_id = function(rt_id, active_tab_counter)
+ this._request_location_object_id = function(rt_id)
{
var script = "location";
- var tag = tagManager.set_callback(this, this._handle_location_object_id,[rt_id, active_tab_counter]);
- services['ecmascript-debugger'].requestEval(tag,[rt_id, 0, 0, script]);
+ var tag = tagManager.set_callback(this, this._handle_location_object_id, [rt_id]);
+ services['ecmascript-debugger'].requestEval(tag, [rt_id, 0, 0, script]);
};
- this._handle_location_object_id = function(status, message, rt_id, active_tab_counter)
+ this._handle_location_object_id = function(status, message, rt_id)
{
const
OBJECT_VALUE = 3,
// within sub message ObjectValue
OBJECT_ID = 0;
- if (status === 0 && message[OBJECT_VALUE])
+ if (status === SUCCESS && message[OBJECT_VALUE])
{
var object_id = message[OBJECT_VALUE][OBJECT_ID];
- var tag = tagManager.set_callback(this, this._handle_location, [rt_id, active_tab_counter]);
+ var tag = tagManager.set_callback(this, this._handle_location, [rt_id]);
var command_details = [
rt_id, // runtimeID
[ // objectList
@@ -196,7 +216,7 @@ cls.CookieManager.CookieDataBase = function()
}
};
- this._handle_location = function(status, message, rt_id, active_tab_counter)
+ this._handle_location = function(status, message, rt_id)
{
const
OBJECT_CHAIN_LIST = 0,
@@ -241,8 +261,8 @@ cls.CookieManager.CookieDataBase = function()
if (rt.hostname)
{
var request_hostname = rt.hostname;
- var tag = tagManager.set_callback(this, this._handle_cookies,[rt_id, active_tab_counter]);
- services['cookie-manager'].requestGetCookie(tag,[request_hostname, rt.pathname]);
+ var tag = tagManager.set_callback(this, this._handle_cookies, [rt_id]);
+ services['cookie-manager'].requestGetCookie(tag, [request_hostname, rt.pathname]);
}
else
{
@@ -252,96 +272,94 @@ cls.CookieManager.CookieDataBase = function()
}
};
- this._handle_cookies = function(status, message, rt_id, active_tab_counter)
+ this._handle_cookies = function(status, message, rt_id)
{
- if (this._active_tab_count === active_tab_counter)
+ var rt = this._rts[rt_id];
+ if (!rt)
+ throw "missing runtime in _handle_cookies";
+
+ if (status === SUCCESS)
{
- var rt = this._rts[rt_id] || {};
- if (status === 0)
+ var COOKIE = 0;
+ if (message.length > 0)
{
- const COOKIE = 0;
- if (message.length > 0)
+ var cookies = message[COOKIE];
+ for (var i = 0, cookie_info; cookie_info = cookies[i]; i++)
{
- var cookies = message[COOKIE];
- for (var i=0, cookie_info; cookie_info = cookies[i]; i++) {
- // workaround: GetCookie doesn't allow to specify protocol, requested in CORE-35925
- var is_secure = cookie_info[5];
- if (is_secure && rt.protocol !== "https:")
- {
- continue;
- }
- this.cookie_list.push(
- new cls.CookieManager.Cookie({
- domain: cookie_info[0],
- path: cookie_info[1],
- name: cookie_info[2],
- value: cookie_info[3],
- expires: cookie_info[4],
- isSecure: cookie_info[5],
- isHTTPOnly: cookie_info[6],
+ // workaround: GetCookie doesn't allow to specify protocol, requested in CORE-35925
+ var is_secure = cookie_info[5];
+ if (is_secure && rt.protocol !== "https:")
+ {
+ continue;
+ }
+ this.cookie_list.push(
+ new cls.CookieManager.Cookie({
+ domain: cookie_info[0],
+ path: cookie_info[1],
+ name: cookie_info[2],
+ value: cookie_info[3],
+ expires: cookie_info[4],
+ isSecure: cookie_info[5],
+ isHTTPOnly: cookie_info[6],
- _rt_id: rt_id,
- _rt_hostname: rt.hostname,
- _rt_path: rt.pathname,
- _rt_protocol: rt.protocol
- }, this)
- )
- };
- }
- else
- {
- // In case no cookies come back, check via JS (workaround for CORE-41145)
- var script = "return document.cookie";
- var tag = tagManager.set_callback(this, this._handle_js_retrieved_cookies, [rt_id, active_tab_counter]);
- services['ecmascript-debugger'].requestEval(tag,[rt_id, 0, 0, script]);
- }
+ _rt_id: rt_id,
+ _rt_hostname: rt.hostname,
+ _rt_path: rt.pathname,
+ _rt_protocol: rt.protocol
+ }, this)
+ )
+ };
+ }
+ else
+ {
+ // In case no cookies come back, check via JS (workaround for CORE-41145)
+ var script = "return document.cookie";
+ var tag = tagManager.set_callback(this, this._handle_js_retrieved_cookies, [rt_id]);
+ services['ecmascript-debugger'].requestEval(tag,[rt_id, 0, 0, script]);
}
- // add a placeholder per runtime to make the group show up even if there were no cookies
- this.cookie_list.push(
- new cls.CookieManager.Cookie({
- _is_runtime_placeholder: true,
- _rt_id: rt_id,
- _rt_protocol: rt.protocol,
- _rt_hostname: rt.hostname,
- _rt_path: rt.pathname
- }, this)
- );
- this._view.update();
}
+ // add a placeholder per runtime to make the group show up even if there were no cookies
+ this.cookie_list.push(
+ new cls.CookieManager.Cookie({
+ _is_runtime_placeholder: true,
+ _rt_id: rt_id,
+ _rt_protocol: rt.protocol,
+ _rt_hostname: rt.hostname,
+ _rt_path: rt.pathname
+ }, this)
+ );
+ this._view.update();
};
- this._handle_js_retrieved_cookies = function(status, message, rt_id, active_tab_counter)
+ this._handle_js_retrieved_cookies = function(status, message, rt_id)
{
- if (this._active_tab_count === active_tab_counter)
+ const STATUS = 0;
+ const DATA = 2;
+ if (status === SUCCESS && message[STATUS] == "completed")
{
- const STATUS = 0;
- const DATA = 2;
- if (status === 0 && message[STATUS] == "completed")
+ var rt = this._rts[rt_id] || {};
+ var cookie_string = message[DATA];
+ if (cookie_string && cookie_string.length > 0)
{
- var rt = this._rts[rt_id] || {};
- var cookie_string = message[DATA];
- if (cookie_string && cookie_string.length > 0)
+ var cookies = cookie_string.split('; ');
+ for (var i = 0, cookie_info; cookie_info = cookies[i]; i++)
{
- var cookies = cookie_string.split('; ');
- for (var i=0, cookie_info; cookie_info = cookies[i]; i++)
- {
- var pos = cookie_info.indexOf('=');
- var has_value = pos !== -1;
- this.cookie_list.push(
- new cls.CookieManager.Cookie({
- name: has_value ? cookie_info.slice(0, pos) : cookie_info,
- value: has_value ? decodeURIComponent(cookie_info.slice(pos+1)) : null,
- _rt_id: rt_id,
- _rt_protocol: rt.protocol,
- _rt_hostname: rt.hostname,
- _rt_path: rt.pathname
- }, this)
- );
- };
- }
+ var pos = cookie_info.indexOf('=');
+ var has_value = pos !== -1;
+ this.cookie_list.push(
+ new cls.CookieManager.Cookie({
+ name: has_value ? cookie_info.slice(0, pos) : cookie_info,
+ value: has_value ? decodeURIComponent(cookie_info.slice(pos+1)) : null,
+ _rt_id: rt_id,
+ _rt_protocol: rt.protocol,
+ _rt_hostname: rt.hostname,
+ _rt_path: rt.pathname
+ }, this)
+ );
+ };
}
- this._view.update();
}
+ this._view.update();
};
this._init = function(view)
@@ -349,7 +367,8 @@ cls.CookieManager.CookieDataBase = function()
this._view = view;
this.cookie_list = [];
this._rts = {};
- this._active_tab_count = 0;
+ this._active_dom_rt_ids = [];
+ this._is_active = false;
window.messages.addListener('active-tab', this._on_active_tab.bind(this));
window.messages.addListener('profile-disabled', this._on_profile_disabled.bind(this));
};
View
1  src/ecma-debugger/dominspection/actions.js
@@ -8,6 +8,7 @@
cls.DOMInspectorActions = function(id)
{
+ ActionHandlerInterface.apply(this);
this.view_id = id;
this.id = id;
View
4 src/ecma-debugger/dominspection/domserializer.js
@@ -159,7 +159,7 @@ window.cls.DOMSerializer.prototype = new function()
{
tree += LINEBREAK + getIndent(node[DEPTH] - start_depth) +
"<" + node_name + attrs + ">" +
- helpers.escapeTextHtml(one_child_value) +
+ helpers.escape_html(one_child_value) +
"</" + node_name + ">";
i = child_pointer - 1;
}
@@ -216,7 +216,7 @@ window.cls.DOMSerializer.prototype = new function()
{
if( !/^\s*$/.test(node[ VALUE ] ) )
{
- tree += LINEBREAK + getIndent(node[DEPTH] - start_depth) + helpers.escapeTextHtml(node[VALUE]);
+ tree += LINEBREAK + getIndent(node[DEPTH] - start_depth) + helpers.escape_html(node[VALUE]);
}
}
}
View
39 src/ecma-debugger/dominspection/templates.js
@@ -145,7 +145,7 @@
{
for (var i = 0, attr, attr_value, attrs = ''; attr = node[ATTRS][i]; i++)
{
- attr_value = helpers.escapeAttributeHtml(attr[ATTR_VALUE]);
+ attr_value = helpers.escape_html_attr(attr[ATTR_VALUE]);
if (typeof is_search_hit != 'boolean' || is_search_hit)
{
attrs += " <key>" + safe_escape_attr_key(attr) +
@@ -163,7 +163,7 @@
{
for (var i = 0, attr, attr_value, attrs = ''; attr = node[ATTRS][i]; i++)
{
- attr_value = helpers.escapeAttributeHtml(attr[ATTR_VALUE]);
+ attr_value = helpers.escape_html_attr(attr[ATTR_VALUE]);
attrs += " <key>" +
"<match-token>" + safe_escape_attr_key(attr) + "</match-token>" +
"</key>=<value>\"" +
@@ -199,14 +199,14 @@
continue;
}
node_name = (node[NAMESPACE] ? node[NAMESPACE] + ':': '') + node[NAME];
- node_name = helpers.escapeTextHtml(node_name);
+ node_name = helpers.escape_html(node_name);
if (force_lower_case && disregard_force_lower_case(node))
{
disregard_force_lower_case_depth = node[DEPTH];
force_lower_case = false;
}
else if (disregard_force_lower_case_depth &&
- disregard_force_lower_case_depth == node[DEPTH])
+ disregard_force_lower_case_depth >= node[DEPTH])
{
disregard_force_lower_case_depth = 0;
force_lower_case = model.isTextHtml() &&
@@ -267,7 +267,7 @@
"<div class='search-match dom-search comment pre-wrap' " +
"obj-id='" + node[ID] + "' handler='show-search-match' >" +
(open_tag ? open_tag + "!--" : "#comment") +
- "<match-token>" + helpers.escapeTextHtml(node[VALUE]) + "</match-token>" +
+ "<match-token>" + helpers.escape_html(node[VALUE]) + "</match-token>" +
(close_tag ? "--" + close_tag : "") +
"</div>";
}
@@ -305,7 +305,7 @@
"<div class='search-match dom-search' " +
"obj-id='" + node[ID] + "' handler='show-search-match' >" +
"<span class='dom-search-text-node'>#text</span>" +
- "<match-token>" + helpers.escapeTextHtml(node[VALUE]) + "</match-token>" +
+ "<match-token>" + helpers.escape_html(node[VALUE]) + "</match-token>" +
"</div>";
}
}
@@ -357,7 +357,8 @@
current_depth = node[DEPTH];
children_length = node[CHILDREN_LENGTH];
is_expandable = children_length || (show_pseudo_elements &&
- node[PSEUDO_ELEMENT_LIST]);
+ node[PSEUDO_ELEMENT_LIST] &&
+ node[PSEUDO_ELEMENT_LIST].length);
child_pointer = 0;
if (force_lower_case && disregard_force_lower_case(node))
@@ -366,7 +367,7 @@
force_lower_case = false;
}
else if (disregard_force_lower_case_depth &&
- disregard_force_lower_case_depth == node[DEPTH])
+ disregard_force_lower_case_depth >= node[DEPTH])
{
disregard_force_lower_case_depth = 0;
force_lower_case = model.isTextHtml() && window.settings.dom.get('force-lowercase');
@@ -393,7 +394,7 @@
case ELEMENT_NODE:
{
var node_name = (node[NAMESPACE] ? node[NAMESPACE] + ':' : '') + node[NAME];
- node_name = helpers.escapeTextHtml(node_name);
+ node_name = helpers.escape_html(node_name);
var ev_listener = node[EVENT_LISTENER_LIST] && node[EVENT_LISTENER_LIST].length
? EV_LISTENER_MARKUP
: "";
@@ -406,7 +407,7 @@
attrs = '';
for (k = 0; attr = node[ATTRS][k]; k++)
{
- attr_value = helpers.escapeAttributeHtml(attr[ATTR_VALUE]);
+ attr_value = helpers.escape_html_attr(attr[ATTR_VALUE]);
attrs += " <key>" +
((attr[ATTR_PREFIX] ? attr[ATTR_PREFIX] + ':' : '') +
/* Regarding escaping "<". It happens that there are very
@@ -452,7 +453,7 @@
{
one_child_text_content += "<text" +
" ref-id='" + data[child_pointer][ID] + "' " +
- ">" + helpers.escapeTextHtml(data[child_pointer][VALUE]) + "</text>";
+ ">" + helpers.escape_html(data[child_pointer][VALUE]) + "</text>";
}
}
if (has_only_text_content)
@@ -537,7 +538,7 @@
"ref-id='" + node[ID] + "' " +
"class='comment pre-wrap'>" +
"&lt;!--" +
- helpers.escapeTextHtml(node[VALUE]) +
+ helpers.escape_html(node[VALUE]) +
"--&gt;</div>";
}
}
@@ -569,7 +570,7 @@
(no_contextmenu ? "" : "data-menu='dom-element' ") +
">" +
"<text ref-id='"+ node[ID] + "' " +
- ">" + helpers.escapeTextHtml(node[VALUE]) + "</text>" +
+ ">" + helpers.escape_html(node[VALUE]) + "</text>" +
"</div>";
}
}
@@ -641,7 +642,7 @@
disregard_force_lower_case_depth = node[DEPTH];
force_lower_case = false;
}
- else if (disregard_force_lower_case_depth && disregard_force_lower_case_depth == node[DEPTH])
+ else if (disregard_force_lower_case_depth && disregard_force_lower_case_depth >= node[DEPTH])
{
disregard_force_lower_case_depth = 0;
force_lower_case = model.isTextHtml() && window.settings.dom.get('force-lowercase');
@@ -672,7 +673,7 @@
case ELEMENT_NODE:
{
var node_name = (node[NAMESPACE] ? node[NAMESPACE] + ':' : '') + node[NAME];
- node_name = helpers.escapeTextHtml(node_name);
+ node_name = helpers.escape_html(node_name);
if (force_lower_case)
{
node_name = node_name.toLowerCase();
@@ -682,7 +683,7 @@
attrs = '';
for (k = 0; attr = node[ATTRS][k]; k++)
{
- attr_value = helpers.escapeAttributeHtml(attr[ATTR_VALUE]);
+ attr_value = helpers.escape_html_attr(attr[ATTR_VALUE]);
attrs += " <key>" +
(attr[ATTR_PREFIX] ? attr[ATTR_PREFIX] + ':' : '') +
/* regarding escaping "<". it happens that there are very starnge keys in broken html.
@@ -749,7 +750,7 @@
"ref-id='"+node[ID] + "' " +
"class='comment pre-wrap'>" +
"<span class='comment-node'>#comment</span>" +
- helpers.escapeTextHtml(node[VALUE]) + "</div>";
+ helpers.escape_html(node[VALUE]) + "</div>";
}
break;
}
@@ -792,7 +793,7 @@
">" +
(node[NAME] ? node[NAME] : this._node_name_map[node[TYPE]]) +
"<text ref-id='" + node[ID] + "' >" +
- helpers.escapeTextHtml(node[VALUE]) + "</text>" +
+ helpers.escape_html(node[VALUE]) + "</text>" +
"</div>";
}
}
@@ -807,7 +808,7 @@
"<text ref-id='" + node[ID]+ "' " +
" class='" + (only_whitespace ? "only-whitespace" : "") + "'>" +
(only_whitespace ? helpers.escape_whitespace(node[VALUE])
- : helpers.escapeTextHtml(node[VALUE])) +
+ : helpers.escape_html(node[VALUE])) +
"</text>" +
"</div>";
}
View
45 src/ecma-debugger/eventlisteners/evlisteners.css
@@ -1,17 +1,14 @@
-.ev-rt-list
+.ev-rt-list > li
{
- margin-top: 5px;
-}
-
-.ev-type-list
-{
- margin: 0;
+ margin-bottom: 6px;
}
.ev-listener-tooltip
{
margin: 0;
margin-top: -13px;
+ white-space: pre;
+ min-width: 180px;
}
.list-selected-node
@@ -39,17 +36,21 @@
.ev-listener
{
- display: inline-block;
- height: 12px;
- line-height: 12px;
- vertical-align: middle;
+
margin-left: 3px;
padding: 0 2px;
- background-color: hsl(0, 0%, 70%);
+ background-color: rgba(0, 0, 0, 0.29);
color: #fff;
border-radius: 2px;
}
+.ev-listener.tooltip-selected
+{
+ box-shadow: none;
+ color: #fff;
+ background-color: rgba(82, 122, 204, 0.55);
+}
+
.ev-listener::after
{
content: "ev";
@@ -58,6 +59,7 @@
.ev-type
{
font: inherit;
+ position: relative;
}
.ev-listener-tooltip .ev-type,
@@ -66,7 +68,7 @@
background-color: hsla(0, 0%, 0%, 0.04);
padding: 2px 8px;
border-width: 1px 0;
- margin: 5px 0px 1px;
+ margin: 5px 0 1px;
}
.ev-listener-tooltip .ev-type
@@ -76,7 +78,17 @@
.ev-phase
{
- float: right;
+ /*
+ Propably an expensive way to right align text. But a common float causes an unstable
+ box with horizontal scrollbars which disappears on hover with an ugly jumping tooltip.
+ */
+ position: absolute;
+ left: 0;
+ top: 0;
+ width: 100%;
+ box-sizing: border-box;
+ padding-right: 8px;
+ text-align: right;
font-style: italic;
color: hsl(0, 0%, 50%);
}
@@ -97,6 +109,11 @@
margin-left: 12px;
}
+.ev-rt-list .ev-rt-title
+{
+ margin-left: 0;
+}
+
.tooltip-function-source .js-tooltip-examine-container
{
padding: 0;
View
3  src/ecma-debugger/eventlisteners/evlistenertooltip.js
@@ -49,7 +49,8 @@ cls.EventListenerTooltip = function()
var _reload_script_dialog = function(event, target)
{
new ConfirmDialog(ui_strings.D_RELOAD_SCRIPTS,
- function(){ window.runtimes.reloadWindow(); }).show();
+ [function() { window.runtimes.reloadWindow(); }],
+ ConfirmDialog.YES_NO).show();
};
var _init = function(view)
View
24 src/ecma-debugger/helpers.js
@@ -113,24 +113,30 @@ window.cls.Helpers = function()
|| top_url.replace(/\?.*$/, '').replace(/#.*$/, '').replace(/\/[^/]*$/, "/") + url );
}
- this.escapeTextHtml = (function()
+ this.escape_html = (function()
{
- var re_amp = /&/g, re_lt = /</g;
+ var re_amp = /&/g;
+ var re_lt = /</g;
+ var re_cd_end = /]]>/g;
return function(str)
{
- return str ? str.replace(re_amp, "&amp;").replace(re_lt, "&lt;") : str;
+ return str ? str.replace(re_amp, "&amp;")
+ .replace(re_lt, "&lt;")
+ .replace(re_cd_end, "]]&gt;")
+ : str;
}
})();
- this.escapeAttributeHtml = (function()
+ this.escape_html_attr = (function()
{
- var re_amp = /&/g, re_lt = /</g, re_quot = /"/g, re_s_quot = /'/g;
+ var re_quot = /"/g;
+ var re_apos = /'/g;
return function(str)
{
- return str.replace(re_amp, "&amp;")
- .replace(re_lt, "&lt;")
- .replace(re_quot, "&quot;")
- .replace(re_s_quot, "&#x27;");
+ return str ? this.escape_html(str)
+ .replace(re_quot, "&quot;")
+ .replace(re_apos, "&#x27;")
+ : str;
}
})();
View
86 src/ecma-debugger/js-source-view.js
@@ -221,8 +221,7 @@ cls.JsSourceView = function(id, name, container_class)
container.innerHTML = "" +
"<div id='" + SCROLL_CONTENT_ID + "'>"+
"<div class='" + CONTAINER_CLASS_NAME + "' " +
- "data-menu='js-source-content' " +
- "data-tooltip='" + cls.JSSourceTooltip.tooltip_name + "'></div>"+
+ "data-menu='js-source-content'></div>" +
"</div>"+
"<div id='" + SCROLL_CONTAINER_ID + "' handler='scroll-js-source'>"+
"<div id='" + SCROLL_ID + "'></div>"+
@@ -311,8 +310,7 @@ cls.JsSourceView = function(id, name, container_class)
this.onresize = function(container)
{
- // optimization - having no line wrapping allows to optimize out width-only changes
- if(this.isvisible() && context['container-height'] != parseInt(container.style.height))
+ if(this.isvisible())
{
__view_is_destroyed = true;
this.createView(container);
@@ -396,9 +394,10 @@ cls.JsSourceView = function(id, name, container_class)
var setScriptContext = function(script_id, line_no)
{
- source_content.innerHTML = "<div style='visibility:hidden'>" +
+ source_content.innerHTML = "<div style='visibility:hidden;float:left'>" +
simple_js_parser.format(__current_script, getMaxLengthLineIndex() - 1, 1).join('') + "</div>";
- var scrollWidth = __current_script.scroll_width = document.getElementById(SCROLL_CONTENT_ID).scrollWidth;
+ var scroll_width_target = source_content.firstElementChild || document.getElementById(SCROLL_CONTENT_ID);
+ var scrollWidth = __current_script.scroll_width = scroll_width_target.scrollWidth;
var offsetWidth = document.getElementById(SCROLL_CONTENT_ID).offsetWidth;
// ensure that a scrollbar is also displayed with very long one-liner scripts
// max width which produces a scrollbar is 0x7FFF - 1
@@ -419,6 +418,14 @@ cls.JsSourceView = function(id, name, container_class)
{
__max_lines = __current_script.line_arr.length;
}
+
+ if (__current_script.line_arr.length > __max_lines &&
+ scrollWidth <= offsetWidth && offsetWidth - scrollWidth < context['scrollbar-width'])
+ {
+ __max_lines -= 1;
+ __current_script.scroll_width += context['scrollbar-width'];
+ }
+
var lines = document.querySelector(CONTAINER_LINE_NR_SELECTOR);
if (lines)
@@ -546,7 +553,7 @@ cls.JsSourceView = function(id, name, container_class)
{
var error_line = 0;
while(error_line < script_obj.line_arr.length &&
- script_obj.line_arr[error_line] < script_obj.parse_error.offset)
+ script_obj.line_arr[error_line] <= script_obj.parse_error.offset)
{
error_line++;
}
@@ -565,7 +572,7 @@ cls.JsSourceView = function(id, name, container_class)
{
document.getElementById(SCROLL_ID).innerHTML = "";
if (typeof script_id == "number" && !isNaN(script_id) &&
- typeof line_no == "number" && !isNaN(line_no))
+ typeof line_no == "number" && !isNaN(line_no))
{
new ConfirmDialog(ui_strings.D_RELOAD_SCRIPTS,
function(){ runtimes.reloadWindow(); }).show();
@@ -851,7 +858,9 @@ cls.JsSourceView = function(id, name, container_class)
}
- /* action broker interface */
+ /* action handler interface */
+
+ ActionHandlerInterface.apply(this);
/**
* To handle a single action.
@@ -981,10 +990,49 @@ cls.JsSourceView = function(id, name, container_class)
}
};
- eventHandlers.mousewheel['scroll-js-source-view'] = function(event, target)
+ var _last_delta = 0;
+ var _accumulated_delta = 0;
+ var UNIT_LINES = 1;
+ var UNIT_PIXELS = 2;
+
+ this._get_lines_from_delta = function(delta, unit)
{
- this._scroll_lines((event.detail > 0 ? 1 : -1) * 3 , event, target);
- }.bind(this);
+ var lines = 0;
+ if (unit == UNIT_LINES)
+ lines = delta;
+ else if (unit == UNIT_PIXELS)
+ {
+ if (_last_delta * delta < 0)
+ // Scroll direction has changed - reset accumulated delta.
+ _accumulated_delta = 0;
+
+ _last_delta = delta;
+ _accumulated_delta += delta;
+ // Convert pixels to lines.
+ delta = _accumulated_delta / window.defaults["js-source-line-height"];
+
+ if (Math.abs(delta) >= 1)
+ {
+ // Enough delta to scroll at least one line, round delta
+ // to full integer towards 0 and store remainder for later.
+ lines = delta > 0 ? Math.floor(delta) : Math.ceil(delta);
+ _accumulated_delta -= lines * window.defaults["js-source-line-height"];
+ }
+ }
+
+ return lines;
+ }
+
+ window.eventHandlers.mousewheel['scroll-js-source-view'] = function(unit, event, target)
+ {
+ if (event.wheelDeltaX)
+ // Horizontal scrolling is handled natively by the browser.
+ return;
+
+ var lines = this._get_lines_from_delta(-event.wheelDelta / 40, unit);
+ if (lines)
+ this._scroll_lines(lines, event, target);
+ }.bind(this, navigator.platform == 'MacIntel' ? UNIT_PIXELS : UNIT_LINES);
this._handlers['show-window-go-to-line'] = function(event, target)
{
@@ -1001,7 +1049,13 @@ cls.JsSourceView = function(id, name, container_class)
this._handlers["scroll-page-down"] = this._scroll_lines.bind(this, PAGE_SCROLL);
this._handlers["scroll-arrow-up"] = this._scroll_lines.bind(this, -ARROW_SCROLL);
this._handlers["scroll-arrow-down"] = this._scroll_lines.bind(this, ARROW_SCROLL);
- this.init(id, name, container_class, null, "scroll-js-source-view");
+ this.init(id,
+ name,
+ container_class,
+ null,
+ "scroll-js-source-view",
+ null,
+ cls.JSSourceTooltip.tooltip_name);
this._go_to_line = new cls.GoToLine(this);
messages.addListener("update-layout", updateLayout);
messages.addListener("runtime-destroyed", onRuntimeDestroyed);
@@ -1308,7 +1362,7 @@ cls.JsSourceView.create_ui_widgets = function()
new Switches ('js_source', switches);
- eventHandlers.change['set-tab-size'] = function(event, target)
+ window.eventHandlers.change['set-tab-size'] = function(event, target)
{
var
style = document.styleSheets.getDeclaration(DIV_SELECTOR),
@@ -1321,7 +1375,7 @@ cls.JsSourceView.create_ui_widgets = function()
}
}
- eventHandlers.change['set-max-search-hits'] = function(event, target)
+ window.eventHandlers.change['set-max-search-hits'] = function(event, target)
{
var max_search_hits = Number(event.target.value);
if (100 < max_search_hits && max_search_hits < 10000)
@@ -1330,7 +1384,7 @@ cls.JsSourceView.create_ui_widgets = function()
}
}
- eventHandlers.click['show-event-breakpoint-view'] = function(event, target)
+ window.eventHandlers.click['show-event-breakpoint-view'] = function(event, target)
{
var view = window.views['event-breakpoints'];
UIWindowBase.showWindow(view.id,
View
9 src/ecma-debugger/objectinspection.6.0/baseview.js
@@ -12,6 +12,7 @@ cls.EcmascriptDebugger["6.0"].InspectionBaseView = function()
this.createView = function(container)
{
+ this._is_destroyed = false;
var data_model = this._data || window.inspections && window.inspections[this._cur_data];
if (data_model)
{
@@ -38,6 +39,9 @@ cls.EcmascriptDebugger["6.0"].InspectionBaseView = function()
this._create_view = function(container, data_model)
{
+ if (this._is_destroyed)
+ return;
+
var tmpl = window.templates.inspected_js_object(data_model, false,
null, this._searchterm);
container.clearAndRender(tmpl);
@@ -54,6 +58,11 @@ cls.EcmascriptDebugger["6.0"].InspectionBaseView = function()
this._tmpl_no_content = function(){return []};
+ this.ondestroy = function()
+ {
+ this._is_destroyed = true;
+ }
+
}
cls.EcmascriptDebugger["6.0"].InspectionBaseView.prototype = ViewBase;
View
98 src/ecma-debugger/objectinspection.6.0/inspectablejsobject.js
@@ -107,7 +107,7 @@ cls.EcmascriptDebugger["6.0"].InspectableJSObject.prototype = new function()
]
};
this._queried_map = {};
- this._expand_tree = {object_id: 0, protos: {}};
+ this._expand_tree = new Dict({object_id: 0, protos: new Dict()});
this._rt_id = rt_id;
this._obj_id = obj_id;
this._identifier = identifier || '';
@@ -125,26 +125,28 @@ cls.EcmascriptDebugger["6.0"].InspectableJSObject.prototype = new function()
this._get_subtree = function(path)
{
- const PATH_KEY = 0, PATH_OBJ_ID = 1, PATH_PROTO_INDEX = 2;
- var key = '', obj_id = 0, proto_index = 0, i = 0, tree = this._expand_tree, index = 0;
- for ( ; path && path[i]; i++)
+ var PATH_KEY = 0;
+ var PATH_OBJ_ID = 1;
+ var PATH_PROTO_INDEX = 2;
+ var tree = this._expand_tree;
+ for (var i = 0; path && path[i]; i++)
{
- key = path[i][PATH_KEY];
- obj_id = path[i][PATH_OBJ_ID];
- index = path[i][PATH_PROTO_INDEX];
- if (i < (path.length - 1) && !(tree.protos[index] && tree.protos[index][key]))
- {
- throw 'not valid path in InspectionBaseData._handle_examine_object';
- }
- if (!tree.protos)
- tree.protos = {};
- if (!tree.protos[index])
- tree.protos[index] = {};
+ var key = path[i][PATH_KEY];
+ var obj_id = path[i][PATH_OBJ_ID];
+ var index = path[i][PATH_PROTO_INDEX];
+ if (i < (path.length - 1) && !(tree.get_chain(["protos", index, key])))
+ throw "not valid path in InspectableJSObject._get_subtree";
+
+ if (!tree.get("protos"))
+ tree.set("protos", new Dict());
+ var protos = tree.get("protos");
+ if (!protos.get(index))
+ protos.set(index, new Dict());
+ var proto_index = protos.get(index);
/* the last element of a prototype path has no object id */
- if ((!has_own_property.call(tree.protos[index], key) && !isNaN(obj_id)) ||
- tree.protos[index][key] === null)
- tree.protos[index][key] = {object_id: obj_id, protos: {}};
- tree = tree.protos[index][key];
+ if (!proto_index.get(key) && !isNaN(obj_id))
+ proto_index.set(key, new Dict({object_id: obj_id, protos: new Dict()}));
+ tree = proto_index.get(key);
}
return tree;
}
@@ -153,21 +155,18 @@ cls.EcmascriptDebugger["6.0"].InspectableJSObject.prototype = new function()
// returns the removed tree
this._remove_subtree = function(path)
{
- const PATH_KEY = 0, PATH_OBJ_ID = 1, PATH_PROTO_INDEX = 2;
- var
- key = '',
- obj_id = 0,
- proto_index = 0,
- i = 0,
- tree = this._expand_tree,
- ret = null;
-
- for ( ; path && path[i]; i++)
+ var PATH_KEY = 0;
+ var PATH_OBJ_ID = 1;
+ var PATH_PROTO_INDEX = 2;
+ var tree = this._expand_tree;
+ var ret = null;
+ for (var i = 0; path && path[i]; i++)
{
- key = path[i][PATH_KEY];
- obj_id = path[i][PATH_OBJ_ID];
- index = path[i][PATH_PROTO_INDEX];
- if (!(tree.protos && tree.protos[index] && tree.protos[index][key]))
+ var key = path[i][PATH_KEY];
+ var obj_id = path[i][PATH_OBJ_ID];
+ var index = path[i][PATH_PROTO_INDEX];
+ var sub_tree = tree.get_chain(["protos", index, key]);
+ if (!sub_tree)
{
// with watches it can happen that we try to collapse
// a path which was never expanded.
@@ -175,11 +174,11 @@ cls.EcmascriptDebugger["6.0"].InspectableJSObject.prototype = new function()
}
if (i == path.length - 1)
{
- ret = tree.protos[index][key];
- tree.protos[index][key] = null;
+ ret = sub_tree;
+ tree.get_chain(["protos", index])["delete"](key);
break;
}
- tree = tree.protos[index][key];
+ tree = sub_tree;
}
return ret;
}
@@ -285,7 +284,7 @@ cls.EcmascriptDebugger["6.0"].InspectableJSObject.prototype = new function()
}
}
- this._obj_map[this._get_subtree(path).object_id] = proto_chain;
+ this._obj_map[this._get_subtree(path).get("object_id")] = proto_chain;
if (cb)
cb();
}
@@ -320,22 +319,21 @@ cls.EcmascriptDebugger["6.0"].InspectableJSObject.prototype = new function()
this._get_all_ids = function get_all_ids(tree, ret)
{
ret || (ret = []);
- if (tree)
+ if (tree && tree.get("object_id"))
{
- ret.push(tree.object_id);
- for (var index in tree.protos)
+ ret.push(tree.get("object_id"));
+ var protos = tree.get("protos");
+ protos.keys().forEach(function(index)
{
- for (var key in tree.protos[index])
+ var proto = protos.get(index);
+ proto.keys().forEach(function(key)
{
- if (tree.protos[index][key])
- {
- get_all_ids(tree.protos[index][key], ret);
- }
- }
- }
+ get_all_ids(proto.get(key), ret);
+ });
+ });
}
return ret;
- }
+ };
this._get_id = (function()
{
@@ -436,8 +434,8 @@ cls.EcmascriptDebugger["6.0"].InspectableJSObject.prototype = new function()
path = this._norm_path(path).slice(0);
var index = path.pop()[PATH_PROTO_INDEX];
var top = this._get_subtree(path);
- var removed = top.protos[index];
- top.protos[index] = null;
+ var removed = top.get(["protos", index]);
+ top.get("protos")["delete"](index);
this._cleanup_maps(removed);
};
View
3  src/ecma-debugger/objectinspection.6.0/prettyprinter.js
@@ -90,8 +90,7 @@ cls.PrettyPrinter.types[cls.PrettyPrinter.DATE] =
{
return class_name == "Date";
},
- script: "new Date(object.getTime() - object.getTimezoneOffset() * 1000 * 60)" +
- ".toISOString().replace(\"Z\", \"\")",
+ script: "object.toString()",
template: function(message, ctx)
{
var VALUE = 2;
View
39 src/ecma-debugger/objectinspection.6.0/templates.js
@@ -28,19 +28,14 @@
/* private */
- var _has_own_prop = Object.prototype.hasOwnProperty;
-
var _is_unfolded = function(tree, index, name, collapsed_protos)
{
if (!index) // the properties of the object itself
return true;
-
- if (!_has_own_prop.call(tree.protos, index.toString()))
- return collapsed_protos[0] == '*'
- ? false
- : (collapsed_protos.indexOf(name) == -1);
-
- return Boolean(tree.protos[index]);
+ var proto = tree.get_chain(["protos", index]);
+ if (!proto)
+ return collapsed_protos[0] == '*' ? false : (collapsed_protos.indexOf(name) == -1);
+ return true;
}
var _pretty_print_object = function(model,
@@ -86,9 +81,10 @@
var ret = [];
var name = proto[VALUE][CLASS_NAME] || "";
var is_unfolded = _is_unfolded(tree, index, name, collapsed_protos);
+ var proto_tree = tree.get_chain(["protos", index]) || new Dict();
var expanded_props = is_unfolded &&
_pretty_print_properties(model,
- tree.protos && tree.protos[index] || {},
+ proto_tree,
proto[PROPERTY_LIST] || [],
collapsed_protos,
filter,
@@ -157,7 +153,7 @@
for (var prop = null, i = 0; prop = property_list[i]; i++)
{
value = prop[PROPERTY_VALUE];
- esc_name = helpers.escapeAttributeHtml(prop[NAME]);
+ esc_name = helpers.escape_html_attr(prop[NAME]);
switch (type = prop[PROPERTY_TYPE])
{
case "number":
@@ -210,7 +206,7 @@
}
short_val = value.length > MAX_VALUE_LENGTH ?
value.slice(0, MAX_VALUE_LENGTH) + '' : '';
- value = helpers.escapeAttributeHtml(value);
+ value = helpers.escape_html_attr(value);
if (short_val)
{
if (!searchterm ||
@@ -223,7 +219,7 @@
"<key data-spec='dom#" + esc_name + "'" +
editable(prop) + ">" + esc_name + "</key>\u00A0" +
"<value class='" + type + "' data-value='\"" + value + "\"'>" +
- "\"" + helpers.escapeTextHtml(short_val) + "\"" +
+ "\"" + helpers.escape_html(short_val) + "\"" +
"</value>" +
"</item>"
);
@@ -274,9 +270,9 @@
case "object":
{
obj_id = prop[OBJECT_VALUE][OBJECT_ID];
- expanded_prop = _has_own_prop.call(tree, prop[NAME]) &&
+ expanded_prop = tree.get(prop[NAME]) &&
_pretty_print_object(model,
- tree[prop[NAME]],
+ tree.get(prop[NAME]),
obj_id,
collapsed_protos,
filter,
@@ -285,7 +281,7 @@
has_match = !searchterm ||
prop[NAME].toLowerCase().contains(searchterm) ||
value.toLowerCase().contains(searchterm);
- if (has_match || expanded_prop.length)
+ if (has_match || (expanded_prop && expanded_prop.length))
{
ret.push(
"<item obj-id='" + obj_id + "'>" +
@@ -294,12 +290,11 @@
"handler='examine-object' " +
"class='folder-key" + (has_match ? "" : " no-match") + "' "
);
- // 'in' is true for all non enumarables
- if (_has_own_prop.call(tree, prop[NAME]) && tree[prop[NAME]])
+ if (tree.get(prop[NAME]))
ret.push(STYLE_EXPANDED);
ret.push(
"/>" +
- "<key " + (has_match ? "" : " class='no-match'") +
+ "<key " + (has_match ? "" : " class='no-match' ") +
"data-spec='dom#" + esc_name + "'" + editable(prop) +
">" + esc_name + "</key>" +
(esc_name ? " " : "") +
@@ -308,7 +303,7 @@
"data-tooltip='" + TOOLTIP_NAME + "' >" + value + "</value>"
);
- if (_has_own_prop.call(tree, prop[NAME]))
+ if (tree.get(prop[NAME]))
ret.extend(expanded_prop);
ret.push("</item>");
@@ -332,7 +327,7 @@
window.inspectionfilters;
var ret = _pretty_print_object(model,
tree,
- tree.object_id,
+ tree.get("object_id"),
collapsed_protos,
filter,
searchterm).join('');
@@ -345,7 +340,7 @@
{
var OBJ_ID = 1;
var tree = model.get_expanded_tree(null, path);
- var data = tree && model.get_data(tree.object_id);
+ var data = tree && model.get_data(tree.get("object_id"));
var setting = window.settings.inspection;
var collapsed_protos = setting.get('collapsed-prototypes');
var filter = !setting.get('show-default-nulls-and-empty-strings') &&
View
9 src/ecma-debugger/runtimes.js
@@ -10,6 +10,7 @@ cls.EcmascriptDebugger["6.0"].Runtime = function(runtime)
var OBJECT_ID = 3;
var URI = 4;
var DESCRIPTION = 5;
+ var EXTENSION_NAME = 7;
this.runtime_id = runtime[RUNTIME_ID];
this.html_frame_path = runtime[HTML_FRAME_PATH];
@@ -17,6 +18,7 @@ cls.EcmascriptDebugger["6.0"].Runtime = function(runtime)
this.object_id = runtime[OBJECT_ID];
this.uri = runtime[URI];
this.description = runtime[DESCRIPTION];
+ this.extension_name = runtime[EXTENSION_NAME];
};
cls.EcmascriptDebugger["6.0"].Runtime.prototype = new URIPrototype("uri");
@@ -38,7 +40,7 @@ cls.EcmascriptDebugger["6.0"].ExtensionRuntime = function(rt)
this.type = "extension";
this.id = rt.runtime_id;
this.uri = rt.uri;
- this.title = "Extension Runtime " + rt.runtime_id;
+ this.title = "Extension" + (rt.extension_name ? ": " + rt.extension_name : " Runtime " + rt.runtime_id);
};
/**
@@ -1366,9 +1368,8 @@ cls.EcmascriptDebugger["6.0"].Runtimes = function(service_version)
}
else if (window.services.exec && window.services.exec.is_implemented)
{
- var msg = [[["reload",
- null,
- window.window_manager_data.get_debug_context()]]];
+ var action_list = ["reload", null, window_id];
+ var msg = [[action_list]];
window.services.exec.requestExec(cls.TagManager.IGNORE_RESPONSE, msg);
}
}
View
23 src/ecma-debugger/stop_at.js
@@ -46,16 +46,16 @@ cls.EcmascriptDebugger["6.0"].StopAt = function()
var reformat_condition =
[
- "var MAX_SLICE = 5000;",
- "var LIMIT = 11;",
- "var re = /\\s+/g;",
- "var ws = 0;",
- "var m = null;",
- "var src = scriptData.slice(0, MAX_SLICE);",
- "while (m = re.exec(src))",
- " ws += m[0].length;",
- "",
- "return (100 * ws / src.length) < LIMIT;",
+ "var MAX_LINE_LENGTH = 160;",
+ "var last = 0;",
+ "var index = 0;",
+ "while ((index = scriptData.indexOf(\"\\n\", last)) > -1)",
+ "{",
+ " if (index - last > MAX_LINE_LENGTH)",
+ " return true;",
+ " last = index + 1;",
+ "}",
+ "return scriptData.length - last > MAX_LINE_LENGTH;"
].join("");
var self = this;
@@ -101,7 +101,8 @@ cls.EcmascriptDebugger["6.0"].StopAt = function()
if (msg.key == 'reformat_javascript')
{
new ConfirmDialog(ui_strings.D_REFORMAT_SCRIPTS,
- function() { window.runtimes.reloadWindow(); }).show();
+ [function() { window.runtimes.reloadWindow(); }],
+ ConfirmDialog.YES_NO).show();
}
}
};
View
28 src/ecma-debugger/views.js
@@ -79,17 +79,29 @@ cls.AboutView.create_ui_widgets = function()
about:
function(setting)
{
- new XMLHttpRequest().loadResource('AUTHORS', function(xml)
+ var on_about_sucess = function(xml)
{
- var
- authors = document.getElementById('about-authors'),
- response_text = xml.responseText;
- if(authors && response_text)
- {
+ var authors = document.getElementById('about-authors');
+ var response_text = xml.responseText;
+ if (authors && response_text)
authors.textContent = response_text;
+ };
+
+ var on_about_error = function()
+ {
+ var authors = document.getElementById('about-authors');
+ if (authors)
+ {
+ var tmpl = ["a", ui_strings.S_CONTRIBUTORS,
+ "target", "_blank",
+ "style", "color: inherit",
+ "href", "https://github.com/operasoftware/dragonfly/blob/master/AUTHORS"];
+ authors.render(tmpl);
}
- });
- return ['ul', ['li', 'id', 'about-authors', 'class', 'padding selectable']];
+ };
+
+ new XMLHttpRequest().loadResource("AUTHORS", on_about_sucess, null, on_about_error);
+ return ["ul", ["li", "id", "about-authors", "class", "padding selectable"]];
}
},
"about"
View
3  src/ecma-debugger/watches/watches.js
@@ -131,11 +131,12 @@ cls.Watches = function(view)
"0": [[["watches"]]],
"watches": [[[], []]]
};
- this._expand_tree =
+ var raw_tree =
{
"object_id": 0,
"protos": {"0": {"": {"object_id": "watches"}}}
};
+ this._expand_tree = new Dict(raw_tree);
};
/* implementation */
View
68 src/lib/dict.js
@@ -0,0 +1,68 @@
+"use strict";
+
+var Dict = function(obj)
+{
+ this._init(obj);
+};
+
+Dict.prototype = new function()
+{
+ var PREFIX = "$";
+ var to_string = Object.prototype.toString.call.bind(Object.prototype.toString);
+
+ this.get = function(key) { return this._dict[PREFIX + key]; };
+
+ this.set = function(key, value) { this._dict[PREFIX + key] = value; };
+
+ this["delete"] = function(key) { delete this._dict[PREFIX + key]; };
+
+ this.get_chain = function(prop_list)
+ {
+ for (var i = 0, value = this; i < prop_list.length && (value = value.get(prop_list[i])); i++);
+ return value;
+ };
+
+ this.keys = function()
+ {
+ var keys = [];
+ for (var key in this._dict)
+ {
+ keys.push(key.slice(PREFIX.length));
+ }
+ return keys;
+ };
+
+ this.setdefault = function(key, value)
+ {
+ if (this._dict.hasOwnProperty(PREFIX + key))
+ return this.get(key);
+
+ this.set(key, value);
+ return value;
+ };
+
+ this.toString = function()
+ {
+ var rep = [];
+ for (var key in this._dict)
+ {
+ var value = this._dict[key];
+ value = typeof value == "string" ? "\"" + value + "\"" : String(value);
+ key = key.slice(PREFIX.length);
+ rep.push((rep.length ? ", " : ""), "\"", key, "\": ", value);
+ }
+ return "{" + rep.join("") + "}";
+ };
+
+ this._init = function(obj)
+ {
+ this._dict = Object.create ? Object.create(null) : {};
+ for (var key in obj)
+ {
+ var value = obj[key];
+ if (to_string(value) == "[object Object]" && !(value instanceof Dict))
+ value = new Dict(value);
+ this.set(key, value);
+ }
+ };
+};
View
70 src/lib/elementprototype.js
@@ -24,15 +24,6 @@ if (!Element.prototype.insertAdjacentHTML)
}
}
-if (typeof document.createElement('div').classList == 'undefined')
-{
- Element.prototype.__defineGetter__('classList', function()
- {
- return this.className.split(/\s+/);
- });
- Element.prototype.__defineSetter__('classList', function(){});
-}
-
/**
* @fileoverview
* Helper function prototypes related to DOM objects and the DOM
@@ -163,59 +154,22 @@ Element.prototype.clearAndRender = function(template)
return this.render(template);
};
-if (document.createElement("div").classList)
+Element.prototype.hasClass = function(cl)
{
- Element.prototype.hasClass = function(cl)
- {
- return cl && this.classList.contains(cl);
- };
-
- Element.prototype.addClass = function(cl)
- {
- cl && this.classList.add(cl);
- return this;
- };
+ return cl && this.classList.contains(cl);
+};
- Element.prototype.removeClass = function(cl)
- {
- cl && this.classList.remove(cl);
- return this;
- };
-}
-else
+Element.prototype.addClass = function(cl)
{
- (function()
- {
- var cache = {};
- var re = null;
- var cln = "";
- var has_class = function(cln, cl)
- {
- if (!cache.hasOwnProperty(cl))
- cache[cl] = new RegExp("(?:^|\\s+)" + cl + "(?=\\s+|$)");
- return (re = cache[cl]).test(cln);
- };
-
- this.hasClass = function(cl)
- {
- return has_class(this.getAttribute("class"), cl);
- };
-
- this.addClass = function(cl)
- {
- if (!has_class(cln = this.getAttribute("class"), cl))
- this.setAttribute("class" , (cln ? cln + " " : "") + cl);
- return this;
- };
+ cl && this.classList.add(cl);
+ return this;
+};
- this.removeClass = function(cl)
- {
- if (has_class(cln = this.getAttribute("class"), cl))
- this.setAttribute("class" , cln.replace(re, "").trim());
- return this;
- };
- }).apply(Element.prototype);
-}
+Element.prototype.removeClass = function(cl)
+{
+ cl && this.classList.remove(cl);
+ return this;
+};
/**
* Swap class "from" with class "to"
View
2  src/lib/usertracker.js
@@ -31,7 +31,7 @@ cls.UserTracker = function(url, storagekey)
conn.onreadystatechange = rshandler;
conn.open("GET", url, true);
- conn.send(null);
+ try { conn.send(null); } catch(e) {};
}
View
12 src/lib/xmlhttprequestprototype.js
@@ -5,12 +5,18 @@
* "this" value
*/
-XMLHttpRequest.prototype.loadResource = function(url, callback, context)
+XMLHttpRequest.prototype.loadResource = function(url, callback, context, error_callback)
{
this.onload = function()
{
callback(this, context);
- }
+ };
+
+ this.onerror = function()
+ {
+ setTimeout(error_callback, 0, context);
+ };
+
this.open('GET', url);
- this.send(null);
+ try { this.send(null); } catch(e) {};
};
View
17 src/profiler/profiler_templates.js
@@ -84,12 +84,16 @@ var ProfilerTemplates = function()
var style_sheets = document.styleSheets;
var profiler_event_decl = style_sheets.getDeclaration(".profiler-event");
var profiler_timeline_row_decl = style_sheets.getDeclaration(".profiler-timeline-row");
+ var profiler_event_tooltip_decl = style_sheets.getDeclaration(".profiler-event-tooltip");
var BAR_MIN_WIDTH = profiler_event_decl ? parseInt(profiler_event_decl.minWidth) : 0;
var BAR_HEIGHT = profiler_timeline_row_decl
- ? (parseInt(style_sheets.getDeclaration(".profiler-timeline-row").height) +
- parseInt(style_sheets.getDeclaration(".profiler-timeline-row").paddingTop) +
- parseInt(style_sheets.getDeclaration(".profiler-timeline-row").paddingBottom))
+ ? (parseInt(profiler_timeline_row_decl.height) +
+ parseInt(profiler_timeline_row_decl.paddingTop) +
+ parseInt(profiler_timeline_row_decl.paddingBottom))
: 0;
+ var TOOLTIP_WIDTH = profiler_event_tooltip_decl
+ ? parseInt(profiler_event_tooltip_decl.width)
+ : 0;
this._order = [
EVENT_TYPE_DOCUMENT_PARSING,
@@ -240,7 +244,7 @@ var ProfilerTemplates = function()
this._timeline_event = function(interval_start, ms_unit, selected_id, event)
{
var interval = Math.round((event.interval.end - event.interval.start) * ms_unit);
- var self_time = Math.max(BAR_MIN_WIDTH, Math.round(event.time * ms_unit));
+ var self_time = interval ? Math.max(BAR_MIN_WIDTH, Math.round(event.time * ms_unit)) : 0;
var event_start = Math.round((event.interval.start - interval_start) * ms_unit);
var column = this._order.indexOf(event.type);
var is_expandable = this._expandables.indexOf(event.type) != -1 && event.childCount > 1;
@@ -467,15 +471,14 @@ var ProfilerTemplates = function()
this.get_title_interval_bar = function(event)
{
- var WIDTH = 200;
var interval = event.interval.end - event.interval.start;
- var ms_unit = WIDTH / interval;
+ var ms_unit = interval ? (TOOLTIP_WIDTH / interval) : 0;
var self_time = Math.round(event.time * ms_unit);
var color = this._event_colors[event.type] || (this._event_colors[event.type] = this._get_color_for_type(event.type));
return (
["div",
"style",
- "width: " + WIDTH + "px; " +
+ "width: " + TOOLTIP_WIDTH + "px; " +
"background-image: -o-linear-gradient(90deg, transparent 0, rgba(255, 255, 255, .25) 100%), " +
"-o-linear-gradient(0deg, " + color + " 0, " +
color + " " + self_time + "px, " +
View
4 src/repl/friendlyprinter.js
@@ -255,9 +255,7 @@ window.cls.FriendlyPrinter.prototype = new function()
return [
DATE,
1, // expandable inline object (booleans are returned as string)
- !isNaN(item.getTime())
- ? new Date(item.getTime() - item.getTimezoneOffset() * 1000 * 60).toISOString().replace('Z','')
- : item.toString()
+ item.toString()
];
}
else if (class_ == "[object Function]")
View
2  src/repl/listunpacker.js
@@ -166,7 +166,7 @@ window.cls.ListUnpacker = function(callback)
var orig_value_list = ctx.value_list;
ctx.value_list = log.reduce(function(list, log_entry, index)
{
- if (log_entry)
+ if (log_entry && !(object_list[0] && object_list[0].length == 0 && log_entry == 1))
{
var unpack_header = orig_value_list[index];
unpack_header[DF_INTERN_TYPE] = "unpack-header";
View
4 src/repl/repl_view.js
@@ -6,6 +6,7 @@
*/
cls.ReplView = function(id, name, container_class, html, default_handler) {
+ ActionHandlerInterface.apply(this);
this._resolver = new cls.PropertyFinder();
this._data = new cls.ReplData(this);
@@ -472,7 +473,8 @@ cls.ReplView = function(id, name, container_class, html, default_handler) {
this._highlight_completion = function(index)
{
var sel = window.getSelection();
- sel.collapseToStart();
+ if (!sel.isCollapsed)
+ sel.collapseToStart();
// with no arg, clear the selection.
if (index === null || index === undefined) {
View
45 src/scripts/messages.js
@@ -147,14 +147,15 @@
*/
var messages = new function()
{
- var __listeners = {};
+ var _listeners = {};
+ var _permanent_listeners = {};
/**
* Add a message listener
* @param key {String} The name of the message to listen for
* @param cb {function} The callback to call when message is received
*/
- this.addListener = function(key, cb)
+ this.addListener = function(key, cb, is_permanent_listener)
{
if (!cb)
{
@@ -162,17 +163,19 @@ var messages = new function()
"No callback function for message listener provided: " + key);
return;
}
+ var lists = [_listeners];
+ if (is_permanent_listener)
+ lists.push(_permanent_listeners);
- if (__listeners[key])
+ for (var i = 0, listeners; listeners = lists[i]; i++)
{
- if (__listeners[key].indexOf(cb) == -1)
+ if (listeners[key])
{
- __listeners[key].push(cb);
+ if (listeners[key].indexOf(cb) == -1)
+ listeners[key].push(cb);
}
- }
- else
- {
- __listeners[key] = [cb];
+ else
+ listeners[key] = [cb];
}
};
@@ -185,15 +188,16 @@ var messages = new function()
*/
this.removeListener = function(key, cb)
{
- var cur = null, listeners = __listeners[key], i = 0;
- if (listeners)
+ var lists = [_listeners, _permanent_listeners];
+ for (var i = 0, listeners; listeners = lists[i]; i++)
{
- for (; cur = listeners[i]; i++)
+ var listeners_type = listeners[key];
+ if (listeners_type)
{
- if (cur == cb)
+ for (var j = listeners_type.length - 1, cur; cur = listeners_type[j]; j--)
{
- listeners.splice(i, 1);
- i--;
+ if (cur == cb)
+ listeners_type.splice(j, 1);
}
}
}
@@ -210,7 +214,7 @@ var messages = new function()
this.post = function(key, msg)
{
msg || (msg = {});
- var listeners = __listeners[key];
+ var listeners = _listeners[key];
msg.type = key;
if (listeners)
{
@@ -220,4 +224,13 @@ var messages = new function()
}
}
}
+
+ this.clear_session_listeners = function()
+ {
+ _listeners = {};
+ for (var key in _permanent_listeners)
+ {
+ _listeners[key] = _permanent_listeners[key].slice();
+ }
+ };
}
View
464 src/scripts/spec_links.js
@@ -243,6 +243,7 @@ SpecLinks.specs = {
"min-width": "http://www.w3.org/TR/css3-box/#min-width",
"min-height": "http://www.w3.org/TR/css3-box/#min-width",
"overflow": "http://www.w3.org/TR/css3-box/#overflow0",
+ "overflow-wrap": "http://www.w3.org/TR/css3-text/#overflow-wrap",
"overflow-x": "http://www.w3.org/TR/css3-box/#overflow-x",
"overflow-y": "http://www.w3.org/TR/css3-box/#overflow-y",
"padding": "http://www.w3.org/TR/css3-box/#padding1",
@@ -274,7 +275,7 @@ SpecLinks.specs = {
"text-overflow": "http://www.w3.org/TR/css3-text/#text-overflow",
"text-shadow": "http://www.w3.org/TR/css3-text/#text-shadow",
"word-spacing": "http://www.w3.org/TR/css3-text/#word-spacing",
- "word-wrap": "http://www.w3.org/TR/css3-text/#word-wrap0",
+ "word-wrap": "http://www.w3.org/TR/css3-text/#overflow-wrap",
"-o-transition-property": "http://www.w3.org/TR/css3-transitions/#the-transition-property-property-",
"-o-transition-duration": "http://www.w3.org/TR/css3-transitions/#transition-duration",
"-o-transition-timing-function": "http://www.w3.org/TR/css3-transitions/#transition-timing-function",
@@ -1312,235 +1313,235 @@ SpecLinks.specs = {
"FileException": "http://www.w3.org/TR/FileAPI/#FileException",
// ES5 (put in a new section? (using Mike Smith’s version as real spec is PDF)
- "NaN": "http://es5.github.com/#x15.1.1.1",
- "Infinity": "http://es5.github.com/#x15.1.1.2",
- "undefined": "http://es5.github.com/#x15.1.1.3",
- "eval": "http://es5.github.com/#x15.1.2.1",
- "parseInt"