forked from servo/servo
-
Notifications
You must be signed in to change notification settings - Fork 0
Private browsing student project
Josh Matthews edited this page Feb 9, 2016
·
3 revisions
Background information: All major web browsers support a mode where persistent data such as cookies, logins, history, and downloads are forgotten after the session ends. Additionally, this mode is allowed to run concurrently with the regular, persistent session, without the data from either one interfering with the other. Servo is currently designed around global, shared storage for these sorts of features and therefore lacks this mode. The goal of this project is to implement support for this session partitioning feature.
Initial steps:
- compile Servo and ensure that it runs on
tests/html/about-mozilla.html
- email the mozilla.dev.servo mailing list introducing your group and your progress
- add a member to the
IFrameLoadInfo
struct that indicates if the iframe is private or not. Set this member based on the presence of themozprivatebrowsing
attribute on the iframe element, but only if it's amozbrowser
iframe too. - add a field to the
Pipeline
struct that indicates if the pipeline is private or not. Set this member as part of callingnew_pipeline
fromhandle_script_loaded_url_in_iframe_msg
. - define a
ConstellationMsg
enum incomponents/net_traits/lib.rs
which has aIsPrivate
message that contains aPipelineId
as well as aSender<bool>
value for returning an answer. Add a method toConstellation
that can process the "is this pipeline private" request and send an appropriate reply. This must check the provided pipeline for privacy, as well as any ancestors.
Subsequent steps:
-
create an automated test for the desired functionality - an iframe that performs an XHR that sends a cookie and checks localstorage, and the same iframe but private that shows independent results. This will need to live in
tests/wpt/mozilla/tests/mozilla/mozbrowser/
(see other tests there for inspiration). - add a "New private tab" button to servo-shell to allow using the new feature. It should set the
mozprivatebrowsing
attribute on the new tab that is created. - add a
Receiver
member toConstellation
that can receive the newConstellationMsg
enum defined previously. Create a channel inConstellation::start
, send theSender
value to theResourceThread
, and use the receiver inConstellation::handle_request
to receive messages and call the new method previously defined. - define a new struct in
resource_thread.rs
which encapsulates thecookie_storage
,hsts_list
, andconnector
values. Replace these members with two instances of the new type. Create a method that accepts an optionalPipelineId
value and returns a reference to the new type, returning an appropriate instance based on whether the pipeline should be treated as private or not. - repeat the two previous steps for
StorageThread
instorage_thread.rs
, in order to handlelocalStorage
andsessionStorage
in the same manner.