WordPress.org

Make WordPress Core

Changeset 40381


Ignore:
Timestamp:
04/06/17 00:31:11 (3 months ago)
Author:
westonruter
Message:

Customize: Fix HTTPS navigation of site in preview on IE11.

Accounts for HTTPS links (port 443) where [40318] only accounted for HTTP links (port 80). Addresses issue in IE11 where the default port number is unexpectedly included on link.host for links dynamically created by scripts.

Props mattwiebe.
Amends [40318], [38890].
See #38409.
Fixes #40198.

Location:
trunk/src/wp-includes/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/customize-base.js

    r39051 r40381  
    656656                urlParser.href = to; 
    657657                // Port stripping needed by IE since it adds to host but not to event.origin. 
    658                 return urlParser.protocol + '//' + urlParser.host.replace( /:80$/, '' ); 
     658                return urlParser.protocol + '//' + urlParser.host.replace( /:(80|443)$/, '' ); 
    659659            }); 
    660660 
  • trunk/src/wp-includes/js/customize-preview.js

    r40318 r40381  
    287287        } 
    288288 
    289         elementHost = element.host.replace( /:80$/, '' ); 
     289        elementHost = element.host.replace( /:(80|443)$/, '' ); 
    290290        parsedAllowedUrl = document.createElement( 'a' ); 
    291291        matchesAllowedUrl = ! _.isUndefined( _.find( api.settings.url.allowed, function( allowedUrl ) { 
    292292            parsedAllowedUrl.href = allowedUrl; 
    293             return parsedAllowedUrl.protocol === element.protocol && parsedAllowedUrl.host.replace( /:80$/, '' ) === elementHost && 0 === element.pathname.indexOf( parsedAllowedUrl.pathname.replace( /\/$/, '' ) ); 
     293            return parsedAllowedUrl.protocol === element.protocol && parsedAllowedUrl.host.replace( /:(80|443)$/, '' ) === elementHost && 0 === element.pathname.indexOf( parsedAllowedUrl.pathname.replace( /\/$/, '' ) ); 
    294294        } ) ); 
    295295        if ( ! matchesAllowedUrl ) { 
Note: See TracChangeset for help on using the changeset viewer.