[wp-trac] [WordPress Trac] #49851: get_oembed_response_data() output creates NS_ERROR_FAILURE error in Firefox on back-end.

WordPress Trac noreply at wordpress.org
Wed Apr 8 18:01:28 UTC 2020


#49851: get_oembed_response_data() output creates NS_ERROR_FAILURE error in Firefox
on back-end.
--------------------------+-------------------------
 Reporter:  jsmoriss      |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Embeds        |     Version:  5.4
 Severity:  normal        |  Resolution:  invalid
 Keywords:                |     Focuses:  javascript
--------------------------+-------------------------

Comment (by jsmoriss):

 An additional note for future readers.

 The NS_ERROR_FAILURE bug in Firefox can be avoided by adding 'sandbox
 ="allow-same-origin"' to the iframe, and in this specific instance (adding
 the post oEmbed iframe to a back-end webpage), the "allow-scripts"
 permission must also be given to render the share icons, etc.

 So, in brief, before adding the iframe HTML to the webpage, I run the
 following on the 'html' value returned by get_oembed_response_data():

 {{{
 $sandbox_val = "allow-same-origin allow-scripts";

 if ( false !== strpos( $oembed_html, 'sandbox="' ) ) {
     $oembed_html = preg_replace( '/ *sandbox="[^"]+"/', ' sandbox="' .
 $sandbox_val . '"', $oembed_html );
 } else {
     $oembed_html = preg_replace( '/<iframe /', '<iframe sandbox="' .
 $sandbox_val . '" ', $oembed_html );
 }
 }}}

 js.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49851#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list