diff options
Diffstat (limited to 'WebCore/bindings/js/JSAttrCustom.cpp')
-rw-r--r-- | WebCore/bindings/js/JSAttrCustom.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/WebCore/bindings/js/JSAttrCustom.cpp b/WebCore/bindings/js/JSAttrCustom.cpp index abd5ad5..14457c4 100644 --- a/WebCore/bindings/js/JSAttrCustom.cpp +++ b/WebCore/bindings/js/JSAttrCustom.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -48,7 +48,8 @@ void JSAttr::setValue(ExecState* exec, JSValue value) Element* ownerElement = imp->ownerElement(); if (ownerElement && (ownerElement->hasTagName(iframeTag) || ownerElement->hasTagName(frameTag))) { if (equalIgnoringCase(imp->name(), "src") && protocolIsJavaScript(deprecatedParseURL(attrValue))) { - if (!checkNodeSecurity(exec, static_cast<HTMLFrameElementBase*>(ownerElement)->contentDocument())) + Document* contentDocument = static_cast<HTMLFrameElementBase*>(ownerElement)->contentDocument(); + if (contentDocument && !checkNodeSecurity(exec, contentDocument)) return; } } @@ -58,4 +59,16 @@ void JSAttr::setValue(ExecState* exec, JSValue value) setDOMException(exec, ec); } +void JSAttr::markChildren(MarkStack& markStack) +{ + Base::markChildren(markStack); + + // Mark the element so that this will work to access the attribute even if the last + // other reference goes away. + if (Element* element = impl()->ownerElement()) { + if (JSNode* wrapper = getCachedDOMNodeWrapper(element->document(), element)) + markStack.append(wrapper); + } +} + } // namespace WebCore |