Commit Graph

53 Commits

Author SHA1 Message Date
Jonas Jenwald
a4dfa04a0b Enable the declaration-block-no-redundant-longhand-properties Stylelint rule
Note that these changes were done automatically, using `gulp lint --fix`.
This rule will help avoid unnecessary repetition in the CSS; please see https://stylelint.io/user-guide/rules/declaration-block-no-redundant-longhand-properties/
2023-03-25 10:08:27 +01:00
Jonas Jenwald
20b9887476 Enable the unicorn/prefer-regexp-test ESLint plugin rule
Please see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-regexp-test.md
2022-09-19 16:34:01 +02:00
Jonas Jenwald
37ebc28756 Use more for...of loops in the code-base
Note that these cases, which are all in older code, were found using the [`unicorn/no-for-loop`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-for-loop.md) ESLint plugin rule.
However, note that I've opted not to enable this rule by default since there's still *some* cases where I do think that it makes sense to allow "regular" for-loops.
2022-07-17 16:18:54 +02:00
Jonas Jenwald
8129815538 Enable the unicorn/prefer-dom-node-append ESLint plugin rule
This rule will help enforce slightly shorter code, especially since you can insert multiple elements at once, and according to MDN `Element.append()` is available in all browsers that we currently support.

Please find additional information here:
 - https://developer.mozilla.org/en-US/docs/Web/API/Element/append
 - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-dom-node-append.md
2022-06-12 13:07:03 +02:00
Jonas Jenwald
9ac4536693 Enable the unicorn/prefer-at ESLint plugin rule (PR 15008 follow-up)
Please find additional information here:
 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at
 - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-at.md
