Commit a0227d78 authored by Eduardo Sanz García's avatar Eduardo Sanz García Committed by Eduardo

Rename `destroyFrame` to `frameDestroyed`

There are two type of events:

* command events (`openSidebar`, `closeSidebar`): direct the receiving
  frame to take an specific action.

* information events ('sidebarOpened`, `helpRequested`): informs the
  receiving frame that an action _already_ took place, in case a follow
  up action needs to happen.

The `destroyFrame` aligns more with the second type.

Follow up of: https://github.com/hypothesis/client/pull/3838/files#r731077947
parent b5fcac43
......@@ -217,7 +217,7 @@ export default class Sidebar {
this._listeners.add(window, 'message', event => {
const { data } = /** @type {MessageEvent} */ (event);
if (data?.type === 'hypothesisGuestUnloaded') {
this._sidebarRPC.call('destroyFrame', data.frameIdentifier);
this._sidebarRPC.call('frameDestroyed', data.frameIdentifier);
}
});
}
......
......@@ -206,7 +206,7 @@ describe('Sidebar', () => {
});
window.dispatchEvent(event);
assert.calledWith(fakeBridge.call, 'destroyFrame', 'frame-id');
assert.calledWith(fakeBridge.call, 'frameDestroyed', 'frame-id');
});
function getConfigString(sidebar) {
......
......@@ -281,7 +281,7 @@ export class FrameSyncService {
// Listen for notifications of a guest being unloaded. This message is routed
// via the host frame rather than coming directly from the unloaded guest
// to work around https://bugs.webkit.org/show_bug.cgi?id=231167.
this._hostRPC.on('destroyFrame', frameIdentifier => {
this._hostRPC.on('frameDestroyed', frameIdentifier => {
const frame = this._store.frames().find(f => f.id === frameIdentifier);
if (frame) {
this._store.destroyFrame(frame);
......
......@@ -497,7 +497,7 @@ describe('FrameSyncService', () => {
it('removes the frame from the frames list', () => {
frameSync.connect();
hostBridge().emit('destroyFrame', frameId);
hostBridge().emit('frameDestroyed', frameId);
assert.calledWith(fakeStore.destroyFrame, fixtures.framesListEntry);
});
......
......@@ -10,7 +10,7 @@ export type HostToSidebarEvent =
/**
* The host informs the sidebar that a guest frame has been destroyed
*/
| 'destroyFrame'
| 'frameDestroyed'
/**
* Highlights have been toggled on/off.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment