+ nsCOMPtr<nsIDOMDocument> document(do_QueryInterface(mStartParent));
+ if (!document) {
+ res = mStartParent->GetOwnerDocument(getter_AddRefs(document));
+ if (NS_FAILED(res)) return res;
+ }
The common case here is that mStartParent is *not* a document, so this would be faster over all if you flipped this around (since you wouldn't be trying to QI to nsIDOMDocument when you know it will fail in most cases), i.e.:
+ nsCOMPtr<nsIDOMDocument> document;
+ res = mStartParent->GetOwnerDocument(getter_AddRefs(document));
+ if (NS_FAILED(res)) return res;
+ if (!document) {
+ document = do_QueryInterface(mStartParent);
+ }
Comment on attachment 200882
patch, v1
+ nsCOMPtr< nsIDOMDocument> document( do_QueryInterfa ce(mStartParent )); >GetOwnerDocume nt(getter_ AddRefs( document) );
+ if (!document) {
+ res = mStartParent-
+ if (NS_FAILED(res)) return res;
+ }
The common case here is that mStartParent is *not* a document, so this would be faster over all if you flipped this around (since you wouldn't be trying to QI to nsIDOMDocument when you know it will fail in most cases), i.e.:
+ nsCOMPtr< nsIDOMDocument> document; >GetOwnerDocume nt(getter_ AddRefs( document) ); ce(mStartParent );
+ res = mStartParent-
+ if (NS_FAILED(res)) return res;
+ if (!document) {
+ document = do_QueryInterfa
+ }
r+sr=jst either way though.