Bug 172841

Summary: Fix MotionMark to work in Internet Explorer
Product: WebKit Reporter: Said Abou-Hallawa <sabouhallawa>
Component: Tools / TestsAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: ahmad.saleem792, buildbot, cdumez, dino, graouts, jonlee, mjs, rniwa, sam, simon.fraser
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
jonlee: review-
Patch
sam: review-
Patch mjs: review-

Said Abou-Hallawa
Reported 2017-06-01 16:59:30 PDT
Replace calls to some JavaScript functions, which Internet Explorer does not support, by equivalent code.
Attachments
Patch (6.38 KB, patch)
2017-06-01 17:06 PDT, Said Abou-Hallawa
no flags
Patch (5.61 KB, patch)
2017-06-01 19:49 PDT, Said Abou-Hallawa
jonlee: review-
Patch (5.95 KB, patch)
2017-06-02 12:39 PDT, Said Abou-Hallawa
sam: review-
Patch (7.70 KB, patch)
2017-06-05 13:00 PDT, Said Abou-Hallawa
mjs: review-
Said Abou-Hallawa
Comment 1 2017-06-01 17:06:52 PDT
Jon Lee
Comment 2 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?
Said Abou-Hallawa
Comment 3 2017-06-01 19:49:10 PDT
Jon Lee
Comment 4 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.
Said Abou-Hallawa
Comment 5 2017-06-02 12:39:24 PDT
Sam Weinig
Comment 6 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.
Said Abou-Hallawa
Comment 7 2017-06-05 13:00:15 PDT
Said Abou-Hallawa
Comment 8 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.
Said Abou-Hallawa
Comment 9 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.
Sam Weinig
Comment 10 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.
Maciej Stachowiak
Comment 11 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.
Ahmad Saleem
Comment 12 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!
Note You need to log in before you can comment on or make changes to this bug.