mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Implement history.length
Add full frame tree iter to reduce code duplication Add FrameId field to the Frame struct.
This commit is contained in:
parent
e2d4ff5b62
commit
611de2ac06
8 changed files with 95 additions and 64 deletions
|
@ -10,6 +10,7 @@ use dom::bindings::global::GlobalRef;
|
|||
use dom::bindings::js::{JS, Root};
|
||||
use dom::bindings::reflector::{Reflector, reflect_dom_object};
|
||||
use dom::window::Window;
|
||||
use ipc_channel::ipc;
|
||||
use msg::constellation_msg::TraversalDirection;
|
||||
use script_traits::ScriptMsg as ConstellationMsg;
|
||||
|
||||
|
@ -44,6 +45,15 @@ impl History {
|
|||
}
|
||||
|
||||
impl HistoryMethods for History {
|
||||
// https://html.spec.whatwg.org/multipage/#dom-history-length
|
||||
fn Length(&self) -> u32 {
|
||||
let pipeline = self.window.pipeline();
|
||||
let (sender, recv) = ipc::channel().expect("Failed to create channel to send jsh length.");
|
||||
let msg = ConstellationMsg::JointSessionHistoryLength(pipeline, sender);
|
||||
let _ = self.window.constellation_chan().send(msg);
|
||||
recv.recv().unwrap()
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-history-go
|
||||
fn Go(&self, delta: i32) {
|
||||
let direction = if delta > 0 {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
// https://html.spec.whatwg.org/multipage/#the-history-interface
|
||||
[Exposed=(Window,Worker)]
|
||||
interface History {
|
||||
// readonly attribute unsigned long length;
|
||||
readonly attribute unsigned long length;
|
||||
// attribute ScrollRestoration scrollRestoration;
|
||||
// readonly attribute any state;
|
||||
void go(optional long delta = 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue