Skip to content

Commit f4811bf

Browse files
committed
Merge pull request jquery#468 from rwldrn/10080
Fixes #10080. Test cache for window inference.
2 parents 979dd1c + 93beee8 commit f4811bf

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/data.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +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-
if ( jQuery.support.deleteExpando || cache != window ) {
194+
// Ensure that `cache` is not a window object #10080
195+
if ( jQuery.support.deleteExpando || !cache.setInterval ) {
195196
delete cache[ id ];
196197
} else {
197198
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)