Bug 172841 - Fix MotionMark to work in Internet Explorer
Summary: Fix MotionMark to work in Internet Explorer
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-01 16:59 PDT by Said Abou-Hallawa
Modified: 2023-05-10 13:12 PDT (History)
10 users (show)

See Also:


Attachments
Patch (6.38 KB, patch)
2017-06-01 17:06 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (5.61 KB, patch)
2017-06-01 19:49 PDT, Said Abou-Hallawa
jonlee: review-
Details | Formatted Diff | Diff
Patch (5.95 KB, patch)
2017-06-02 12:39 PDT, Said Abou-Hallawa
sam: review-
Details | Formatted Diff | Diff
Patch (7.70 KB, patch)
2017-06-05 13:00 PDT, Said Abou-Hallawa
mjs: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Said Abou-Hallawa 2017-06-01 16:59:30 PDT
Replace calls to some JavaScript functions, which Internet Explorer does not support, by equivalent code.
Comment 1 Said Abou-Hallawa 2017-06-01 17:06:52 PDT
Created attachment 311784 [details]
Patch
Comment 2 Jon Lee 2017-06-01 17:33:28 PDT
Comment on attachment 311784 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=311784&action=review

> PerformanceTests/MotionMark/tests/master/resources/image-data.js:40
> +        var nameExtension = Utilities.isInternetExplorer() ? "100.png" : ".svg";

Comment please.

> PerformanceTests/MotionMark/tests/master/resources/leaves.js:37
> +            if (this._position.x < 0)

I think we can simplify this logic. |size.width| and |stage.size.width| is always positive. So I think we can get rid of this second if:

if (this._position.x < -this.size.width)
    this._position.x += ...
else if ( this._position.x > this.stage.size.width)
    this._position.x -= ....

> PerformanceTests/MotionMark/tests/master/resources/leaves.js:38
> +                this._position.x += (this.size.width + this.stage.size.width);

Please remove parens.

> PerformanceTests/MotionMark/tests/master/resources/leaves.js:40
> +                this._position.x -= (this.size.width + this.stage.size.width);

Ditto.

> PerformanceTests/MotionMark/tests/master/resources/leaves.js:-118
> -        particle.element.remove();

Can we polyfill this instead?
Comment 3 Said Abou-Hallawa 2017-06-01 19:49:10 PDT
Created attachment 311796 [details]
Patch
Comment 4 Jon Lee 2017-06-01 19:55:09 PDT
Comment on attachment 311796 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=311796&action=review

> PerformanceTests/MotionMark/resources/extensions.js:237
> +    this.parentNode.removeChild(this);

This is wrong. We should only set this for UA’s that do not have the method defined.
Comment 5 Said Abou-Hallawa 2017-06-02 12:39:24 PDT
Created attachment 311844 [details]
Patch
Comment 6 Sam Weinig 2017-06-03 13:23:59 PDT
Comment on attachment 311844 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=311844&action=review

> PerformanceTests/MotionMark/tests/master/resources/image-data.js:42
> +        // IE taints the canvas context if an SVG image is drawn on it. Any
> +        // following calls to getImageData will throw CORS security exception.
> +        var nameExtension = Utilities.isInternetExplorer() ? "100.png" : ".svg";

It seems like it would be better to have the test be consistent across browsers, so why not have everyone one use 100.png? 

Also, modern convention says you should do detection, not sniffing, so if you want to keep the svg in one, png in another, you should replace the Utilities.isInternetExplorer() check, with a Utilities.canDrawSVGToCanvasWithoutTainting() check, which does that, and checks for an exception. That way, if IE changes, it will get the desired behavior.

That said, I think having everyone do the same thing is better.
Comment 7 Said Abou-Hallawa 2017-06-05 13:00:15 PDT
Created attachment 312024 [details]
Patch
Comment 8 Said Abou-Hallawa 2017-06-05 13:12:12 PDT
Comment on attachment 311844 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=311844&action=review

>> PerformanceTests/MotionMark/tests/master/resources/image-data.js:42
>> +        var nameExtension = Utilities.isInternetExplorer() ? "100.png" : ".svg";
> 
> It seems like it would be better to have the test be consistent across browsers, so why not have everyone one use 100.png? 
> 
> Also, modern convention says you should do detection, not sniffing, so if you want to keep the svg in one, png in another, you should replace the Utilities.isInternetExplorer() check, with a Utilities.canDrawSVGToCanvasWithoutTainting() check, which does that, and checks for an exception. That way, if IE changes, it will get the desired behavior.
> 
> That said, I think having everyone do the same thing is better.

I implemented Utilities.canDrawSVGToCanvasWithoutTainting() which detects whether the browser throws an exception when calling getImageData() after drawing an SVG on the canvas. Beside the ones we are working around here, IE has other limitations. For example the Focus test does not work correctly because it does not render the blur filter correctly. Another limitation is data uri image has to be in url format.

I think we need to draw the SVG images in this test since this test is the only one that loads and renders SVG images in MotionMark master suite. If we make all the browser uses the png images, no test in MotionMark will be exercising the SVG code path. I think also we should not limit ourselves to IE bugs/limitations especially Safari, Chrome and FireFox behave the same but IE does not.
Comment 9 Said Abou-Hallawa 2017-06-05 17:33:53 PDT
Comment on attachment 311844 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=311844&action=review

>>> PerformanceTests/MotionMark/tests/master/resources/image-data.js:42
>>> +        var nameExtension = Utilities.isInternetExplorer() ? "100.png" : ".svg";
>> 
>> It seems like it would be better to have the test be consistent across browsers, so why not have everyone one use 100.png? 
>> 
>> Also, modern convention says you should do detection, not sniffing, so if you want to keep the svg in one, png in another, you should replace the Utilities.isInternetExplorer() check, with a Utilities.canDrawSVGToCanvasWithoutTainting() check, which does that, and checks for an exception. That way, if IE changes, it will get the desired behavior.
>> 
>> That said, I think having everyone do the same thing is better.
> 
> I implemented Utilities.canDrawSVGToCanvasWithoutTainting() which detects whether the browser throws an exception when calling getImageData() after drawing an SVG on the canvas. Beside the ones we are working around here, IE has other limitations. For example the Focus test does not work correctly because it does not render the blur filter correctly. Another limitation is data uri image has to be in url format.
> 
> I think we need to draw the SVG images in this test since this test is the only one that loads and renders SVG images in MotionMark master suite. If we make all the browser uses the png images, no test in MotionMark will be exercising the SVG code path. I think also we should not limit ourselves to IE bugs/limitations especially Safari, Chrome and FireFox behave the same but IE does not.

I was wrong when I said "this test is the only one that loads and renders SVG images in MotionMark master suite." Actually Suits test does render SVG images also.
Comment 10 Sam Weinig 2017-06-08 14:07:21 PDT
In that case, why not just say MotionMark does not run in IE? It seems worse to me to have a benchmark that does different things in different browsers, as it is no longer comparing apples to apples.
Comment 11 Maciej Stachowiak 2020-05-30 19:27:29 PDT
Comment on attachment 312024 [details]
Patch

Seems good to make this fix (despite IE being old and unmaintained) but this patch no longer applies.
Comment 12 Ahmad Saleem 2023-01-14 03:43:04 PST
Internet Explorer is gone, so I don't think we don't need to keep it open. Any input?

Comment 11 do mention that it is good fix despite IE exist or not? Appreciate if someone can share input. Thanks!