WordPress.org

Make WordPress Core

Opened 10 months ago

Closed 10 months ago

Last modified 10 months ago

#49851 closed defect (bug) (invalid)

get_oembed_response_data() output creates NS_ERROR_FAILURE error in Firefox on back-end.

Reported by: jsmoriss Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.4
Component: Embeds Keywords:
Focuses: javascript Cc:

Description

When in the admin back-end (WordPress "Edit Page" webpage), including the 'html' element returned by get_oembed_response_data() in the webpage creates an NS_ERROR_FAILURE error in the Firefox console.

NS_ERROR_FAILURE: embed:9
    l http://adm.surniaulula.com/about/embed/:9
    <anonymous> http://adm.surniaulula.com/about/embed/:9
    <anonymous> http://adm.surniaulula.com/about/embed/:9

Here is an example 'html' element returned by get_oembed_response_data() (hostname value replaced):

<blockquote class="wp-embedded-content"><a href="http://XXXXXXXX/about/">About</a></blockquote>
<script type='text/javascript'>
<!--//--><![CDATA[//><!--
/*! This file is auto-generated */
!function(d,l){"use strict";var e=!1,o=!1;if(l.querySelector)if(d.addEventListener)e=!0;if(d.wp=d.wp||{},!d.wp.receiveEmbedMessage)if(d.wp.receiveEmbedMessage=function(e){var t=e.data;if(t)if(t.secret||t.message||t.value)if(!/[^a-zA-Z0-9]/.test(t.secret)){var r,a,i,s,n,o=l.querySelectorAll('iframe[data-secret="'+t.secret+'"]'),c=l.querySelectorAll('blockquote[data-secret="'+t.secret+'"]');for(r=0;r<c.length;r++)c[r].style.display="none";for(r=0;r<o.length;r++)if(a=o[r],e.source===a.contentWindow){if(a.removeAttribute("style"),"height"===t.message){if(1e3<(i=parseInt(t.value,10)))i=1e3;else if(~~i<200)i=200;a.height=i}if("link"===t.message)if(s=l.createElement("a"),n=l.createElement("a"),s.href=a.getAttribute("src"),n.href=t.value,n.host===s.host)if(l.activeElement===a)d.top.location.href=t.value}}},e)d.addEventListener("message",d.wp.receiveEmbedMessage,!1),l.addEventListener("DOMContentLoaded",t,!1),d.addEventListener("load",t,!1);function t(){if(!o){o=!0;var e,t,r,a,i=-1!==navigator.appVersion.indexOf("MSIE 10"),s=!!navigator.userAgent.match(/Trident.*rv:11\./),n=l.querySelectorAll("iframe.wp-embedded-content");for(t=0;t<n.length;t++){if(!(r=n[t]).getAttribute("data-secret"))a=Math.random().toString(36).substr(2,10),r.src+="#?secret="+a,r.setAttribute("data-secret",a);if(i||s)(e=r.cloneNode(!0)).removeAttribute("security"),r.parentNode.replaceChild(e,r)}}}}(window,document);
//--><!]]>
</script>
<iframe sandbox="allow-scripts" security="restricted" src="http://XXXXXXXX/about/embed/" width="600" height="338" title="&#8220;About&#8221;" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" class="wp-embedded-content"></iframe>

And the resulting iframe HTML in the browser, after the above javascript has executed (hostname and secret values replaced):

<iframe sandbox="allow-scripts" security="restricted" src="http://XXXXXXXX/about/embed/#?secret=XXXXXXXX"
title="“About”" marginwidth="0" marginheight="0" scrolling="no" class="wp-embedded-content"
data-secret="XXXXXXXX" width="600" height="638" frameborder="0">
.
.
.
</iframe>

You can re-create the issue by using the Firefox browser, activating the WPSSO Core plugin (https://wordpress.org/plugins/wpsso/), and editing a page. The iframe is located in the Document SSO metabox, under the 'oEmbed' tab.

The Chrome and Safari browsers do not show any errors, only Firefox shows a NS_ERROR_FAILURE error.

js.

Change History (4)

#1 @jsmoriss
10 months ago

Since the oEmbed tab in that Document SSO metabox is hidden by default, the NS_ERROR_FAILURE may be related to the following Firefox bug:

https://bugzilla.mozilla.org/show_bug.cgi?id=941146

js.

#2 @jsmoriss
10 months ago

  • Resolution set to invalid
  • Status changed from new to closed

Confirmed - this is a bug in Firefox when an iframe is set to "display:none" by default.

Since the oembed iframe in the example is located in a secondary tab, there is no work-around for this Firefox bug.

I'll close this ticket.

js.

#3 @SergeyBiryukov
10 months ago

  • Milestone Awaiting Review deleted

#4 @jsmoriss
10 months ago

Last edited 10 months ago by jsmoriss (previous) (diff)
Note: See TracTickets for help on using tickets.