Open Bug 1248418 Opened 8 years ago Updated 11 months ago

Implement errorOccurred in the webNavigation.getFrame/getAllFrames frame details

Categories

(WebExtensions :: Request Handling, task, P3)

task

Tracking

(Not tracked)

People

(Reporter: rpl, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [webNavigation][berlin] triaged)

The frame details that can be retrieved using the recently landed |webNavigation.getFrame/getAllFrames| should support an errorOccurred boolean field, from https://developer.chrome.com/extensions/webNavigation:

    boolean 	errorOccurred 	

    True if the last navigation in this frame was interrupted by an error, 
    i.e. the onErrorOccurred event fired.
In the initial prototype of |webNavigation.getFrame/getAllFrames|, |errorOccurred| was retrieved through the usage of the following constants:

    // NOTE: Compute the Error Page loadType value. (See Bug 1190685 for rationale)
    // - LOAD_CMD_NORMAL (as defined in "docshell/base/nsIDocShell.idl"):
    // - LOAD_FLAGS_ERROR_PAGE (as defined in "docshell/base/nsDocShellLoadTypes.h")
    // - MAKE_LOAD_TYPE (as defined in "docshell/base/nsDocShellLoadTypes.h")
    // - LOAD_ERROR_PAGE (as defined in "docshell/base/nsDocShellLoadTypes.h")
    
    const LOAD_CMD_NORMAL = Ci.nsIDocShell.LOAD_CMD_NORMAL;
    const LOAD_FLAGS_ERROR_PAGE = 0x1;
    const MAKE_LOAD_TYPE = (type, flags) => (type | (flags << 16));
    const LOAD_ERROR_PAGE = MAKE_LOAD_TYPE(LOAD_CMD_NORMAL, LOAD_FLAGS_ERROR_PAGE);

    ...
    let errorOccurred = (docShell.loadType == LOAD_ERROR_PAGE);

Unfortunately the LOAD_ERROR_PAGE constant is defined in "docshell/base/nsDocShellLoadTypes.h" and it is not exported in any of the idl files.

If exporting LOAD_ERROR_PAGE constant in the |nsIDocShell.idl| file is not an option, another strategy to build the knowledge needed to being able to populate |errorOccurred| in the frame details is keeping track of the docShells where we are already detecting and sending the |onErrorOccurred| webNavigation event in a WeakMap.

Unfortunately this strategy will work only for docShells where the error occurred after the first addon with the webNavigation permission and a subscribed webNavigation event (because it will enable the WebProgressListener in the webNavigation frame script which will keep track/untrack of the errorOccurred docShells).
Whiteboard: [webNavigation]
Luca - please move higher if this is a high priority - but looked like a P3, can wait until post 48
Priority: -- → P3
Whiteboard: [webNavigation] → [webNavigation] triaged
Whiteboard: [webNavigation] triaged → [webNavigation][berlin] triaged
Component: WebExtensions: Untriaged → WebExtensions: Request Handling
Product: Toolkit → WebExtensions
Severity: normal → S3
Type: defect → task
You need to log in before you can comment on or make changes to this bug.