Closed Bug 1311247 Opened 3 years ago Closed 3 years ago

Avoid using unsafe CPOWs in browser_perwindow_privateBrowsing.js

Categories

(Firefox :: Private Browsing, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
Firefox 52
Tracking Status
firefox50 --- fixed
firefox51 --- fixed
firefox52 --- fixed

People

(Reporter: ehsan, Assigned: ehsan)

Details

Attachments

(1 file, 1 obsolete file)

No description provided.
Attachment #8802379 - Flags: review?(mrbkap)
Comment on attachment 8802379 [details] [diff] [review]
Avoid using unsafe CPOWs in browser_perwindow_privateBrowsing.js

Review of attachment 8802379 [details] [diff] [review]:
-----------------------------------------------------------------

This isn't quite enough. The function setFinishedCallback is using CPOWs in order to set the callback. Looking through the callers, it seems like we can make sure the rest of the content pages pass primitive values and then rewrite setFinishedCallback as:

function setFinishedCallback(callback, win = window) {
  ContentTask.spawn(win.gBrowser.selectedBrowser, null, function* () {
    return yield new Promise(resolve => {
      content.wrappedJSObject.testFinishedCallback = function(result, exception) {
        resolve([result, exception]);
      };
    });
  }).then((args) => {
    callback(...args);
  });
}

This would be in addition to this patch. We can also get rid of dispatchEvent in dom/indexedDB/test/head.js since it isn't used and would use a CPOW if it was.
Attachment #8802379 - Flags: review?(mrbkap) → feedback+
Attachment #8802379 - Attachment is obsolete: true
Comment on attachment 8803121 [details] [diff] [review]
Avoid using unsafe CPOWs in browser_perwindow_privateBrowsing.js

Review of attachment 8803121 [details] [diff] [review]:
-----------------------------------------------------------------

Perfect, thanks!
Attachment #8803121 - Flags: review?(mrbkap) → review+
Pushed by eakhgari@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/e93fcd61991f
Avoid using unsafe CPOWs in browser_perwindow_privateBrowsing.js; r=mrbkap
backed out for bc7 osx failures like https://treeherder.mozilla.org/logviewer.html#?job_id=38026535&repo=mozilla-inbound
Flags: needinfo?(ehsan)
Backout by cbook@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/206b9d6580ec
Backed out changeset e93fcd61991f for frequent OS X bc 7 failures
I will reland this.  Comment 6 is not relevant to this bug.
Flags: needinfo?(ehsan)
Pushed by eakhgari@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/db4bd5ad7a41
Avoid using unsafe CPOWs in browser_perwindow_privateBrowsing.js; r=mrbkap
Assignee: nobody → ehsan
https://hg.mozilla.org/mozilla-central/rev/db4bd5ad7a41
Status: NEW → RESOLVED
Closed: 3 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → Firefox 52
You need to log in before you can comment on or make changes to this bug.