2022-06-09 21:21:19 +02:00
Calixte Denizet
0a66e1f5ea Allow to have float numbers when getting image information in reftest-analyzer
- outputScale can be e.g. 1.5 in real life.
2022-05-20 13:02:22 +02:00
Jonas Jenwald
90445679e8 Replace XMLHttpRequest usage with the Fetch API in the reftest-analyzer 2022-03-06 16:02:34 +01:00
Brendan Dahl
c5404bee0e Improvements to the reftest analyzer.
- Scroll the selected reference into view (makes it easier to tell which pdf you're looking at)
- Show the keyboard shortcuts (easier for new people)
- Keep the test/ref controls visible (if you scroll you can now tell if you're looking at a test or ref)
2022-02-25 13:23:19 -08:00
Brendan Dahl
f5c3abb8f7 Generate test images at different output scales.
This will default to generating test images at the device pixel
ratio of the machine the tests are created on unless the
test explicitly defines and output scale using the
`outputScale` setting. This makes the test look visually
like they would on the machine they are running on. It
also allows us to test different output scales.
2022-02-24 11:27:41 -08:00
Jonas Jenwald
4ef1a129fa Replace the remaining Node.removeChild() instances with Element.remove()
Using `Element.remove()` is a slightly more compact way of removing an element, since you no longer need to explicitly find/use its parent element.
Furthermore, the patch also replaces a couple of loops that're used to delete all elements under a node with simply overwriting the contents directly (a pattern already used throughout the viewer).

See also:
 - https://developer.mozilla.org/en-US/docs/Web/API/Node/removeChild
 - https://developer.mozilla.org/en-US/docs/Web/API/Element/remove
2021-11-16 17:52:50 +01:00
Calixte Denizet
fe95e100e4 Parse query string in using URLSearchParams
- I just noticed in reading the code that we parse that stuff when something exists in the web api;
 - see https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams/URLSearchParams.
2021-11-13 21:10:54 +01:00
Jonas Jenwald
df79b831f4 Fix the global variable definitions in test/resources/reftest-analyzer.js (issue 13862)
It shouldn't be necessary to assign these variables to the global scope (as far as I can tell), either explicitly with `window` or implicitly with `var`, and this way we don't need to disable the ESLint `no-undef` rule; fixes another small part of issue 13862.

*Please note:* I wasn't going to put additional work into this code after PR 13869, however these changes looked so simple that I figured trying to get rid of the few remaining "Code scanning alerts" wouldn't hurt.
However, this file would still very much benefit from additional clean-up and re-factoring work, since it's quite old and currently contains some dead code (commented out).
2021-08-06 11:45:55 +02:00
Jonas Jenwald
39663e730e Change the hashParameters function to return a Map rather than an Object (issue 13862)
This patch (basically) mirrors the implementation in PR 13831, to get rid of the "Remote property injection" warning.
2021-08-04 15:17:13 +02:00
Jonas Jenwald
5dfdfbc70b Fix *some* of the remaining linting issues in test/resources/reftest-analyzer.js
Given that issue 13862 tracks updating/modernizing the code, this patch purposely limits the scope of the changes. In particular, the following things are still left to address:
 - The ESLint `no-undef` errors; for now the rule is simply disabled globally in this file.
 - A couple of unused variables are commented out for now, but could perhaps just be removed.
2021-08-04 14:14:04 +02:00
Jonas Jenwald
92300965a4 Fix *most* linting/formatting issues in the test/resources/ folder
These changes were done automatically, by using the `gulp lint --fix` command.
2021-08-04 13:59:21 +02:00
Tim van der Meij
4834a276fd
Introduce Puppeteer for handling browsers during tests
This commit replaces our own infrastructure for handling browsers during
tests with Puppeteer. Using our own infrastructure for this had a few
downsides:

- It has proven to not always be reliable, especially when closing the
  browser, causing failures on the bots because browsers were still
  running even though they should have been stopped. Puppeteer should do
  a better job with this because it uses the browser's test built-in
  instrumentation tools for this (the devtools protocol) which our code
  didn't. This also means that we don't have to pass
  parameters/preferences to tweak browser behavior anymore.
- It requires the browsers under test to be installed on the system,
  whereas Puppeteer downloads the browsers before the test. This means
  that setup is much easier (no more manual installations and browser
  manifest files) as well as testing with different browser versions
  (since they can be provisioned on demand). Moreover, this ensures that
  contributors always run the tests in both Firefox and Chrome,
  regardless of which browsers they have installed locally.
- It's all code we have to maintain, so Puppeteer abstracts away how the
  browsers start/stop for us so we don't have to keep that code.

By default, Puppeteer only installs one browser during installation,
hence the need for a post-install script to install the second browser.
This requires `cross-env` to make passing the environment variable work
on both Linux and Windows.
2020-04-27 13:03:12 +02:00
Jani Pehkonen
e0daabd2dd Magnifier positioning in reftest analyzer
When reftest analyzer shows magnified pixels, there is a seemingly random offset between the mouse position and the magnified position. The reason for this is that reftest analyzer assumes all images have 800 * 1000 pixels but actually the test images have varying sizes.
2020-03-10 19:09:15 +02:00
Jonas Jenwald
842e9206c0 Replace String.prototype.substr() occurrences with String.prototype.substring()
As outlined in https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr, which refers to the ECMA-262 specification, using the `substr` function is advised against.

Hence this PR, which replaces all remaining `substr` occurrences with `substring` instead. Please refer to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr#Syntax respectively https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring#Syntax for the differences between the two functions.

Note that in most cases in the code-base there's only one argument passed to `substr`, and those require no other changes except replacing "substr" with "substring". For the other cases, the `substr(start, length)` calls are changed to `substring(start, start + length)` instead.
2018-09-28 11:41:07 +02:00
Tim van der Meij
ee86a81a50
Bots: disable the default browser test and enable E10s
The test runner is automated, so if the default browser test is
performed, the browser hangs waiting for user input it never gets.
Disable the test to fix that.

Moreover, enable E10s now that it is mature. This may help with the
performance of the test runner as well.
2017-04-27 20:39:57 +02:00
Brendan Dahl
2d27cb1da6 Remove 'use strict'; causing failure and unused prefs. 2016-01-14 13:23:48 -08:00
Brendan Dahl
ad8e43a185 Disable e10s. 2016-01-13 15:21:28 -08:00
Brendan Dahl
4824baf31c Merge pull request #5905 from timvandermeij/specialpowers
Remove SpecialPowers addon
2015-04-27 10:36:54 -07:00
Tim van der Meij
50573b82a3 Provide only one browser manifest example 2015-04-03 21:21:54 +02:00
Tim van der Meij
27170ff858 Remove prefs.js file
The first preference is also in user.js and the second one was only needed for SpecialPowers.
2015-04-03 20:18:42 +02:00
Tim van der Meij
75d8f70d06 Remove SpecialPowers addon 2015-04-03 20:17:20 +02:00
Collin Anderson
54e984c763 cleaned whitespace 2015-02-17 11:07:37 -05:00
Jonas Jenwald
cbe097c0cb In the reftest analyzer, make it possible to toggle "Circle differences" with the D key
It's currently possible to step through the test results using the <kbd>N</kbd> and <kbd>P</kbd> keys, and you can also switch between test and reference images with the <kbd>T</kbd> key.
However if you want to highlight the differences, that can only be done by clicking. This has always annoyed me somewhat, so this patch adds support for toggling the differences view with the <kbd>D</kbd> key.
2014-07-16 12:21:32 +02:00
Ole Michaelis
b4fb161255 adjust the aurora path in the tests browser.json
to match a default OSX installation path
2014-05-27 10:40:15 +02:00
Brendan Dahl
da522d42d4 Fix special powers add-on for firefox. 2014-04-11 10:40:15 -07:00
Tim van der Meij
5ef87394e5 Rewritten reftest analyzer from XHTML to HTML5 2014-02-24 23:00:46 +01:00
Brendan Dahl
edce4550db Fix reftest analyzer naming(again). 2014-01-08 14:02:07 -08:00
Brendan Dahl
fd139324ef Label ref test analyzer images. 2014-01-07 16:11:29 -08:00
Brendan Dahl
1c2cfaf1d6 Add keyboard shortcuts for retest analyzer. 2013-04-01 11:59:57 -07:00
Brendan Dahl
c15d81b58b Use relative paths for ref images and copy refs. 2013-03-13 10:56:22 -07:00
notmasteryet
de821a0db1 Changing special-power version to 13.0 2012-02-19 14:49:08 -06:00
Artur Adib
b49dfe5b6b Disable default browser check in FF testing 2012-01-06 17:28:52 -05:00
Artur Adib
f3745f7c13 New README, .gitignores; Makefile
Makefile: commented out unnecessary closure download and shell testing (at least until someone decides to work on this).
2011-09-16 08:28:59 -07:00
Kalervo Kujala
9634eab60b Use strict in user.js.
And correct the coding style according to gjslint.
2011-08-09 00:24:01 +03:00
Kalervo Kujala
dc01974aa4 Create an example browser_manifest.json for windows. 2011-08-06 23:53:08 +03:00
Rob Sayre
37011784a5 Merge branch 'master' of https://github.com/sayrer/pdf.js 2011-06-28 16:30:48 -07:00
Rob Sayre
061c998ca2 Add Google Chrome to Mac example manifest. 2011-06-28 16:29:11 -07:00
Rob Sayre
6e82ccd073 Add sample browser manifest for Linux. 2011-06-28 15:25:46 -07:00
Rob Sayre
e90ac1d4cd Automatically load eq.log into the reftest page. 2011-06-27 13:22:37 -07:00
Rob Sayre
c3cb102378 Add reftest-analyzer.xhtml 2011-06-27 12:35:48 -07:00
Rob Sayre
d240600296 Suppress telemetry banner. 2011-06-26 11:10:32 -07:00
Rob Sayre
3a99b05b79 Add favicon.ico file 2011-06-24 19:25:03 -07:00
Rob Sayre
40f67c9573 Turn off safe-browsing code in test harness. 2011-06-24 17:13:31 -07:00
Rob Sayre
2bbfb7ae57 Add a line to prevent TestPilot from installing. 2011-06-24 09:00:13 -07:00
Rob Sayre
f212637433 Remove invalid trailing commas. 2011-06-23 15:09:17 -07:00
Rob Sayre
1d5e28347f Cleanup newlines and fix a mistakenly symlinked file. 2011-06-23 13:59:38 -07:00