Open Bug 518076 Opened 15 years ago Updated 2 years ago

Unwatch doesn't properly remove a watchpoint

Categories

(Core :: DOM: Core & HTML, defect, P5)

1.9.1 Branch
x86
Windows XP
defect

Tracking

()

People

(Reporter: Honza, Unassigned)

Details

Attachments

(1 file)

Attached file Test case
When a property name is specified on a page and read using textContent property of DOM the unwatch method doesn't properly remove the watchpoints.

Here is an example:

<!-- Property name is defined on the page -->
<span id="propName"><span>_testProperty</span></span>

// Set an initial value.
window._testProperty = "Some initial value";

// Get property name from the page.
var div = document.getElementById("propName");
var propName = div.firstChild.textContent;

// This works and an alert dialog is properly displayed
// when the property is changed.
window.watch(propName, function(prop, oldVal, newVal) {
  alert("Property " + prop + " has been changed.");
  return newVal;
});

// This doesn't work. The alert dialog is still displayed
// when the property is changed after this statement.
window.unwatch(propName);

// The watchpoint is correctly removed after this statement.
window.unwatch("_testProperty");

Tested with Shiretoko 3.5.4pre 
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.4pre) Gecko/20090921 Shiretoko/3.5.4pre (.NET CLR 3.5.30729)


Honza
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: