Closed Bug 1527753 Opened 6 years ago Closed 6 years ago

Allow restricting JS Window Actors to specific remoteTypes

Categories

(Core :: IPC, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla68
Fission Milestone M2
Tracking Status
firefox68 --- fixed

People

(Reporter: nika, Assigned: jdai)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 2 obsolete files)

This could look something like this:

dictionary WindowActorOptions {
  // ...

  // Optional list of regular expressions for remoteTypes which are
  // allowed to instantiate this actor. If not passed, all content 
  // processes are allowed to instantiate the actor. 
  sequence<DOMString> remoteTypes;
};
Blocks: 1467212
Priority: -- → P3

Nika said she'll be adding more pointers for jdai's work here.

Flags: needinfo?(nika)

This check should be added to the same Matches function which you added in bug 1523982. Information about the remote type which is being considered will have to be passed in as an extra const nsString& aRemoteType parameter.

For a WindowGlobalParent the remote type can be fetched like this:

RefPtr<WindowGlobalParent> wgp = ...;

nsAutoString remoteType;
if (RefPtr<TabParent> tp = wgp->GetTabParent()) {
  remoteType = tp->Manager()->GetRemoteType();
} else {
  remoteType = VoidString();
}

For a WindowGlobalChild, the remote type can be fetched like this:

nsAutoString remoteType;
if (XRE_IsContentProcess()) {
  remoteType = ContentChild::GetSingleton()->GetRemoteType();
} else {
  remoteType = VoidString();
}

The field should be on the WindowActorOptions dictionary:

dictionary WindowActorOptions {
  // ...

  DOMString? remoteType;
};

The type in native will be Optional<nsString>. If WasPassed() is false, we ignore the remoteType, otherwise check that it matches the value retrieved above, and return false otherwise.

Flags: needinfo?(nika)

Thank you for your valuable input. :)

Depends on D24733

Attachment #9053317 - Attachment is obsolete: true
Attachment #9053318 - Attachment is obsolete: true

My old patches were base on bug 1523982 since bug 1523982 was landed, I was trying to rebase my patches to central, but it seems that I can't update patches from arc/phlay to different parent, hence, I send new patches for review. Sorry for any inconvenience.

Pushed by jdai@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/99c4c6989e06 Part 1: Allow restricting JS Window Actors to specific remoteTypes; r=nika https://hg.mozilla.org/integration/autoland/rev/28c8708ee20e Part 2: Add test for restricting JS Window Actors to specific remoteTypes; r=nika
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: