Closed Bug 1749008 Opened 3 years ago Closed 3 years ago

Optionally attach wireframes to SHEntry when changing the active history entry

Categories

(Core :: Layout, task)

task

Tracking

()

RESOLVED FIXED
98 Branch
Tracking Status
firefox98 --- fixed

People

(Reporter: mconley, Assigned: mconley)

References

Details

Attachments

(1 file)

This is based on the work for bug 1731714. What we want to try to do here is generate and store a wireframe as the user navigates away from a page - either via a full-blown top-level navigation, or via a history.pushState same-page navigation. We want to hang the wireframe off of the nsILayoutHistoryState of the associated SHEntry, and (critically) we want to make sure that this gets piped to the parent as well.

Hey emilio,

So I've been wrestling with this for a few days, and I think I need some help. I think I've more or less sorted out how to do serialization / deserialization with the IPDLParamTraits / ParamTraits stuff... but where things are falling over for me is how to properly expose a WebIDL dictionary (like Wireframe) off of an XPIDL interface. I'm not even sure it's possible - the WebIDL support exists, but it seems like most WebIDL things using it aren't dictionaries.

So this is a half-broken patch that shows where I'm currently at, and I'm looking for guidance on how to properly implement this. It's several layers of stabs at this, so apologies if it looks a bit scattered. I'm also doing some pretty sketchy things with pointers here.

The end goal is that just as a SHEntry becomes inactive, we snapshot the wireframe as well as the rest of the layout state, and to have this take advantage of the SHIP stuff so that the wireframe shows up in the parent process if someone starts touching the parent process SHEntry instance. I haven't cleared the change to nsDocShell's UpdateActiveEntry / PersistLayoutHistoryState yet with the DOM team, but I'm hoping we can focus primarily on the XPCOM/WebIDL glue part and the IPC... I'll clear up those other bits with PeterV or smaug once I've got the PoC working.

I also ended up ditching the DOMRectReadOnly's for the raw rect coordinates on the WireframeTaggedRect - it looks like DOMRect's need to be associated with some kind of nsISupports owner, and I wasn't sure how to deal with that. Maybe there's an easy way around it, but it seemed like a simplification.

Do you have any suggestions on how I could proceed?

Flags: needinfo?(emilio)

I sent a patch that should compile (I moved the Wireframe webidl back to Document.webidl since I thought it might be moved just as a try to try to get Wireframe.h or so, but if that wasn't the case feel free to move it back to its own WebIDL file).

The TL;DR is that you need to expose the attribute to JS as a jsval rather than a strongly-typed thing, but the getter is just a couple lines of code:

NS_IMETHODIMP
nsLayoutHistoryState::GetWireframe(JSContext* aCx, JS::MutableHandleValue aOut) {
  if (NS_WARN_IF(!mWireframe.ToObjectInternal(aCx, aOut))) {
    return NS_ERROR_FAILURE;
  }
  return NS_OK;
}

The rest should be pretty routine...

Flags: needinfo?(emilio)
Assignee: nobody → mconley
Attachment #9258029 - Attachment description: WIP: Bug 1749008 - [WIP] Create a wireframe for unloaded pages / history states and hang them off of nsILayoutHistoryState → Bug 1749008 - Create a wireframe for unloaded pages / history states and hang them off of nsILayoutHistoryState. r?peterv!,emilio!
Status: NEW → ASSIGNED
Summary: Optionally attach wireframes to nsILayoutHistoryState when changing the active history entry → Optionally attach wireframes to SHEntry when changing the active history entry
Attachment #9258029 - Attachment description: Bug 1749008 - Create a wireframe for unloaded pages / history states and hang them off of nsILayoutHistoryState. r?peterv!,emilio! → Bug 1749008 - Create a wireframe for history states during navigation / pushState. and hang them off of nsISHEntry. r?peterv!,emilio!
Attachment #9258029 - Attachment description: Bug 1749008 - Create a wireframe for history states during navigation / pushState. and hang them off of nsISHEntry. r?peterv!,emilio! → WIP: Bug 1749008 - Create a wireframe for history states during navigation / pushState. and hang them off of nsISHEntry. r?peterv!,emilio!
Attachment #9258029 - Attachment description: WIP: Bug 1749008 - Create a wireframe for history states during navigation / pushState. and hang them off of nsISHEntry. r?peterv!,emilio! → Bug 1749008 - Create a wireframe for history states during navigation / pushState. and hang them off of nsISHEntry. r?peterv!,emilio!
Pushed by mconley@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/56f0fc9c5514 Create a wireframe for history states during navigation / pushState. and hang them off of nsISHEntry. r=peterv,emilio
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 98 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: