- 22 Nov, 2021 2 commits
-
-
Eduardo Sanz García authored
This adoption simplifies the discovery of frames. I did a little bit of clean-up in the tests: rearranged a few variables alphabetically, and delete unneeded lines and variables.
-
Eduardo Sanz García authored
The tests crashed if either of these commands was executed: - `yarn test --grep anchoring`, or - `yarn test --grep 'anchoring/test/pdf|test/integration/anchoring'` `src/anotator/anchoring/test/pdf-test.js` cleanup the Viewer by setting the `window.PDFViewerApplication' to `null`. After that, if another test created a `Guest` instance (like `src/annotator/test/integration/anchoring-test.js`) will think that the document is a PDF and will crash. This is the code that checks if the document is a PDF: https://github.com/hypothesis/client/blob/492ab6d56a5685356ca6b3a48644e047bb28dca0/src/annotator/integrations/pdf.js#L53-L56 The solution is either deleting `window.PDFViewerApplication' or setting it to `undefined`.
-
- 19 Nov, 2021 1 commit
-
-
Eduardo Sanz García authored
We use `Window` objects as keys on a map. Windows can be removed. `WeakMap` has the characteristic that keys that are claimed by the garbage collector are removed from the map. In this way, we are memory friendly and don't retain any defunct object.
-
- 17 Nov, 2021 5 commits
-
-
Robert Knight authored
-
Robert Knight authored
Create a test page for PDF-based VS books, using content adapted from https://bookshelf.vitalsource.com/reader/books/9781938168239/, an OpenStax textboot that is available for free [1] in VitalSource. - Rename vitalsource.mustache => vitalsource-epub.mustache to make the distinction with the PDF example clearer. - Create vitalsource-pdf.mustache which serves as the "container" page for a PDF-based VS book. This is a copy of vitalsource-epub.mustache with the Prev/Next buttons removed and slight terminology changes ("chapter" => "page") to reflect how PDFs are handled in VS - Revise the descriptive text at the top of the VS PDF and EPUB examples to explain the purpose more clearly and relate them to how books are presented in the Bookshelf store, where the terms "reflowable" and "fixed" are used instead of "EPUB" and "PDF". - Add a very lightly edited copy of a real content page from a VS book in vitalsource-pdf-page.mustache. This is the HTML content from the iframe displaying a page in a PDF book in VS. The only changes I have made are small block of CSS customizations at the top (see comment) and a change to the URL of the rendered PDF page. - Update the links to the VitalSource test pages on the dev server. [1] Even though the book is free, you have to add it to your VitalSource book library before you can access it. To do that, go to https://bookshelf.vitalsource.com and search for the book ID (9781938168239 in this case), then click "Open Book".
-
Eduardo Sanz García authored
Following these two comments: * https://github.com/hypothesis/client/pull/3929/files#r750399422 * https://github.com/hypothesis/client/pull/3929/files#r750414036 I am proposing in this PR to remove the anti-collision field `authority` from the message that is send to discover frames. I believe the message contains enough information to avoid to be confused by other unrelated `postMessage` in the host frame.
-
Eduardo authored
Co-authored-by: Robert Knight <robertknight@gmail.com>
-
Eduardo Sanz García authored
For PortFinder, I followed this advice: https://github.com/hypothesis/client/pull/3881#discussion_r743030606, except that I made the argument of `PorFinder#discover` and string (instead of an object). ``` const portFinder = new PortFinder({ source: 'guest', hostFrame }); portFinder.discover('sidebar'); portFinder.discover('host'); ``` For PortProvider, I followed this advice: https://github.com/hypothesis/client/pull/3881#discussion_r743033013, except that I used a getter. ``` cont portProvider = new PortProvider(...) const bridge = new Bridge(); bridge.createChannel(portProvider.sidebarPort); ``` I have renamed the properties of `Message`: - `source` becomes `authority` - `channel` and `port` have been replaced by `frame1` and `frame2` I did that to align `port1` and `frame1` and `port2` and `frame2`, while also avoiding clashing with other names (`source`, `target`) which have other meaning in the `window.postMessage` context. I have removed one level of nesting in the `PortProvider#discover` that make the method more readable. I added some other suggestions from PR #3881.
-
- 15 Nov, 2021 16 commits
-
-
Eduardo authored
Co-authored-by: Robert Knight <robertknight@gmail.com>
-
Eduardo Sanz García authored
This new method allows to unregister individual event listeners.
-
dependabot[bot] authored
Bumps [eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y) from 6.4.1 to 6.5.1. - [Release notes](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/releases) - [Changelog](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/CHANGELOG.md) - [Commits](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/compare/v6.4.1...v6.5.1) --- updated-dependencies: - dependency-name: eslint-plugin-jsx-a11y dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
-
Eduardo authored
Co-authored-by: Robert Knight <robertknight@gmail.com>
-
Eduardo authored
Co-authored-by: Robert Knight <robertknight@gmail.com>
-
Eduardo Sanz García authored
Sometimes there was some confusion between the `source` in the `window#postMessage` context and the property in the message sent through it. We believe it is better to replace the `SOURCE` by the 'hypothesis' string.
-
Eduardo Sanz García authored
Co-authored-by: Robert Knight <robertknight@gmail.com>
-
Eduardo Sanz García authored
On Chrome, transferring the port more than once causes an error: ``` const {port1, port2} = new MessageChannel(); window.postMessage('hello', '*', [port1]) window.postMessage('hello', '*', [port1]) > Uncaught DOMException: Failed to execute 'postMessage' on 'Window': Port at index 0 is already neutered. at <anonymous>:1:8 ``` As a result of `PortFinder` polling the host, `PortProvider` could respond multiple times, specially when the polling frequency is high.
-
Eduardo Sanz García authored
-
Eduardo Sanz García authored
The combination of these two classes enable the discovery and establishment of `MessageChannel` communication between pairs of frames. It works with cross-origin frames. It is the last step of this epic: https://github.com/hypothesis/client/issues/3533 Closes: https://github.com/hypothesis/client/issues/3695
-
dependabot[bot] authored
Bumps [aws-sdk](https://github.com/aws/aws-sdk-js) from 2.1023.0 to 2.1028.0. - [Release notes](https://github.com/aws/aws-sdk-js/releases) - [Changelog](https://github.com/aws/aws-sdk-js/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-js/compare/v2.1023.0...v2.1028.0) --- updated-dependencies: - dependency-name: aws-sdk dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [eslint-plugin-react-hooks](https://github.com/facebook/react/tree/HEAD/packages/eslint-plugin-react-hooks) from 4.2.0 to 4.3.0. - [Release notes](https://github.com/facebook/react/releases) - [Changelog](https://github.com/facebook/react/blob/main/packages/eslint-plugin-react-hooks/CHANGELOG.md) - [Commits](https://github.com/facebook/react/commits/HEAD/packages/eslint-plugin-react-hooks) --- updated-dependencies: - dependency-name: eslint-plugin-react-hooks dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 6.14.1 to 6.14.3. - [Release notes](https://github.com/getsentry/sentry-javascript/releases) - [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/sentry-javascript/compare/6.14.1...6.14.3) --- updated-dependencies: - dependency-name: "@sentry/browser" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) from 7.26.1 to 7.27.0. - [Release notes](https://github.com/yannickcr/eslint-plugin-react/releases) - [Changelog](https://github.com/yannickcr/eslint-plugin-react/blob/master/CHANGELOG.md) - [Commits](https://github.com/yannickcr/eslint-plugin-react/compare/v7.26.1...v7.27.0) --- updated-dependencies: - dependency-name: eslint-plugin-react dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [rollup](https://github.com/rollup/rollup) from 2.59.0 to 2.60.0. - [Release notes](https://github.com/rollup/rollup/releases) - [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md) - [Commits](https://github.com/rollup/rollup/compare/v2.59.0...v2.60.0) --- updated-dependencies: - dependency-name: rollup dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [enzyme-adapter-preact-pure](https://github.com/preactjs/enzyme-adapter-preact-pure) from 3.2.0 to 3.3.0. - [Release notes](https://github.com/preactjs/enzyme-adapter-preact-pure/releases) - [Changelog](https://github.com/preactjs/enzyme-adapter-preact-pure/blob/master/CHANGELOG.md) - [Commits](https://github.com/preactjs/enzyme-adapter-preact-pure/compare/v3.2.0...v3.3.0) --- updated-dependencies: - dependency-name: enzyme-adapter-preact-pure dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
-
- 12 Nov, 2021 4 commits
-
-
Eduardo Sanz García authored
There seems to be a pattern in our code that if a fake clock is used on a single `it` function, the clock should be created and restored within that function. I think it is beneficial from a readability perspective. On the other hand, if the clock is used in several test functions it should be declared on a parent context and restored on an `afterEach` function. I simplified an unrelated test using async.
-
Eduardo Sanz García authored
-
Eduardo Sanz García authored
On `destroy` the PDF integration clean up the `<hypothesis-banner>` element, if any.
-
Eduardo Sanz García authored
-
- 11 Nov, 2021 4 commits
-
-
Robert Knight authored
By default TypeScript includes all `@types/<name>` packages. This includes @types/node, though we don't use it directly, because it is a transitive dependency (see `yarn why @types/node`). As a result Node's globals are added to the environment TS sees, even though they don't really exist when our code runs in a browser. These globals include overloads for `setTimeout` and `setInterval` which return a different type (`Timeout`), causing spurious errors when assigning the result to a number. Fix the problem by using the `types` option [1] in tsconfig.json to explicitly specify which `@types/<name>` packages to include when checking code in src/ This does mean that if we ever intentionally add @types packages which declare globals (eg. for mocha), we'll need to explicitly list them here. In the process the ES target was updated to fix an error about a `BigInt` reference. [1] https://www.typescriptlang.org/tsconfig#types
-
Robert Knight authored
`useRef(null as T|null)` now returns a `{ current: T|null }` instead of `{ current: T }` as it did before. ie. it no longer drops the the null. This makes sense but conflicted with a pattern we used in many places to create a non-null ref: `useRef(/** @type {T|null} */ (null))`. Resolve this by changing all non-nullable refs, for elements which are set after the initial render, to cast the `useRef` result instead of the init value. ``` const nonNullRef = /** @type {{ current: T }} */ (useRef()); ```
-
dependabot[bot] authored
Bumps [preact](https://github.com/preactjs/preact) from 10.5.13 to 10.5.15. - [Release notes](https://github.com/preactjs/preact/releases) - [Commits](https://github.com/preactjs/preact/compare/10.5.13...10.5.15) --- updated-dependencies: - dependency-name: preact dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
-
Robert Knight authored
- @actions/core was used when the @hypothesis/frontend-shared package was part of the client repo. - postcss-url was used prior to the introduction of @hypothesis/frontend-build
-
- 09 Nov, 2021 8 commits
-
-
Robert Knight authored
The window `resize` event is good enough for the current use case and works in all browsers, but wouldn't work if the ThreadList could change size independently of the iframe/window.
-
Robert Knight authored
Fix an issue that caused `ThreadList` to sometimes have an incorrect (too small) internal `scrollContainerHeight` state after the app loaded, resulting in not enough annotation cards being rendered for the height of the sidebar. `ThreadList` measures the height of the scroll container after the initial render in a `useLayoutEffect` callback. It then registers handlers for window resize events in a `useEffect` callback order to re-measure the height when it changes. The sequence of events that lead to the incorrect state was: 1. The sidebar iframe starts out hidden, by a `display: none` on a container of the iframe in the parent frame. 2. When the `useLayoutEffect` callback runs, the iframe is hidden and so the scroll container height is measured as zero. 3. The iframe is then shown and a `resize` event is fired at the window 4. The ThreadList's `useEffect` callback runs and registers a handler for the window's `resize` event Because the initial window `resize` event is fired before the listener is registered, the scroll container height did not get re-measured. The fix is to combine the `useLayoutEffect` and `useEffect` callbacks from steps (2) and (4) so that the `resize` listener is registered immediately after the initial size is measured. Combining the effects is also beneficial from a readability perspective as it locates all the related state and logic together in the component. Fixes https://github.com/hypothesis/client/issues/3915
-
dependabot[bot] authored
Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 6.13.3 to 6.14.1. - [Release notes](https://github.com/getsentry/sentry-javascript/releases) - [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/sentry-javascript/compare/6.13.3...6.14.1) --- updated-dependencies: - dependency-name: "@sentry/browser" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [sinon](https://github.com/sinonjs/sinon) from 11.1.2 to 12.0.1. - [Release notes](https://github.com/sinonjs/sinon/releases) - [Changelog](https://github.com/sinonjs/sinon/blob/master/docs/changelog.md) - [Commits](https://github.com/sinonjs/sinon/compare/v11.1.2...v12.0.1) --- updated-dependencies: - dependency-name: sinon dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [karma](https://github.com/karma-runner/karma) from 6.3.6 to 6.3.8. - [Release notes](https://github.com/karma-runner/karma/releases) - [Changelog](https://github.com/karma-runner/karma/blob/master/CHANGELOG.md) - [Commits](https://github.com/karma-runner/karma/compare/v6.3.6...v6.3.8) --- updated-dependencies: - dependency-name: karma dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [core-js](https://github.com/zloirock/core-js) from 3.19.0 to 3.19.1. - [Release notes](https://github.com/zloirock/core-js/releases) - [Changelog](https://github.com/zloirock/core-js/blob/master/CHANGELOG.md) - [Commits](https://github.com/zloirock/core-js/compare/v3.19.0...v3.19.1) --- updated-dependencies: - dependency-name: core-js dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [reselect](https://github.com/reduxjs/reselect) from 4.1.1 to 4.1.2. - [Release notes](https://github.com/reduxjs/reselect/releases) - [Changelog](https://github.com/reduxjs/reselect/blob/master/CHANGELOG.md) - [Commits](https://github.com/reduxjs/reselect/compare/v4.1.1...v4.1.2) --- updated-dependencies: - dependency-name: reselect dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [aws-sdk](https://github.com/aws/aws-sdk-js) from 2.1018.0 to 2.1023.0. - [Release notes](https://github.com/aws/aws-sdk-js/releases) - [Changelog](https://github.com/aws/aws-sdk-js/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-js/compare/v2.1018.0...v2.1023.0) --- updated-dependencies: - dependency-name: aws-sdk dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
-