Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#41852 closed defect (bug) (fixed)

Fix UN flag test by returning the correct value.

Reported by: peterwilsoncc's profile peterwilsoncc Owned by: pento's profile pento
Milestone: 4.8.2 Priority: normal
Severity: normal Version: 4.8
Component: Emoji Keywords: has-patch commit fixed-major
Focuses: javascript Cc:

Description

In #40616 the method for testing flags was changed to allow for changes to the canvas engines in browsers, the test was reversed.

If the two sets of characters render the same, the flag test has failed and the polyfill should be used. WP is doing the reverse.

Attachments (1)

41852.diff (442 bytes) - added by peterwilsoncc 7 years ago.

Download all attachments as: .zip

Change History (8)

@peterwilsoncc
7 years ago

#1 @peterwilsoncc
7 years ago

  • Keywords has-patch added
  • Owner set to pento
  • Status changed from new to assigned

#2 follow-up: @ocean90
7 years ago

I'm not really following. Could you provide some steps to replicate the issue and why it doesn't apply to the England flag?

#3 in reply to: ↑ 2 @peterwilsoncc
7 years ago

Replying to ocean90:

I'm not really following. Could you provide some steps to replicate the issue and why it doesn't apply to the England flag?

The tests are considered to fail (return false) if both flags look the same.

The UN test is effectively returning flag === flag2, ie true if identical.

The English flag returns flag !== flag2, ie false if identical.

The way the tests are written means the affect is minimal as users are more likely to get a false negative than a false positive.

I've put together a reduced test case at https://jsbin.com/palagay/2/edit?js,output

  1. Visit the test case to see if your browser supports the UN flag (Chrome 61/MacOS Sierra will not)
  2. The outcome will display the images.
  3. To test in core, change the UN flag test to end:
if ( flag !== flag2 ) {
        console.log( 'fail' );
        return false;
}
console.log( 'pass' );

#4 @ocean90
7 years ago

  • Focuses javascript added
  • Keywords commit added

Thanks, makes sense now.

#5 @peterwilsoncc
7 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 41386:

Emoji: Invert value returned by UN test for accuracy.

The JavaScript testing for UN flag support was passing when it failed, and failing when it passes.

This inverts the result to take more traditional approach of returning the correct result.

Unprops Pento.
Fixes #41852.

#6 @peterwilsoncc
7 years ago

  • Keywords fixed-major added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for backporting to 4.8 branch.

#7 @ocean90
7 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 41396:

Emoji: Invert value returned by UN test for accuracy.

The JavaScript testing for UN flag support was passing when it failed, and failing when it passes.

This inverts the result to take more traditional approach of returning the correct result.

Merge of [41386] to the 4.8 branch.

Unprops Pento.
Fixes #41852.

Note: See TracTickets for help on using tickets.