~ubuntu-branches/ubuntu/trusty/fennec/trusty

« back to all changes in this revision

Viewing changes to mobile/chrome/content/console.js

  • Committer: Bazaar Package Importer
  • Author(s): Chris Coulson
  • Date: 2011-01-26 20:31:40 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110126203140-zcg54f8ost2vmrxr
Tags: 4.0~b3-0ubuntu1
* New upstream release v4.0 B3 (FENNEC_4_0b3_RELEASE)

* Update build-depends for xulrunner-2.0
  - update debian/control
* Update mozclient to point to the mobile-browser repo
  - update debian/mozclient/fennec.conf
* Build with "--with-system-libxul"
  - update debian/rules
* Add launcher script, based on the one used in Firefox but with the
  unnecessary bits stripped out
  - add debian/fennec.sh
  - update debian/rules
* Refresh patches for new version
  - update debian/patches/bump_gecko_versions_in_application.ini.patch
  - update debian/patches/ubuntu_codes_google.patch
  - update debian/patches/installer.patch
* Drop unneeded patches
  - remove debian/patches/nspr_flags_by_pkg_config_hack.patch
  - remove debian/patches/xul191_l10n.patch
  - update debian/patches/series

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
 
38
38
let ConsoleView = {
39
39
  _list: null,
40
 
  _console: null,
 
40
  _inited: false,
41
41
  _evalTextbox: null,
42
42
  _evalFrame: null,
43
43
  _evalCode: "",
57
57
 
58
58
    let self = this;
59
59
    let panels = document.getElementById("panel-items");
 
60
 
60
61
    panels.addEventListener("select",
61
62
                            function(aEvent) {
62
63
                              if (panels.selectedPanel.id == "console-container")
66
67
  },
67
68
 
68
69
  _delayedInit: function cv__delayedInit() {
69
 
    if (this._console)
 
70
    if (this._inited)
70
71
      return;
 
72
    this._inited = true;
71
73
 
72
 
    this._console = Cc['@mozilla.org/consoleservice;1'].getService(Ci.nsIConsoleService);
73
 
    this._console.registerListener(this);
 
74
    Services.console.registerListener(this);
74
75
 
75
76
    this.appendInitialItems();
76
77
 
85
86
  },
86
87
 
87
88
  uninit: function cv_uninit() {
88
 
    if (this._console)
89
 
      this._console.unregisterListener(this);
 
89
    if (this._inited)
 
90
      Services.console.unregisterListener(this);
90
91
  },
91
92
 
92
93
  observe: function(aObject) {
97
98
    if (this._showChromeErrors != -1)
98
99
      return this._showChromeErrors;
99
100
 
100
 
    let pref = Cc['@mozilla.org/preferences-service;1'].getService(Ci.nsIPrefBranch);
101
101
    try {
 
102
      let pref = Services.prefs;
102
103
      return this._showChromeErrors = pref.getBoolPref("javascript.options.showInConsole");
103
104
    }
104
105
    catch(ex) {
206
207
 
207
208
  appendInitialItems: function cv_appendInitialItems() {
208
209
    let out = {}; // Throwaway references to support 'out' parameters.
209
 
    this._console.getMessageArray(out, {});
 
210
    Services.console.getMessageArray(out, {});
210
211
    let messages = out.value;
211
212
 
212
213
    // In case getMessageArray returns 0-length array as null
254
255
    }
255
256
  },
256
257
 
 
258
  onContextMenu: function cv_onContextMenu(aEvent) {
 
259
    let row = aEvent.target;
 
260
    let text = ["msg", "href", "line", "code", "col"].map(function(attr) row.getAttribute(attr))
 
261
               .filter(function(x) x).join("\n");
 
262
 
 
263
    ContextHelper.showPopup({
 
264
      target: row,
 
265
      json: {
 
266
        types: ["copy"],
 
267
        string: text
 
268
      }
 
269
    });
 
270
  },
 
271
 
257
272
  onEvalKeyPress: function cv_onEvalKeyPress(aEvent) {
258
273
    if (aEvent.keyCode == 13)
259
274
      this.evaluateTypein();
260
275
  },
261
276
 
 
277
  onConsoleBoxKeyPress: function cv_onConsoleBoxKeyPress(aEvent) {
 
278
    if ((aEvent.charCode == 99 || aEvent.charCode == 67) && aEvent.ctrlKey && this._list && this._list.selectedItem) {
 
279
      let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper);
 
280
      clipboard.copyString(this._list.selectedItem.getAttribute("msg"));
 
281
    }
 
282
  },
 
283
 
262
284
  evaluateTypein: function cv_evaluateTypein() {
263
285
    this._evalCode = this._evalTextbox.value;
264
286
    this.loadOrDisplayResult();
275
297
    resultRange.selectNode(this._evalFrame.contentDocument.documentElement);
276
298
    let result = resultRange.toString();
277
299
    if (result)
278
 
      this._console.logStringMessage(result);
 
300
      Services.console.logStringMessage(result);
279
301
      // or could use appendMessage which doesn't persist
280
302
  },
281
303