}
super.setAttributeNS(namespaceURI, qualifiedName, attributeValue);
if (qualifiedName.equals("src")) {
final JavaScriptEngine jsEngine = getPage().getWebClient().getJavaScriptEngine();
// When src is set from a script, loading is postponed until script finishes
// in fact this implementation is probably wrong: JavaScript URL should be
// first evaluated and only loading, when any, should be postponed.
if (!jsEngine.isScriptRunning() || attributeValue.startsWith("javascript:")) {
loadInnerPageIfPossible(attributeValue);
}
else {
final String src = attributeValue;
final PostponedAction action = new PostponedAction(getPage()) {
@Override
public void execute() throws Exception {
if (getSrcAttribute().equals(src)) {
loadInnerPage();
}
}
};
jsEngine.addPostponedAction(action);
}
}
}