Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

History API #11220

Closed
wants to merge 10 commits into from

Rebased

  • Loading branch information
cbrewster committed May 28, 2016
commit 5a341b5681e431be7c20bfa8f2d6d06ba4dab388
@@ -24,12 +24,12 @@ use gfx_traits::Epoch;
use ipc_channel::ipc::{self, IpcSender};
use ipc_channel::router::ROUTER;
use layout_traits::{LayoutControlChan, LayoutThreadFactory};
use msg::constellation_msg::PanicMsg;
use msg::constellation_msg::WebDriverCommandMsg;
use msg::constellation_msg::{FrameId, FrameType, PipelineId};
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData};
use msg::constellation_msg::{PipelineNamespace, PipelineNamespaceId, NavigationDirection};
use msg::constellation_msg::{SubpageId, WindowSizeData, WindowSizeType};
use msg::constellation_msg::{self, PanicMsg};
use msg::webdriver_msg;
use net_traits::bluetooth_thread::BluetoothMethodMsg;
use net_traits::filemanager_thread::FileManagerThreadMsg;
@@ -30,7 +30,6 @@ use js::jsapi::{JSContext, JSPROP_READONLY, JSErrNum, JSObject, PropertyDescript
use js::jsapi::{JS_ForwardGetPropertyTo, JS_ForwardSetPropertyTo, JS_GetClass, JSTracer, FreeOp};
use js::jsapi::{JS_GetOwnPropertyDescriptorById, JS_HasPropertyById, MutableHandle};
use js::jsval::{JSVal, UndefinedValue, PrivateValue, NullValue};
use msg::constellation_msg::ConstellationChan;
use msg::constellation_msg::{PipelineId, SubpageId};
use script_thread::Runnable;
use script_traits::ScriptMsg as ConstellationMsg;
@@ -205,9 +204,8 @@ impl BrowsingContext {

let active_window = self.active_window();
let pipeline_info = active_window.parent_info();
let ConstellationChan(ref chan) = *active_window.constellation_chan();
let msg = ConstellationMsg::HistoryStatePushed(pipeline_info, new_index);
chan.send(msg).unwrap();
active_window.constellation_chan().send(msg).unwrap();

Ok(())
}
@@ -15,7 +15,7 @@ use dom::window::Window;
use ipc_channel::ipc;
use js::jsapi::{HandleValue, JSContext, JSAutoCompartment, RootedValue};
use js::jsval::{JSVal, UndefinedValue};
use msg::constellation_msg::{ConstellationChan, NavigationDirection};
use msg::constellation_msg::NavigationDirection;
use script_traits::ScriptMsg as ConstellationMsg;
use util::str::DOMString;

@@ -41,16 +41,14 @@ impl History {
}

fn traverse_history(&self, direction: NavigationDirection) {
let ConstellationChan(ref chan) = *self.window.constellation_chan();
let msg = ConstellationMsg::Navigate(direction);
chan.send(msg).unwrap();
self.window.constellation_chan().send(msg).unwrap();
}

fn is_fully_active(&self) -> ErrorResult {
let (sender, receiver) = ipc::channel::<bool>().expect("Failed to create IPC channel");
let ConstellationChan(ref chan) = *self.window.constellation_chan();
let msg = ConstellationMsg::IsPipelineFullyActive(self.window.pipeline(), sender);
chan.send(msg).unwrap();
self.window.constellation_chan().send(msg).unwrap();

if receiver.recv().unwrap() {
Ok(())
@@ -65,9 +63,8 @@ impl HistoryMethods for History {
fn GetLength(&self) -> Fallible<u32> {
try!(self.is_fully_active());
let (sender, receiver) = ipc::channel::<usize>().expect("Failed to create IPC channel");
let ConstellationChan(ref chan) = *self.window.constellation_chan();
let msg = ConstellationMsg::HistoryLength(sender);
chan.send(msg).unwrap();
self.window.constellation_chan().send(msg).unwrap();
Ok(receiver.recv().unwrap() as u32)
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.