Open Bug 812621 Opened 12 years ago Updated 2 years ago

"ASSERTION: Got the wrong answer from the custom method call" (nsIDOMHTMLElement_GetInnerHTML)

Categories

(Core :: DOM: Core & HTML, defect, P5)

x86_64
macOS
defect

Tracking

()

People

(Reporter: jruderman, Unassigned)

References

Details

(Keywords: assertion, testcase)

Attachments

(2 files)

Attached file testcase
###!!! ASSERTION: Got the wrong answer from the custom method call!: 'NS_SUCCEEDED(debug_rv) == NS_SUCCEEDED(rv) && xpc_qsSameResult(debug_result, result)', file dom_quickstubs.cpp, line 8955
Attached file stack+
Same problem with nsIDOMHTMLElement_GetOuterHTML, I think.
So, we call into GetMarkup, which calls GetContentType; this returns an empty string. The first time around, we don't have a cached encoder, so we try to create one by

      do_CreateInstance(PromiseFlatCString(
        nsDependentCString(NS_DOC_ENCODER_CONTRACTID_BASE) +
        [ empty string ]
      ).get());

which fails; we then do

    // This could be some type for which we create a synthetic document.  Try
    // again as XML
    contentType.AssignLiteral("application/xml");
    docEncoder = do_CreateInstance(NS_DOC_ENCODER_CONTRACTID_BASE "application/xml");

and are on our way. The second time around, though, we *do* have a cached encoder, so we skip the first if... the second if... and we leave contentType empty. Then we call into nsDocumentEncoder::EncodeToString, which does

    nsAutoCString progId(NS_CONTENTSERIALIZER_CONTRACTID_PREFIX);
    AppendUTF16toUTF8(mMimeType, progId);

    mSerializer = do_CreateInstance(progId.get());
    NS_ENSURE_TRUE(mSerializer, NS_ERROR_NOT_IMPLEMENTED);

with mMimeType set to the contentType from GetMarkup (which we'd passed to nsDocumentEncoder::NativeInit), i.e., the empty string. Unfortunately, we can't create an instance of "@mozilla.org/layout/contentserializer;1?mimetype=", and we bail out with NS_ERROR_NOT_IMPLEMENTED. GetMarkup passes it through to quickstubs, and we assert because NS_SUCCEEDED(rv) is true, and NS_SUCCEEDED(debug_rv) is false.

Which brings me to... Smaug and bug 574089?
Blocks: 807075, 574089
(In reply to :Ms2ger from comment #3)
> So, we call into GetMarkup, which calls GetContentType; this returns an
> empty string. The first time around, we don't have a cached encoder, so we
> try to create one by
> 
>       do_CreateInstance(PromiseFlatCString(
>         nsDependentCString(NS_DOC_ENCODER_CONTRACTID_BASE) +
>         [ empty string ]
>       ).get());

Why don't we set a content type for synthetic documents?

Why do we need the content type for innerHTML? Shouldn't we check the document's mIsRegularHTML and use the fast HTML serializer if true and always the same implementation of nsIDocumentEncoder (either always XML serializer or always XHTML serializer) if false?
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: