[Pkg-mozext-commits] [itsalltext] 344/459: ticket: 48 -- Infinite loop when launching
David Prévot
taffit at moszumanska.debian.org
Tue Feb 24 23:26:36 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository itsalltext.
commit 7c4fb6c0a75a67f2fae020ec87a55ebd6d7032c5
Author: Christian Höltje <docwhat at gmail.com>
Date: Thu Dec 4 21:05:20 2008 -0500
ticket: 48 -- Infinite loop when launching
---
src/chrome/content/cacheobj.js | 129 ++++++++++++++++++++++-----------------
src/chrome/content/itsalltext.js | 3 +-
src/chrome/content/monitor.js | 14 +++--
3 files changed, 84 insertions(+), 62 deletions(-)
diff --git a/src/chrome/content/cacheobj.js b/src/chrome/content/cacheobj.js
index dc40b2f..92f0a9f 100644
--- a/src/chrome/content/cacheobj.js
+++ b/src/chrome/content/cacheobj.js
@@ -1,5 +1,5 @@
/*extern ItsAllText, Components */
-/*jslint undef: true, nomen: true, evil: false, browser: true, white: true */
+/*jslint undef: true, evil: false, browser: true, white: true */
/*
* It's All Text! - Easy external editing of web forms.
*
@@ -123,6 +123,7 @@ function CacheObj(node) {
* @param {Event} event The event object.
*/
that.mouseout = function (event) {
+ ItsAllText.debug("mouseout: %o", event, event.target, that.is_focused);
if (that.button_fade_timer) {
clearTimeout(that.button_fade_timer);
}
@@ -521,6 +522,7 @@ CacheObj.prototype.update = function () {
* Capture keypresses to do the hotkey edit.
*/
CacheObj.prototype.keypress = function (event) {
+ ItsAllText.debug('keypress()', event);
var km = ItsAllText.marshalKeyEvent(event), cobj;
if (km === ItsAllText.preferences.hotkey) {
cobj = CacheObj.get(event.target);
@@ -535,6 +537,7 @@ CacheObj.prototype.keypress = function (event) {
* @param {Object} event The event that triggered this.
*/
CacheObj.prototype.onClick = function (event) {
+ ItsAllText.debug('onClick()', event);
var cobj = CacheObj.get(event.target);
cobj.edit();
event.stopPropagation();
@@ -588,73 +591,87 @@ CacheObj.prototype.addGumDrop = function () {
doc,
gumdrop,
parent,
- nextSibling;
- if (cache_object.button !== null) {
- cache_object.adjust();
- return; /*already done*/
- }
+ nextSibling,
+ previous_ignore = ItsAllText.monitor._ignore_DOMSubtreeModified;
- // Add the textarea mouseovers even if the button is disabled
- node = cache_object.node;
- ItsAllText.listen(node, "mouseover", ItsAllText.hitch(cache_object, "mouseover"), false);
- ItsAllText.listen(node, "mouseout", ItsAllText.hitch(cache_object, "mouseout"), false);
- ItsAllText.listen(node, "focus", ItsAllText.hitch(cache_object, "mouseover"), false);
- ItsAllText.listen(node, "blur", ItsAllText.hitch(cache_object, "mouseout"), false);
- ItsAllText.listen(node, "keypress", ItsAllText.hitch(cache_object, "keypress"), false);
- if (ItsAllText.getDisableGumdrops()) {
- return;
- }
- ItsAllText.debug('addGumDrop()', cache_object);
+ try {
+ ItsAllText.monitor._ignore_DOMSubtreeModified = true;
- doc = node.ownerDocument;
- if (!node.parentNode) {
- return;
- }
+ if (cache_object.button !== null) {
+ cache_object.adjust();
+ ItsAllText.monitor._ignore_DOMSubtreeModified = previous_ignore;
+ return; /*already done*/
+ }
- gumdrop = doc.createElementNS(ItsAllText.XHTMLNS, "img");
- gumdrop.setAttribute('src', this.gumdrop_url);
+ ItsAllText.debug('addGumDrop');
+
+ // Add the textarea mouseovers even if the button is disabled
+ node = cache_object.node;
+ ItsAllText.listen(node, "mouseover", ItsAllText.hitch(cache_object, "mouseover"), false);
+ ItsAllText.listen(node, "mouseout", ItsAllText.hitch(cache_object, "mouseout"), false);
+ ItsAllText.listen(node, "focus", ItsAllText.hitch(cache_object, "mouseover"), false);
+ ItsAllText.listen(node, "blur", ItsAllText.hitch(cache_object, "mouseout"), false);
+ ItsAllText.listen(node, "keypress", ItsAllText.hitch(cache_object, "keypress"), false);
+ if (ItsAllText.getDisableGumdrops()) {
+ ItsAllText.monitor._ignore_DOMSubtreeModified = previous_ignore;
+ return;
+ }
+ ItsAllText.debug('addGumDrop()', cache_object);
- if (ItsAllText.getDebug()) {
- gumdrop.setAttribute('title', cache_object.node_id);
- } else {
- gumdrop.setAttribute('title', ItsAllText.localeString('program_name'));
- }
- cache_object.button = gumdrop; // Store it for easy finding in the future.
+ doc = node.ownerDocument;
+ if (!node.parentNode) {
+ ItsAllText.monitor._ignore_DOMSubtreeModified = previous_ignore;
+ return;
+ }
- // Image Attributes
- gumdrop.style.setProperty('cursor', 'pointer', 'important');
- gumdrop.style.setProperty('display', 'none', 'important');
- gumdrop.style.setProperty('position', 'absolute', 'important');
- gumdrop.style.setProperty('padding', '0', 'important');
- gumdrop.style.setProperty('margin', '0', 'important');
- gumdrop.style.setProperty('border', 'none', 'important');
- gumdrop.style.setProperty('zIndex', '32768', 'important');
+ gumdrop = doc.createElementNS(ItsAllText.XHTMLNS, "img");
+ gumdrop.setAttribute('src', this.gumdrop_url);
- gumdrop.style.setProperty('width', this.gumdrop_width + 'px', 'important');
- gumdrop.style.setProperty('height', this.gumdrop_height + 'px', 'important');
+ if (ItsAllText.getDebug()) {
+ gumdrop.setAttribute('title', cache_object.node_id);
+ } else {
+ gumdrop.setAttribute('title', ItsAllText.localeString('program_name'));
+ }
+ cache_object.button = gumdrop; // Store it for easy finding in the future.
- gumdrop.setAttribute(ItsAllText.MYSTRING + '_UID', cache_object.uid);
+ // Image Attributes
+ gumdrop.style.setProperty('cursor', 'pointer', 'important');
+ gumdrop.style.setProperty('display', 'none', 'important');
+ gumdrop.style.setProperty('position', 'absolute', 'important');
+ gumdrop.style.setProperty('padding', '0', 'important');
+ gumdrop.style.setProperty('margin', '0', 'important');
+ gumdrop.style.setProperty('border', 'none', 'important');
+ gumdrop.style.setProperty('zIndex', '32768', 'important');
- // Click event handlers
- ItsAllText.listen(gumdrop, "click", ItsAllText.hitch(cache_object, 'onClick'), false);
- ItsAllText.listen(gumdrop, "contextmenu", ItsAllText.hitch(cache_object, 'onContext'), false);
+ gumdrop.style.setProperty('width', this.gumdrop_width + 'px', 'important');
+ gumdrop.style.setProperty('height', this.gumdrop_height + 'px', 'important');
- // Insert it into the document
- parent = node.parentNode;
- nextSibling = node.nextSibling;
+ gumdrop.setAttribute(ItsAllText.MYSTRING + '_UID', cache_object.uid);
- if (nextSibling) {
- parent.insertBefore(gumdrop, nextSibling);
- } else {
- parent.appendChild(gumdrop);
- }
+ // Click event handlers
+ ItsAllText.listen(gumdrop, "click", ItsAllText.hitch(cache_object, 'onClick'), false);
+ ItsAllText.listen(gumdrop, "contextmenu", ItsAllText.hitch(cache_object, 'onContext'), false);
- // Add mouseovers/outs
- ItsAllText.listen(gumdrop, 'mouseover', ItsAllText.hitch(cache_object, 'mouseover'), false);
- ItsAllText.listen(gumdrop, 'mouseout', ItsAllText.hitch(cache_object, 'mouseout'), false);
+ // Insert it into the document
+ parent = node.parentNode;
+ nextSibling = node.nextSibling;
- cache_object.mouseout(null);
- cache_object.adjust();
+ if (nextSibling) {
+ parent.insertBefore(gumdrop, nextSibling);
+ } else {
+ parent.appendChild(gumdrop);
+ }
+
+ // Add mouseovers/outs
+ ItsAllText.listen(gumdrop, 'mouseover', ItsAllText.hitch(cache_object, 'mouseover'), false);
+ ItsAllText.listen(gumdrop, 'mouseout', ItsAllText.hitch(cache_object, 'mouseout'), false);
+
+ cache_object.mouseout(null);
+ cache_object.adjust();
+ } catch (e) {
+ ItsAllText.monitor._ignore_DOMSubtreeModified = previous_ignore;
+ }
+ ItsAllText.monitor._ignore_DOMSubtreeModified = previous_ignore;
};
/**
diff --git a/src/chrome/content/itsalltext.js b/src/chrome/content/itsalltext.js
index f0be94d..328e7b0 100644
--- a/src/chrome/content/itsalltext.js
+++ b/src/chrome/content/itsalltext.js
@@ -587,10 +587,11 @@ var ItsAllText = function () {
/**
* Open the editor for a selected node.
+ * This is used by the XUL.
* @param {Object} node The textarea to get.
*/
that.onEditNode = function (node) {
- var cobj = that.CacheObj.get(node);
+ var cobj = that.CacheObj.make(node);
if (cobj) {
cobj.edit();
}
diff --git a/src/chrome/content/monitor.js b/src/chrome/content/monitor.js
index 16d23ec..2801b1f 100644
--- a/src/chrome/content/monitor.js
+++ b/src/chrome/content/monitor.js
@@ -157,23 +157,24 @@ monitor.prototype.hitched_watcher = function (offset, init) {
}
};
-monitor.prototype._in_DOMSubtreeModified = false;
+monitor.prototype._ignore_DOMSubtreeModified = false;
monitor.prototype.hitched_handleSubtreeModified = function (event) {
var has_textareas;
- if (this._in_DOMSubtreeModified) {
+ if (this._ignore_DOMSubtreeModified) {
return;
}
has_textareas = event.originalTarget.getElementsByTagName('textarea').length > 0;
if (has_textareas) {
+ ItsAllText.debug('handleSubtreeModified: %o', event.target);
try {
// Ignore events while adding the gumdrops.
- this._in_DOMSubtreeModified = true;
+ this._ignore_DOMSubtreeModified = true;
this.watcher(0, true);
} catch (e) {
- this._in_DOMSubtreeModified = false;
+ this._ignore_DOMSubtreeModified = false;
}
- this._in_DOMSubtreeModified = false;
+ this._ignore_DOMSubtreeModified = false;
}
};
@@ -190,10 +191,13 @@ monitor.prototype.hitched_startPage = function (event, force) {
if (unsafeWin) {
this.iat.listen(unsafeWin, 'pagehide', this.stopPage);
}
+
+ // Listen for the subtree being modified.
this.iat.listen(unsafeWin, 'DOMSubtreeModified', this.handleSubtreeModified);
// Kick off a watcher now...
this.watcher(0, true);
+
// Set up the future ones
this.restart();
};
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/itsalltext.git
More information about the Pkg-mozext-commits
mailing list