Skip to content

Commit 93beee8

Browse files
committed
Test for window inference. Fixes #10080
1 parent f44d5e1 commit 93beee8

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/data.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ jQuery.extend({
191191
// Browsers that fail expando deletion also refuse to delete expandos on
192192
// the window, but it will allow it on all other JS objects; other browsers
193193
// don't care
194-
// Ensure that this id actually exists in `cache` #10080
195-
if ( cache[ id ] && ( jQuery.support.deleteExpando || cache != window ) ) {
194+
// Ensure that `cache` is not a window object #10080
195+
if ( jQuery.support.deleteExpando || !cache.setInterval ) {
196196
delete cache[ id ];
197197
} else {
198198
cache[ id ] = null;

test/unit/data.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,3 +582,16 @@ test("jQuery.data supports interoperable removal of hyphenated/camelCase propert
582582

583583
});
584584
});
585+
586+
// Test originally by Moschel
587+
test("Triggering the removeData should not throw exceptions. (#10080)", function() {
588+
expect(1);
589+
stop();
590+
var frame = jQuery("#loadediframe");
591+
jQuery(frame[0].contentWindow).bind("unload", function() {
592+
ok(true, "called unload");
593+
start();
594+
});
595+
// change the url to trigger unload
596+
frame.attr("src", "data/iframe.html?param=true");
597+
});

0 commit comments

Comments
 (0)