Skip to content

Accessibility Checker Extension architecture notes

Tom Brunet edited this page Jan 20, 2023 · 4 revisions

Extension messages

State

Background

  aceIBMa: Engine
  options: {
    selectedArchive: string
  }
    

Panel

Tab

  /** Contains the last scan info */
  reportCache {
    report: Report
    archiveId: string
    policyId: string
  }

Events

Background Background worker that exists through the lifecycle of the extension. Can send messages between the browser tabs and the panel

/**
 * @from Panel
 * @to Tab::DAP_CACHED_TAB
 */
DAP_CACHED {
  tabId: number
  tabURL: string
  origin: "sub" | "main"
}

/**
 * Gets the current rulesets from the checker
 * @from Panel
 * @return rulesets for the current archive
 */
DAP_Rulesets {
  tabId: number 
} : Rulesets

/**
 * Asks for a scan. Background fetches the current archive / policy from OPTIONS and forwards scan to the tab
 * @from Panel
 * @to Tab:DAP_SCAN_TAB
 */
DAP_SCAN {
  tabId: number
  tabURL: string
  origin: "sub" | "main"
}

/**
 * Relays the report to tab and logs the scan time
 * @from Panel
 * @to Tab::DAP_SCAN_COMPLETE
 */
DAP_SCAN_TAB_COMPLETE { 
  tabId: number
  tabURL: string
  report: ACEREPORT
  archiveId: string
  policyId: string
  origin: "sub" | "main"
}

/**
 * Performs a screenshot and returns it
 * @from Panel
 * @return image
 */
DAP_SCREENSHOT {
} : string

/**
 * @from Panel
 * @to Tab:DELETE_DRAW_TABS_TO_CONTEXT_SCRIPTS
 */
DELETE_DRAW_TABS_TO_CONTEXT_SCRIPTS {
  tabId: number
  tabURL: string
}

/**
 * @from Panel
 * @to Tab:DRAW_TABS_TO_CONTEXT_SCRIPTS
 */
DRAW_TABS_TO_BACKGROUND {
  tabId: number
  tabURL: string
  tabStopsResults: IReportItem[]
  tabStopsErrors: IReportItem[]
  tabStopLines: boolean
  tabStopOutlines: boolean
}

/**
 * @from Panel
 * @to Tab:HIGHLIGHT_TABSTOP_TO_CONTEXT_SCRIPTS
 */
HIGHLIGHT_TABSTOP_TO_BACKGROUND {
  tabId: number,
  tabURL: string,
  tabStopId: number
}

/**
 * Determine if the tab loaded the engine
 * @return true if the engine was loaded
 */
TAB_INFO { 
  tabId: number 
} : boolean

Panel

/**
 * Notify the tab that the tab updated
 *
 * Note: Background listens to chrome events and relays this from Chrome
 * @from Background
 */
TAB_UPDATED {
  tabId: number
  status?: "loading" | string
  tabUrl: string
  tabTitle: string
}

/**
 * Triggers everything to initialize as a result of a new report
 */
DAP_SCAN_COMPLETE {
  tabId: number
  tabURL: string
  report: ACEREPORT
  archiveId: string
  policyId: string
  origin: "sub" | "main"
}

/**
 * Select the specified item
 * @return
 */
TABSTOP_XPATH_ONCLICK {
  xpath: string
  circleNumber: number
} : string

Tab - Events sent to the browser tab

/**
 * Checks the report cache to see if a report already exists
 * @from Background
 * @return Background::DAP_SCAN_TAB_COMPLETE
 */
DAP_CACHED_TAB { 
  tabId: number
  tabURL: string
  origin: "main" | "sub"
}

DAP_SCAN_TAB {
  tabId: number
  tabURL: string
  archiveId: string
  archiveVersion: string
  policyId: string
  origin: "main" | "sub"
}

DELETE_DRAW_TABS_TO_CONTEXT_SCRIPTS {
  tabId: number
  tabURL: string
}

DRAW_TABS_TO_CONTEXT_SCRIPTS { 
  tabId: number
  tabURL: string
  tabStopsResults: IReportItem[]
  tabStopsErrors: IReportItem[]
  tabStopLines: boolean
  tabStopOutlines: boolean
  tabStopAlerts: message.tabStopAlerts // Not used?
  tabStopFirstTime: message.tabStopFirstTime // Not used?
}

HIGHLIGHT_TABSTOP_TO_CONTEXT_SCRIPTS { 
  tabId: number
  tabURL: string
  tabStopId: number
}