<commit_before>/* See license.txt for terms of usage */

"use strict";

module.metadata = {
  "stability": "experimental"
};

// Add-on SDK
const { Cu, Ci } = require("chrome");

// Firebug SDK
const { Trace, TraceError } = require("firebug.sdk/lib/core/trace.js").get(module.id);

// DevTools
const { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
const { MarkupView } = devtools["require"]("devtools/markupview/markup-view");

// Patching MarkupView
// xxxHonza: Bug 1036949 - New API: MarkupView customization
let originalTemplate = MarkupView.prototype.template;
MarkupView.prototype.template = function(aName, aDest, aOptions) {
  let node = originalTemplate.apply(this, arguments);
  //this._inspector.emit("markupview-render", node, aName, aDest, aOptions);
  return node;
}

function shutdown() {
  MarkupView.prototype.template = originalTemplate;

  // xxxHonza: iterate also all existing instances
  // and un-patch
}

// Exports from this module
exports.shutdown = shutdown;<commit_msg>Fire markupview-render event (Inspector panel patch)<commit_after>/* See license.txt for terms of usage */

"use strict";

module.metadata = {
  "stability": "experimental"
};

// Add-on SDK
const { Cu, Ci } = require("chrome");

// Firebug SDK
const { Trace, TraceError } = require("firebug.sdk/lib/core/trace.js").get(module.id);

// DevTools
const { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
const { MarkupView } = devtools["require"]("devtools/markupview/markup-view");

// Patching MarkupView
// xxxHonza: Bug 1036949 - New API: MarkupView customization
let originalTemplate = MarkupView.prototype.template;
MarkupView.prototype.template = function(aName, aDest, aOptions) {
  let node = originalTemplate.apply(this, arguments);
  this._inspector.emit("markupview-render", node, aName, aDest, aOptions);
  return node;
}

function shutdown() {
  MarkupView.prototype.template = originalTemplate;

  // xxxHonza: iterate also all existing instances
  // and un-patch
}

// Exports from this module
exports.shutdown = shutdown;
{'fraction_non_alphanumeric': 0.14326784858648778, 'fraction_numerical': 0.006708193579300431, 'mean_word_length': 4.538461538461538, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6780909', 'n_tokens_mistral': 688, 'n_tokens_neox': 650, 'n_words': 156}