From deef1c15bd4cc3c59bf2bcdde93ac3ec5214b183 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabrice=20Desr=C3=A9?= Date: Fri, 10 Oct 2014 14:28:04 -0700 Subject: [PATCH 01/13] Bug 832700 - Add private browsing to Firefox OS r=ehsan,smaug --- content/base/src/nsGkAtomList.h | 1 + docshell/base/nsDocShell.cpp | 14 ++++++++++++++ docshell/base/nsDocShell.h | 1 + docshell/base/nsIDocShell.idl | 9 ++++++++- dom/browser-element/BrowserElementChild.js | 7 +++++++ dom/browser-element/BrowserElementParent.cpp | 8 ++++++++ dom/browser-element/BrowserElementParent.jsm | 3 ++- 7 files changed, 41 insertions(+), 2 deletions(-) diff --git a/content/base/src/nsGkAtomList.h b/content/base/src/nsGkAtomList.h index a680b6c381b4..53162fee49c9 100644 --- a/content/base/src/nsGkAtomList.h +++ b/content/base/src/nsGkAtomList.h @@ -609,6 +609,7 @@ GK_ATOM(mozfullscreenerror, "mozfullscreenerror") GK_ATOM(mozpasspointerevents, "mozpasspointerevents") GK_ATOM(mozpointerlockchange, "mozpointerlockchange") GK_ATOM(mozpointerlockerror, "mozpointerlockerror") +GK_ATOM(mozprivatebrowsing, "mozprivatebrowsing") GK_ATOM(moz_opaque, "moz-opaque") GK_ATOM(moz_action_hint, "mozactionhint") GK_ATOM(x_moz_errormessage, "x-moz-errormessage") diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index f7e1d7df4a3a..94d3d12a7875 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -851,6 +851,7 @@ nsDocShell::nsDocShell(): #endif mAffectPrivateSessionLifetime(true), mInvisible(false), + mHasLoadedNonBlankURI(false), mDefaultLoadFlags(nsIRequest::LOAD_NORMAL), mFrameType(eFrameTypeRegular), mOwnOrContainingAppId(nsIScriptSecurityManager::UNKNOWN_APP_ID), @@ -1928,6 +1929,10 @@ nsDocShell::SetCurrentURI(nsIURI *aURI, nsIRequest *aRequest, mCurrentURI = NS_TryToMakeImmutable(aURI); + if (!NS_IsAboutBlank(mCurrentURI)) { + mHasLoadedNonBlankURI = true; + } + bool isRoot = false; // Is this the root docshell bool isSubFrame = false; // Is this a subframe navigation? @@ -2277,6 +2282,15 @@ nsDocShell::SetPrivateBrowsing(bool aUsePrivateBrowsing) return NS_OK; } +NS_IMETHODIMP +nsDocShell::GetHasLoadedNonBlankURI(bool* aResult) +{ + NS_ENSURE_ARG_POINTER(aResult); + + *aResult = mHasLoadedNonBlankURI; + return NS_OK; +} + NS_IMETHODIMP nsDocShell::GetUseRemoteTabs(bool* aUseRemoteTabs) { diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index eda8f2215584..d9a82abe4f70 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -915,6 +915,7 @@ protected: #endif bool mAffectPrivateSessionLifetime; bool mInvisible; + bool mHasLoadedNonBlankURI; uint64_t mHistoryID; uint32_t mDefaultLoadFlags; diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl index 02c07d548dd4..cf81b57427e8 100644 --- a/docshell/base/nsIDocShell.idl +++ b/docshell/base/nsIDocShell.idl @@ -54,7 +54,7 @@ interface nsITabParent; typedef unsigned long nsLoadFlags; -[scriptable, builtinclass, uuid(2b8e4a50-7744-454d-a05b-debead8070fe)] +[scriptable, builtinclass, uuid(23157a63-26fd-44a0-a0f9-fdc64dcc004c)] interface nsIDocShell : nsIDocShellTreeItem { /** @@ -1017,4 +1017,11 @@ interface nsIDocShell : nsIDocShellTreeItem // URLSearchParams for the window.location is owned by the docShell. [noscript,notxpcom] URLSearchParams getURLSearchParams(); + + /** + * This attribute determines whether a document which is not about:blank has + * already be loaded by this docShell. + */ + [infallible] readonly attribute boolean hasLoadedNonBlankURI; + }; diff --git a/dom/browser-element/BrowserElementChild.js b/dom/browser-element/BrowserElementChild.js index aa06587c95fa..2c140ea7bb1d 100644 --- a/dom/browser-element/BrowserElementChild.js +++ b/dom/browser-element/BrowserElementChild.js @@ -56,3 +56,10 @@ let infos = sendSyncMessage('browser-element-api:call', { 'msg_name': 'hello' })[0]; docShell.QueryInterface(Ci.nsIDocShellTreeItem).name = infos.name; docShell.setFullscreenAllowed(infos.fullscreenAllowed); +if (infos.isPrivate) { + if (!docShell.hasLoadedNonBlankURI) { + Cu.reportError("We should not switch to Private Browsing after loading a document."); + } else { + docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = true; + } +} diff --git a/dom/browser-element/BrowserElementParent.cpp b/dom/browser-element/BrowserElementParent.cpp index 62ca3c119d1d..83f5057ba4d7 100644 --- a/dom/browser-element/BrowserElementParent.cpp +++ b/dom/browser-element/BrowserElementParent.cpp @@ -76,6 +76,14 @@ CreateIframe(Element* aOpenerFrameElement, const nsAString& aName, bool aRemote) NS_LITERAL_STRING("false"), /* aNotify = */ false); + // Copy the opener frame's mozprivatebrowsing attribute to the popup frame. + nsAutoString mozprivatebrowsing; + if (aOpenerFrameElement->GetAttr(kNameSpaceID_None, nsGkAtoms::mozprivatebrowsing, + mozprivatebrowsing)) { + popupFrameElement->SetAttr(kNameSpaceID_None, nsGkAtoms::mozprivatebrowsing, + mozprivatebrowsing, /* aNotify = */ false); + } + return popupFrameElement.forget(); } diff --git a/dom/browser-element/BrowserElementParent.jsm b/dom/browser-element/BrowserElementParent.jsm index 066c59a040a8..3a7124be8001 100644 --- a/dom/browser-element/BrowserElementParent.jsm +++ b/dom/browser-element/BrowserElementParent.jsm @@ -389,7 +389,8 @@ BrowserElementParent.prototype = { name: this._frameElement.getAttribute('name'), fullscreenAllowed: this._frameElement.hasAttribute('allowfullscreen') || - this._frameElement.hasAttribute('mozallowfullscreen') + this._frameElement.hasAttribute('mozallowfullscreen'), + isPrivate: this._frameElement.hasAttribute('mozprivatebrowsing') }; }, From f18e3d4c3fcec3c5ea5707bb77b2c33e12de637d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabrice=20Desr=C3=A9?= Date: Fri, 10 Oct 2014 14:28:04 -0700 Subject: [PATCH 02/13] Bug 832700 - Add private browsing to Firefox OS r=smaug --- .../mochitest/browserElementTestHelpers.js | 273 ------------------ .../browserElement_PrivateBrowsing.js | 46 +++ .../file_browserElement_PrivateBrowsing.html | 10 + .../mochitest/mochitest-oop.ini | 1 + dom/browser-element/mochitest/mochitest.ini | 3 + ...browserElement_inproc_PrivateBrowsing.html | 19 ++ ...st_browserElement_oop_PrivateBrowsing.html | 19 ++ 7 files changed, 98 insertions(+), 273 deletions(-) create mode 100644 dom/browser-element/mochitest/browserElement_PrivateBrowsing.js create mode 100644 dom/browser-element/mochitest/file_browserElement_PrivateBrowsing.html create mode 100644 dom/browser-element/mochitest/test_browserElement_inproc_PrivateBrowsing.html create mode 100644 dom/browser-element/mochitest/test_browserElement_oop_PrivateBrowsing.html diff --git a/dom/browser-element/mochitest/browserElementTestHelpers.js b/dom/browser-element/mochitest/browserElementTestHelpers.js index 547675e164d4..954f21151fec 100644 --- a/dom/browser-element/mochitest/browserElementTestHelpers.js +++ b/dom/browser-element/mochitest/browserElementTestHelpers.js @@ -303,276 +303,3 @@ browserElementTestHelpers.lockTestReady(); addEventListener('load', function() { SimpleTest.executeSoon(browserElementTestHelpers.unlockTestReady.bind(browserElementTestHelpers)); }); - -////////////////////////////////// -// promise.js from the addon SDK with some modifications to the module -// boilerplate. -////////////////////////////////// - -;(function(id, factory) { // Module boilerplate :( - var globals = this; - factory(function require(id) { - return globals[id]; - }, (globals[id] = {}), { uri: document.location.href + '#' + id, id: id }); -}).call(this, 'Promise', function Promise(require, exports, module) { - -'use strict'; - -module.metadata = { - "stability": "unstable" -}; - -/** - * Internal utility: Wraps given `value` into simplified promise, successfully - * fulfilled to a given `value`. Note the result is not a complete promise - * implementation, as its method `then` does not returns anything. - */ -function fulfilled(value) { - return { then: function then(fulfill) { fulfill(value); } }; -} - -/** - * Internal utility: Wraps given input into simplified promise, pre-rejected - * with a given `reason`. Note the result is not a complete promise - * implementation, as its method `then` does not returns anything. - */ -function rejected(reason) { - return { then: function then(fulfill, reject) { reject(reason); } }; -} - -/** - * Internal utility: Returns `true` if given `value` is a promise. Value is - * assumed to be a promise if it implements method `then`. - */ -function isPromise(value) { - return value && typeof(value.then) === 'function'; -} - -/** - * Creates deferred object containing fresh promise & methods to either resolve - * or reject it. The result is an object with the following properties: - * - `promise` Eventual value representation implementing CommonJS [Promises/A] - * (http://wiki.commonjs.org/wiki/Promises/A) API. - * - `resolve` Single shot function that resolves enclosed `promise` with a - * given `value`. - * - `reject` Single shot function that rejects enclosed `promise` with a given - * `reason`. - * - * An optional `prototype` argument is used as a prototype of the returned - * `promise` allowing one to implement additional API. If prototype is not - * passed then it falls back to `Object.prototype`. - * - * ## Example - * - * function fetchURI(uri, type) { - * var deferred = defer(); - * var request = new XMLHttpRequest(); - * request.open("GET", uri, true); - * request.responseType = type; - * request.onload = function onload() { - * deferred.resolve(request.response); - * } - * request.onerror = function(event) { - * deferred.reject(event); - * } - * request.send(); - * - * return deferred.promise; - * } - */ -function defer(prototype) { - // Define FIFO queue of observer pairs. Once promise is resolved & all queued - // observers are forwarded to `result` and variable is set to `null`. - var observers = []; - - // Promise `result`, which will be assigned a resolution value once promise - // is resolved. Note that result will always be assigned promise (or alike) - // object to take care of propagation through promise chains. If result is - // `null` promise is not resolved yet. - var result = null; - - prototype = (prototype || prototype === null) ? prototype : Object.prototype; - - // Create an object implementing promise API. - var promise = Object.create(prototype, { - then: { value: function then(onFulfill, onError) { - var deferred = defer(prototype); - - function resolve(value) { - // If `onFulfill` handler is provided resolve `deferred.promise` with - // result of invoking it with a resolution value. If handler is not - // provided propagate value through. - try { - deferred.resolve(onFulfill ? onFulfill(value) : value); - } - // `onFulfill` may throw exception in which case resulting promise - // is rejected with thrown exception. - catch(error) { - if (exports._reportErrors && typeof(console) === 'object') - console.error(error); - // Note: Following is equivalent of `deferred.reject(error)`, - // we use this shortcut to reduce a stack. - deferred.resolve(rejected(error)); - } - } - - function reject(reason) { - try { - if (onError) deferred.resolve(onError(reason)); - else deferred.resolve(rejected(reason)); - } - catch(error) { - if (exports._reportErrors && typeof(console) === 'object') - console.error(error) - deferred.resolve(rejected(error)); - } - } - - // If enclosed promise (`this.promise`) observers queue is still alive - // enqueue a new observer pair into it. Note that this does not - // necessary means that promise is pending, it may already be resolved, - // but we still have to queue observers to guarantee an order of - // propagation. - if (observers) { - observers.push({ resolve: resolve, reject: reject }); - } - // Otherwise just forward observer pair right to a `result` promise. - else { - result.then(resolve, reject); - } - - return deferred.promise; - }} - }) - - var deferred = { - promise: promise, - /** - * Resolves associated `promise` to a given `value`, unless it's already - * resolved or rejected. Note that resolved promise is not necessary a - * successfully fulfilled. Promise may be resolved with a promise `value` - * in which case `value` promise's fulfillment / rejection will propagate - * up to a promise resolved with `value`. - */ - resolve: function resolve(value) { - if (!result) { - // Store resolution `value` in a `result` as a promise, so that all - // the subsequent handlers can be simply forwarded to it. Since - // `result` will be a promise all the value / error propagation will - // be uniformly taken care of. - result = isPromise(value) ? value : fulfilled(value); - - // Forward already registered observers to a `result` promise in the - // order they were registered. Note that we intentionally dequeue - // observer at a time until queue is exhausted. This makes sure that - // handlers registered as side effect of observer forwarding are - // queued instead of being invoked immediately, guaranteeing FIFO - // order. - while (observers.length) { - var observer = observers.shift(); - result.then(observer.resolve, observer.reject); - } - - // Once `observers` queue is exhausted we `null`-ify it, so that - // new handlers are forwarded straight to the `result`. - observers = null; - } - }, - /** - * Rejects associated `promise` with a given `reason`, unless it's already - * resolved / rejected. This is just a (better performing) convenience - * shortcut for `deferred.resolve(reject(reason))`. - */ - reject: function reject(reason) { - // Note that if promise is resolved that does not necessary means that it - // is successfully fulfilled. Resolution value may be a promise in which - // case its result propagates. In other words if promise `a` is resolved - // with promise `b`, `a` is either fulfilled or rejected depending - // on weather `b` is fulfilled or rejected. Here `deferred.promise` is - // resolved with a promise pre-rejected with a given `reason`, there for - // `deferred.promise` is rejected with a given `reason`. This may feel - // little awkward first, but doing it this way greatly simplifies - // propagation through promise chains. - deferred.resolve(rejected(reason)); - } - }; - - return deferred; -} -exports.defer = defer; - -/** - * Returns a promise resolved to a given `value`. Optionally a second - * `prototype` argument may be provided to be used as a prototype for the - * returned promise. - */ -function resolve(value, prototype) { - var deferred = defer(prototype); - deferred.resolve(value); - return deferred.promise; -} -exports.resolve = resolve; - -/** - * Returns a promise rejected with a given `reason`. Optionally a second - * `prototype` argument may be provided to be used as a prototype for the - * returned promise. - */ -function reject(reason, prototype) { - var deferred = defer(prototype); - deferred.reject(reason); - return deferred.promise; -} -exports.reject = reject; - -var promised = (function() { - // Note: Define shortcuts and utility functions here in order to avoid - // slower property accesses and unnecessary closure creations on each - // call of this popular function. - - var call = Function.call; - var concat = Array.prototype.concat; - - // Utility function that does following: - // execute([ f, self, args...]) => f.apply(self, args) - function execute(args) { return call.apply(call, args) } - - // Utility function that takes promise of `a` array and maybe promise `b` - // as arguments and returns promise for `a.concat(b)`. - function promisedConcat(promises, unknown) { - return promises.then(function(values) { - return resolve(unknown).then(function(value) { - return values.concat([ value ]) - }); - }); - } - - return function promised(f, prototype) { - /** - Returns a wrapped `f`, which when called returns a promise that resolves to - `f(...)` passing all the given arguments to it, which by the way may be - promises. Optionally second `prototype` argument may be provided to be used - a prototype for a returned promise. - - ## Example - - var promise = promised(Array)(1, promise(2), promise(3)) - promise.then(console.log) // => [ 1, 2, 3 ] - **/ - - return function promised() { - // create array of [ f, this, args... ] - return concat.apply([ f, this ], arguments). - // reduce it via `promisedConcat` to get promised array of fulfillments - reduce(promisedConcat, resolve([], prototype)). - // finally map that to promise of `f.apply(this, args...)` - then(execute); - } - } -})(); -exports.promised = promised; - -var all = promised(Array); -exports.all = all; - -}); diff --git a/dom/browser-element/mochitest/browserElement_PrivateBrowsing.js b/dom/browser-element/mochitest/browserElement_PrivateBrowsing.js new file mode 100644 index 000000000000..474670cdfa54 --- /dev/null +++ b/dom/browser-element/mochitest/browserElement_PrivateBrowsing.js @@ -0,0 +1,46 @@ +/* Any copyright is dedicated to the public domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +// Test that the mozprivatebrowsing attribute works. +"use strict"; + +SimpleTest.waitForExplicitFinish(); +browserElementTestHelpers.setEnabledPref(true); +browserElementTestHelpers.addPermission(); + +function createFrame(aIsPrivate) { + var iframe = document.createElement("iframe"); + SpecialPowers.wrap(iframe).mozbrowser = true; + if (aIsPrivate) { + iframe.setAttribute("mozprivatebrowsing", "true"); + } + return iframe; +} + +function createTest(aIsPrivate, aExpected, aNext) { + info("createTest " + aIsPrivate + " " + aExpected); + return new Promise((aResolve) => { + var iframe = createFrame(aIsPrivate); + document.body.appendChild(iframe); + + iframe.addEventListener("mozbrowsershowmodalprompt", function(e) { + is(e.detail.message, aExpected, "Checking localstorage"); + aResolve(); + }); + + iframe.src = "file_browserElement_PrivateBrowsing.html"; + }); +} + +function runTest() { + // We first create a iframe in non private browsing mode, set up some + // localstorage, reopen it to check that we get the previously set value. + // Finally, open it in private browsing mode and check that localstorage + // is clear. + createTest(false, "EMPTY") + .then(() => { return createTest(false, "bar"); }) + .then(() => { return createTest(true, "EMPTY"); }) + .then(SimpleTest.finish); +} + +addEventListener("testready", runTest); diff --git a/dom/browser-element/mochitest/file_browserElement_PrivateBrowsing.html b/dom/browser-element/mochitest/file_browserElement_PrivateBrowsing.html new file mode 100644 index 000000000000..2db63ccf88cc --- /dev/null +++ b/dom/browser-element/mochitest/file_browserElement_PrivateBrowsing.html @@ -0,0 +1,10 @@ + + + + + diff --git a/dom/browser-element/mochitest/mochitest-oop.ini b/dom/browser-element/mochitest/mochitest-oop.ini index 5bcd0239d64c..405687dda6ba 100644 --- a/dom/browser-element/mochitest/mochitest-oop.ini +++ b/dom/browser-element/mochitest/mochitest-oop.ini @@ -59,6 +59,7 @@ skip-if = (toolkit == 'gonk' && !debug) [test_browserElement_oop_OpenWindowRejected.html] skip-if = (toolkit == 'gonk' && !debug) [test_browserElement_oop_Opensearch.html] +[test_browserElement_oop_PrivateBrowsing.html] [test_browserElement_oop_PromptCheck.html] [test_browserElement_oop_PromptConfirm.html] [test_browserElement_oop_PurgeHistory.html] diff --git a/dom/browser-element/mochitest/mochitest.ini b/dom/browser-element/mochitest/mochitest.ini index 9705050f2276..9240a713dc51 100644 --- a/dom/browser-element/mochitest/mochitest.ini +++ b/dom/browser-element/mochitest/mochitest.ini @@ -43,6 +43,7 @@ support-files = browserElement_OpenWindowInFrame.js browserElement_OpenWindowRejected.js browserElement_Opensearch.js + browserElement_PrivateBrowsing.js browserElement_PromptCheck.js browserElement_PromptConfirm.js browserElement_PurgeHistory.js @@ -89,6 +90,7 @@ support-files = file_browserElement_OpenWindowDifferentOrigin.html file_browserElement_OpenWindowInFrame.html file_browserElement_OpenWindowRejected.html + file_browserElement_PrivateBrowsing.html file_browserElement_SecurityChange.html file_browserElement_SetVisibleFrames2_Outer.html file_browserElement_SetVisibleFrames_Inner.html @@ -170,6 +172,7 @@ skip-if = (toolkit == 'gonk' && !debug) [test_browserElement_inproc_OpenWindowRejected.html] skip-if = (toolkit == 'gonk' && !debug) [test_browserElement_inproc_Opensearch.html] +[test_browserElement_inproc_PrivateBrowsing.html] [test_browserElement_inproc_PromptCheck.html] [test_browserElement_inproc_PromptConfirm.html] [test_browserElement_inproc_PurgeHistory.html] diff --git a/dom/browser-element/mochitest/test_browserElement_inproc_PrivateBrowsing.html b/dom/browser-element/mochitest/test_browserElement_inproc_PrivateBrowsing.html new file mode 100644 index 000000000000..0947fd7c71a5 --- /dev/null +++ b/dom/browser-element/mochitest/test_browserElement_inproc_PrivateBrowsing.html @@ -0,0 +1,19 @@ + + + + + Test for Bug 832700 + + + + + +Mozilla Bug 832700 + + + + + diff --git a/dom/browser-element/mochitest/test_browserElement_oop_PrivateBrowsing.html b/dom/browser-element/mochitest/test_browserElement_oop_PrivateBrowsing.html new file mode 100644 index 000000000000..0947fd7c71a5 --- /dev/null +++ b/dom/browser-element/mochitest/test_browserElement_oop_PrivateBrowsing.html @@ -0,0 +1,19 @@ + + + + + Test for Bug 832700 + + + + + +Mozilla Bug 832700 + + + + + From 89a4374a27556042a59901a6e7583f1069e436d3 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Fri, 10 Oct 2014 17:15:53 -0700 Subject: [PATCH 03/13] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/2f42b3d93975 Author: Michael Henretty Desc: Merge pull request #25042 from mikehenrty/bug-1074123-part2 Bug 1074123 - Fix update and quick settings dialogs ======== https://hg.mozilla.org/integration/gaia-central/rev/759970ea60aa Author: Michael Henretty Desc: Bug 1074123 - Fix update and quick settings dialogs --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index dd6829c57de1..c1f04b2bde4a 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "a10638edfc562e970fa6062c06edffd581c6f057", + "revision": "2f42b3d939752a945771815852ffe0c5afe71e35", "repo_path": "/integration/gaia-central" } From ddfa8857edd693c14e974b8c1096435101cbb593 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Fri, 10 Oct 2014 17:17:47 -0700 Subject: [PATCH 04/13] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 78657e016c0d..cb79f89aabaa 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 291b05271f5e..867174b42119 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 9e727b7a2630..f874d97667e0 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index a71525608a03..5898c6e28b23 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 291b05271f5e..867174b42119 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 850d3796d1ba..b939ba1f0fef 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index b94dfb654ab3..0ccffeb7e3a2 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 8ae609665f29..510054d3776f 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 84f7a7257773..746ebc67a2e4 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 5ce6323d63e6..b5644fcc7f9d 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 76c64162edb6..c44a488bbb3d 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 3cc8623457aefa7df53bc62ae2ff015a934d403e Mon Sep 17 00:00:00 2001 From: Wes Kocher Date: Fri, 10 Oct 2014 18:16:02 -0700 Subject: [PATCH 05/13] Backed out 2 changesets (bug 832700) for mochitest-2 bustage Backed out changeset 9d6312427933 (bug 832700) Backed out changeset 660b7e69fac7 (bug 832700) --- content/base/src/nsGkAtomList.h | 1 - docshell/base/nsDocShell.cpp | 14 - docshell/base/nsDocShell.h | 1 - docshell/base/nsIDocShell.idl | 9 +- dom/browser-element/BrowserElementChild.js | 7 - dom/browser-element/BrowserElementParent.cpp | 8 - dom/browser-element/BrowserElementParent.jsm | 3 +- .../mochitest/browserElementTestHelpers.js | 273 ++++++++++++++++++ .../browserElement_PrivateBrowsing.js | 46 --- .../file_browserElement_PrivateBrowsing.html | 10 - .../mochitest/mochitest-oop.ini | 1 - dom/browser-element/mochitest/mochitest.ini | 3 - ...browserElement_inproc_PrivateBrowsing.html | 19 -- ...st_browserElement_oop_PrivateBrowsing.html | 19 -- 14 files changed, 275 insertions(+), 139 deletions(-) delete mode 100644 dom/browser-element/mochitest/browserElement_PrivateBrowsing.js delete mode 100644 dom/browser-element/mochitest/file_browserElement_PrivateBrowsing.html delete mode 100644 dom/browser-element/mochitest/test_browserElement_inproc_PrivateBrowsing.html delete mode 100644 dom/browser-element/mochitest/test_browserElement_oop_PrivateBrowsing.html diff --git a/content/base/src/nsGkAtomList.h b/content/base/src/nsGkAtomList.h index 53162fee49c9..a680b6c381b4 100644 --- a/content/base/src/nsGkAtomList.h +++ b/content/base/src/nsGkAtomList.h @@ -609,7 +609,6 @@ GK_ATOM(mozfullscreenerror, "mozfullscreenerror") GK_ATOM(mozpasspointerevents, "mozpasspointerevents") GK_ATOM(mozpointerlockchange, "mozpointerlockchange") GK_ATOM(mozpointerlockerror, "mozpointerlockerror") -GK_ATOM(mozprivatebrowsing, "mozprivatebrowsing") GK_ATOM(moz_opaque, "moz-opaque") GK_ATOM(moz_action_hint, "mozactionhint") GK_ATOM(x_moz_errormessage, "x-moz-errormessage") diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 94d3d12a7875..f7e1d7df4a3a 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -851,7 +851,6 @@ nsDocShell::nsDocShell(): #endif mAffectPrivateSessionLifetime(true), mInvisible(false), - mHasLoadedNonBlankURI(false), mDefaultLoadFlags(nsIRequest::LOAD_NORMAL), mFrameType(eFrameTypeRegular), mOwnOrContainingAppId(nsIScriptSecurityManager::UNKNOWN_APP_ID), @@ -1929,10 +1928,6 @@ nsDocShell::SetCurrentURI(nsIURI *aURI, nsIRequest *aRequest, mCurrentURI = NS_TryToMakeImmutable(aURI); - if (!NS_IsAboutBlank(mCurrentURI)) { - mHasLoadedNonBlankURI = true; - } - bool isRoot = false; // Is this the root docshell bool isSubFrame = false; // Is this a subframe navigation? @@ -2282,15 +2277,6 @@ nsDocShell::SetPrivateBrowsing(bool aUsePrivateBrowsing) return NS_OK; } -NS_IMETHODIMP -nsDocShell::GetHasLoadedNonBlankURI(bool* aResult) -{ - NS_ENSURE_ARG_POINTER(aResult); - - *aResult = mHasLoadedNonBlankURI; - return NS_OK; -} - NS_IMETHODIMP nsDocShell::GetUseRemoteTabs(bool* aUseRemoteTabs) { diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index d9a82abe4f70..eda8f2215584 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -915,7 +915,6 @@ protected: #endif bool mAffectPrivateSessionLifetime; bool mInvisible; - bool mHasLoadedNonBlankURI; uint64_t mHistoryID; uint32_t mDefaultLoadFlags; diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl index cf81b57427e8..02c07d548dd4 100644 --- a/docshell/base/nsIDocShell.idl +++ b/docshell/base/nsIDocShell.idl @@ -54,7 +54,7 @@ interface nsITabParent; typedef unsigned long nsLoadFlags; -[scriptable, builtinclass, uuid(23157a63-26fd-44a0-a0f9-fdc64dcc004c)] +[scriptable, builtinclass, uuid(2b8e4a50-7744-454d-a05b-debead8070fe)] interface nsIDocShell : nsIDocShellTreeItem { /** @@ -1017,11 +1017,4 @@ interface nsIDocShell : nsIDocShellTreeItem // URLSearchParams for the window.location is owned by the docShell. [noscript,notxpcom] URLSearchParams getURLSearchParams(); - - /** - * This attribute determines whether a document which is not about:blank has - * already be loaded by this docShell. - */ - [infallible] readonly attribute boolean hasLoadedNonBlankURI; - }; diff --git a/dom/browser-element/BrowserElementChild.js b/dom/browser-element/BrowserElementChild.js index 2c140ea7bb1d..aa06587c95fa 100644 --- a/dom/browser-element/BrowserElementChild.js +++ b/dom/browser-element/BrowserElementChild.js @@ -56,10 +56,3 @@ let infos = sendSyncMessage('browser-element-api:call', { 'msg_name': 'hello' })[0]; docShell.QueryInterface(Ci.nsIDocShellTreeItem).name = infos.name; docShell.setFullscreenAllowed(infos.fullscreenAllowed); -if (infos.isPrivate) { - if (!docShell.hasLoadedNonBlankURI) { - Cu.reportError("We should not switch to Private Browsing after loading a document."); - } else { - docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = true; - } -} diff --git a/dom/browser-element/BrowserElementParent.cpp b/dom/browser-element/BrowserElementParent.cpp index 83f5057ba4d7..62ca3c119d1d 100644 --- a/dom/browser-element/BrowserElementParent.cpp +++ b/dom/browser-element/BrowserElementParent.cpp @@ -76,14 +76,6 @@ CreateIframe(Element* aOpenerFrameElement, const nsAString& aName, bool aRemote) NS_LITERAL_STRING("false"), /* aNotify = */ false); - // Copy the opener frame's mozprivatebrowsing attribute to the popup frame. - nsAutoString mozprivatebrowsing; - if (aOpenerFrameElement->GetAttr(kNameSpaceID_None, nsGkAtoms::mozprivatebrowsing, - mozprivatebrowsing)) { - popupFrameElement->SetAttr(kNameSpaceID_None, nsGkAtoms::mozprivatebrowsing, - mozprivatebrowsing, /* aNotify = */ false); - } - return popupFrameElement.forget(); } diff --git a/dom/browser-element/BrowserElementParent.jsm b/dom/browser-element/BrowserElementParent.jsm index 3a7124be8001..066c59a040a8 100644 --- a/dom/browser-element/BrowserElementParent.jsm +++ b/dom/browser-element/BrowserElementParent.jsm @@ -389,8 +389,7 @@ BrowserElementParent.prototype = { name: this._frameElement.getAttribute('name'), fullscreenAllowed: this._frameElement.hasAttribute('allowfullscreen') || - this._frameElement.hasAttribute('mozallowfullscreen'), - isPrivate: this._frameElement.hasAttribute('mozprivatebrowsing') + this._frameElement.hasAttribute('mozallowfullscreen') }; }, diff --git a/dom/browser-element/mochitest/browserElementTestHelpers.js b/dom/browser-element/mochitest/browserElementTestHelpers.js index 954f21151fec..547675e164d4 100644 --- a/dom/browser-element/mochitest/browserElementTestHelpers.js +++ b/dom/browser-element/mochitest/browserElementTestHelpers.js @@ -303,3 +303,276 @@ browserElementTestHelpers.lockTestReady(); addEventListener('load', function() { SimpleTest.executeSoon(browserElementTestHelpers.unlockTestReady.bind(browserElementTestHelpers)); }); + +////////////////////////////////// +// promise.js from the addon SDK with some modifications to the module +// boilerplate. +////////////////////////////////// + +;(function(id, factory) { // Module boilerplate :( + var globals = this; + factory(function require(id) { + return globals[id]; + }, (globals[id] = {}), { uri: document.location.href + '#' + id, id: id }); +}).call(this, 'Promise', function Promise(require, exports, module) { + +'use strict'; + +module.metadata = { + "stability": "unstable" +}; + +/** + * Internal utility: Wraps given `value` into simplified promise, successfully + * fulfilled to a given `value`. Note the result is not a complete promise + * implementation, as its method `then` does not returns anything. + */ +function fulfilled(value) { + return { then: function then(fulfill) { fulfill(value); } }; +} + +/** + * Internal utility: Wraps given input into simplified promise, pre-rejected + * with a given `reason`. Note the result is not a complete promise + * implementation, as its method `then` does not returns anything. + */ +function rejected(reason) { + return { then: function then(fulfill, reject) { reject(reason); } }; +} + +/** + * Internal utility: Returns `true` if given `value` is a promise. Value is + * assumed to be a promise if it implements method `then`. + */ +function isPromise(value) { + return value && typeof(value.then) === 'function'; +} + +/** + * Creates deferred object containing fresh promise & methods to either resolve + * or reject it. The result is an object with the following properties: + * - `promise` Eventual value representation implementing CommonJS [Promises/A] + * (http://wiki.commonjs.org/wiki/Promises/A) API. + * - `resolve` Single shot function that resolves enclosed `promise` with a + * given `value`. + * - `reject` Single shot function that rejects enclosed `promise` with a given + * `reason`. + * + * An optional `prototype` argument is used as a prototype of the returned + * `promise` allowing one to implement additional API. If prototype is not + * passed then it falls back to `Object.prototype`. + * + * ## Example + * + * function fetchURI(uri, type) { + * var deferred = defer(); + * var request = new XMLHttpRequest(); + * request.open("GET", uri, true); + * request.responseType = type; + * request.onload = function onload() { + * deferred.resolve(request.response); + * } + * request.onerror = function(event) { + * deferred.reject(event); + * } + * request.send(); + * + * return deferred.promise; + * } + */ +function defer(prototype) { + // Define FIFO queue of observer pairs. Once promise is resolved & all queued + // observers are forwarded to `result` and variable is set to `null`. + var observers = []; + + // Promise `result`, which will be assigned a resolution value once promise + // is resolved. Note that result will always be assigned promise (or alike) + // object to take care of propagation through promise chains. If result is + // `null` promise is not resolved yet. + var result = null; + + prototype = (prototype || prototype === null) ? prototype : Object.prototype; + + // Create an object implementing promise API. + var promise = Object.create(prototype, { + then: { value: function then(onFulfill, onError) { + var deferred = defer(prototype); + + function resolve(value) { + // If `onFulfill` handler is provided resolve `deferred.promise` with + // result of invoking it with a resolution value. If handler is not + // provided propagate value through. + try { + deferred.resolve(onFulfill ? onFulfill(value) : value); + } + // `onFulfill` may throw exception in which case resulting promise + // is rejected with thrown exception. + catch(error) { + if (exports._reportErrors && typeof(console) === 'object') + console.error(error); + // Note: Following is equivalent of `deferred.reject(error)`, + // we use this shortcut to reduce a stack. + deferred.resolve(rejected(error)); + } + } + + function reject(reason) { + try { + if (onError) deferred.resolve(onError(reason)); + else deferred.resolve(rejected(reason)); + } + catch(error) { + if (exports._reportErrors && typeof(console) === 'object') + console.error(error) + deferred.resolve(rejected(error)); + } + } + + // If enclosed promise (`this.promise`) observers queue is still alive + // enqueue a new observer pair into it. Note that this does not + // necessary means that promise is pending, it may already be resolved, + // but we still have to queue observers to guarantee an order of + // propagation. + if (observers) { + observers.push({ resolve: resolve, reject: reject }); + } + // Otherwise just forward observer pair right to a `result` promise. + else { + result.then(resolve, reject); + } + + return deferred.promise; + }} + }) + + var deferred = { + promise: promise, + /** + * Resolves associated `promise` to a given `value`, unless it's already + * resolved or rejected. Note that resolved promise is not necessary a + * successfully fulfilled. Promise may be resolved with a promise `value` + * in which case `value` promise's fulfillment / rejection will propagate + * up to a promise resolved with `value`. + */ + resolve: function resolve(value) { + if (!result) { + // Store resolution `value` in a `result` as a promise, so that all + // the subsequent handlers can be simply forwarded to it. Since + // `result` will be a promise all the value / error propagation will + // be uniformly taken care of. + result = isPromise(value) ? value : fulfilled(value); + + // Forward already registered observers to a `result` promise in the + // order they were registered. Note that we intentionally dequeue + // observer at a time until queue is exhausted. This makes sure that + // handlers registered as side effect of observer forwarding are + // queued instead of being invoked immediately, guaranteeing FIFO + // order. + while (observers.length) { + var observer = observers.shift(); + result.then(observer.resolve, observer.reject); + } + + // Once `observers` queue is exhausted we `null`-ify it, so that + // new handlers are forwarded straight to the `result`. + observers = null; + } + }, + /** + * Rejects associated `promise` with a given `reason`, unless it's already + * resolved / rejected. This is just a (better performing) convenience + * shortcut for `deferred.resolve(reject(reason))`. + */ + reject: function reject(reason) { + // Note that if promise is resolved that does not necessary means that it + // is successfully fulfilled. Resolution value may be a promise in which + // case its result propagates. In other words if promise `a` is resolved + // with promise `b`, `a` is either fulfilled or rejected depending + // on weather `b` is fulfilled or rejected. Here `deferred.promise` is + // resolved with a promise pre-rejected with a given `reason`, there for + // `deferred.promise` is rejected with a given `reason`. This may feel + // little awkward first, but doing it this way greatly simplifies + // propagation through promise chains. + deferred.resolve(rejected(reason)); + } + }; + + return deferred; +} +exports.defer = defer; + +/** + * Returns a promise resolved to a given `value`. Optionally a second + * `prototype` argument may be provided to be used as a prototype for the + * returned promise. + */ +function resolve(value, prototype) { + var deferred = defer(prototype); + deferred.resolve(value); + return deferred.promise; +} +exports.resolve = resolve; + +/** + * Returns a promise rejected with a given `reason`. Optionally a second + * `prototype` argument may be provided to be used as a prototype for the + * returned promise. + */ +function reject(reason, prototype) { + var deferred = defer(prototype); + deferred.reject(reason); + return deferred.promise; +} +exports.reject = reject; + +var promised = (function() { + // Note: Define shortcuts and utility functions here in order to avoid + // slower property accesses and unnecessary closure creations on each + // call of this popular function. + + var call = Function.call; + var concat = Array.prototype.concat; + + // Utility function that does following: + // execute([ f, self, args...]) => f.apply(self, args) + function execute(args) { return call.apply(call, args) } + + // Utility function that takes promise of `a` array and maybe promise `b` + // as arguments and returns promise for `a.concat(b)`. + function promisedConcat(promises, unknown) { + return promises.then(function(values) { + return resolve(unknown).then(function(value) { + return values.concat([ value ]) + }); + }); + } + + return function promised(f, prototype) { + /** + Returns a wrapped `f`, which when called returns a promise that resolves to + `f(...)` passing all the given arguments to it, which by the way may be + promises. Optionally second `prototype` argument may be provided to be used + a prototype for a returned promise. + + ## Example + + var promise = promised(Array)(1, promise(2), promise(3)) + promise.then(console.log) // => [ 1, 2, 3 ] + **/ + + return function promised() { + // create array of [ f, this, args... ] + return concat.apply([ f, this ], arguments). + // reduce it via `promisedConcat` to get promised array of fulfillments + reduce(promisedConcat, resolve([], prototype)). + // finally map that to promise of `f.apply(this, args...)` + then(execute); + } + } +})(); +exports.promised = promised; + +var all = promised(Array); +exports.all = all; + +}); diff --git a/dom/browser-element/mochitest/browserElement_PrivateBrowsing.js b/dom/browser-element/mochitest/browserElement_PrivateBrowsing.js deleted file mode 100644 index 474670cdfa54..000000000000 --- a/dom/browser-element/mochitest/browserElement_PrivateBrowsing.js +++ /dev/null @@ -1,46 +0,0 @@ -/* Any copyright is dedicated to the public domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Test that the mozprivatebrowsing attribute works. -"use strict"; - -SimpleTest.waitForExplicitFinish(); -browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); - -function createFrame(aIsPrivate) { - var iframe = document.createElement("iframe"); - SpecialPowers.wrap(iframe).mozbrowser = true; - if (aIsPrivate) { - iframe.setAttribute("mozprivatebrowsing", "true"); - } - return iframe; -} - -function createTest(aIsPrivate, aExpected, aNext) { - info("createTest " + aIsPrivate + " " + aExpected); - return new Promise((aResolve) => { - var iframe = createFrame(aIsPrivate); - document.body.appendChild(iframe); - - iframe.addEventListener("mozbrowsershowmodalprompt", function(e) { - is(e.detail.message, aExpected, "Checking localstorage"); - aResolve(); - }); - - iframe.src = "file_browserElement_PrivateBrowsing.html"; - }); -} - -function runTest() { - // We first create a iframe in non private browsing mode, set up some - // localstorage, reopen it to check that we get the previously set value. - // Finally, open it in private browsing mode and check that localstorage - // is clear. - createTest(false, "EMPTY") - .then(() => { return createTest(false, "bar"); }) - .then(() => { return createTest(true, "EMPTY"); }) - .then(SimpleTest.finish); -} - -addEventListener("testready", runTest); diff --git a/dom/browser-element/mochitest/file_browserElement_PrivateBrowsing.html b/dom/browser-element/mochitest/file_browserElement_PrivateBrowsing.html deleted file mode 100644 index 2db63ccf88cc..000000000000 --- a/dom/browser-element/mochitest/file_browserElement_PrivateBrowsing.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - diff --git a/dom/browser-element/mochitest/mochitest-oop.ini b/dom/browser-element/mochitest/mochitest-oop.ini index 405687dda6ba..5bcd0239d64c 100644 --- a/dom/browser-element/mochitest/mochitest-oop.ini +++ b/dom/browser-element/mochitest/mochitest-oop.ini @@ -59,7 +59,6 @@ skip-if = (toolkit == 'gonk' && !debug) [test_browserElement_oop_OpenWindowRejected.html] skip-if = (toolkit == 'gonk' && !debug) [test_browserElement_oop_Opensearch.html] -[test_browserElement_oop_PrivateBrowsing.html] [test_browserElement_oop_PromptCheck.html] [test_browserElement_oop_PromptConfirm.html] [test_browserElement_oop_PurgeHistory.html] diff --git a/dom/browser-element/mochitest/mochitest.ini b/dom/browser-element/mochitest/mochitest.ini index 9240a713dc51..9705050f2276 100644 --- a/dom/browser-element/mochitest/mochitest.ini +++ b/dom/browser-element/mochitest/mochitest.ini @@ -43,7 +43,6 @@ support-files = browserElement_OpenWindowInFrame.js browserElement_OpenWindowRejected.js browserElement_Opensearch.js - browserElement_PrivateBrowsing.js browserElement_PromptCheck.js browserElement_PromptConfirm.js browserElement_PurgeHistory.js @@ -90,7 +89,6 @@ support-files = file_browserElement_OpenWindowDifferentOrigin.html file_browserElement_OpenWindowInFrame.html file_browserElement_OpenWindowRejected.html - file_browserElement_PrivateBrowsing.html file_browserElement_SecurityChange.html file_browserElement_SetVisibleFrames2_Outer.html file_browserElement_SetVisibleFrames_Inner.html @@ -172,7 +170,6 @@ skip-if = (toolkit == 'gonk' && !debug) [test_browserElement_inproc_OpenWindowRejected.html] skip-if = (toolkit == 'gonk' && !debug) [test_browserElement_inproc_Opensearch.html] -[test_browserElement_inproc_PrivateBrowsing.html] [test_browserElement_inproc_PromptCheck.html] [test_browserElement_inproc_PromptConfirm.html] [test_browserElement_inproc_PurgeHistory.html] diff --git a/dom/browser-element/mochitest/test_browserElement_inproc_PrivateBrowsing.html b/dom/browser-element/mochitest/test_browserElement_inproc_PrivateBrowsing.html deleted file mode 100644 index 0947fd7c71a5..000000000000 --- a/dom/browser-element/mochitest/test_browserElement_inproc_PrivateBrowsing.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - Test for Bug 832700 - - - - - -Mozilla Bug 832700 - - - - - diff --git a/dom/browser-element/mochitest/test_browserElement_oop_PrivateBrowsing.html b/dom/browser-element/mochitest/test_browserElement_oop_PrivateBrowsing.html deleted file mode 100644 index 0947fd7c71a5..000000000000 --- a/dom/browser-element/mochitest/test_browserElement_oop_PrivateBrowsing.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - Test for Bug 832700 - - - - - -Mozilla Bug 832700 - - - - - From 8a8d28193a9b08b4b518326f797bbbcf4ececbc4 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Fri, 10 Oct 2014 22:16:03 -0400 Subject: [PATCH 06/13] Bug 1078373 - Use the scrollPositionClampingScrollPortSize when computing whether or not to show the scrollbar. r=tn --- layout/generic/nsGfxScrollFrame.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 0a34ac21b137..1d1989bb37ea 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -351,6 +351,11 @@ nsHTMLScrollFrame::TryLayout(ScrollReflowState* aState, ComputeInsideBorderSize(aState, desiredInsideBorderSize); nsSize scrollPortSize = nsSize(std::max(0, aState->mInsideBorderSize.width - vScrollbarDesiredWidth), std::max(0, aState->mInsideBorderSize.height - hScrollbarDesiredHeight)); + nsSize visualScrollPortSize = scrollPortSize; + nsIPresShell* presShell = PresContext()->PresShell(); + if (mHelper.mIsRoot && presShell->IsScrollPositionClampingScrollPortSizeSet()) { + visualScrollPortSize = presShell->GetScrollPositionClampingScrollPortSize(); + } if (!aForce) { nsRect scrolledRect = @@ -362,7 +367,7 @@ nsHTMLScrollFrame::TryLayout(ScrollReflowState* aState, if (aState->mStyles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN) { bool wantHScrollbar = aState->mStyles.mHorizontal == NS_STYLE_OVERFLOW_SCROLL || - scrolledRect.XMost() >= scrollPortSize.width + oneDevPixel || + scrolledRect.XMost() >= visualScrollPortSize.width + oneDevPixel || scrolledRect.x <= -oneDevPixel; if (scrollPortSize.width < hScrollbarMinSize.width) wantHScrollbar = false; @@ -374,7 +379,7 @@ nsHTMLScrollFrame::TryLayout(ScrollReflowState* aState, if (aState->mStyles.mVertical != NS_STYLE_OVERFLOW_HIDDEN) { bool wantVScrollbar = aState->mStyles.mVertical == NS_STYLE_OVERFLOW_SCROLL || - scrolledRect.YMost() >= scrollPortSize.height + oneDevPixel || + scrolledRect.YMost() >= visualScrollPortSize.height + oneDevPixel || scrolledRect.y <= -oneDevPixel; if (scrollPortSize.height < vScrollbarMinSize.height) wantVScrollbar = false; From efee2d07c4ffdf26e172f2df0681f02be5756fa1 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Fri, 10 Oct 2014 20:05:46 -0700 Subject: [PATCH 07/13] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/47459a0d67fa Author: Andrew Sutherland Desc: Merge pull request #24927 from asutherland/email-getbody-fix Bug 1070429 - [email/IMAP] premature saving leads to missing bodies. r=jrburke propagation of mozilla-b2g/gaia-email-libs-and-more#343 ======== https://hg.mozilla.org/integration/gaia-central/rev/7c12bf285d25 Author: Andrew Sutherland Desc: Bug 1070429 - [email/IMAP] premature saving leads to missing bodies. r=jrburke propagate back-end fix https://github.com/mozilla-b2g/gaia-email-libs-and-more/pull/343 --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index c1f04b2bde4a..f51835ff7178 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "2f42b3d939752a945771815852ffe0c5afe71e35", + "revision": "47459a0d67fae95c221568ef03c773b8cb5b92a7", "repo_path": "/integration/gaia-central" } From 4e0810132c742f9d7cd48d80122c2717194364aa Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Fri, 10 Oct 2014 20:07:32 -0700 Subject: [PATCH 08/13] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index cb79f89aabaa..0bf226b2460c 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 867174b42119..2f03acc1227d 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index f874d97667e0..3ab73d986732 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 5898c6e28b23..3ebb185798b3 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 867174b42119..2f03acc1227d 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index b939ba1f0fef..475ad206a739 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 0ccffeb7e3a2..733573f9bdb0 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 510054d3776f..146cc55c538f 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 746ebc67a2e4..fbeb4472afc3 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index b5644fcc7f9d..dea7976701f1 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index c44a488bbb3d..c6370122c492 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From b71af9adca33032c6a685deb390845ac50b2997e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabrice=20Desr=C3=A9?= Date: Fri, 10 Oct 2014 14:28:04 -0700 Subject: [PATCH 09/13] Bug 832700 - Add private browsing to b2g, API implementation r=ehsan,smaug --- content/base/src/nsGkAtomList.h | 1 + docshell/base/nsDocShell.cpp | 14 ++++++++++++++ docshell/base/nsDocShell.h | 1 + docshell/base/nsIDocShell.idl | 9 ++++++++- dom/browser-element/BrowserElementChild.js | 7 +++++++ dom/browser-element/BrowserElementParent.cpp | 8 ++++++++ dom/browser-element/BrowserElementParent.jsm | 3 ++- 7 files changed, 41 insertions(+), 2 deletions(-) diff --git a/content/base/src/nsGkAtomList.h b/content/base/src/nsGkAtomList.h index a680b6c381b4..53162fee49c9 100644 --- a/content/base/src/nsGkAtomList.h +++ b/content/base/src/nsGkAtomList.h @@ -609,6 +609,7 @@ GK_ATOM(mozfullscreenerror, "mozfullscreenerror") GK_ATOM(mozpasspointerevents, "mozpasspointerevents") GK_ATOM(mozpointerlockchange, "mozpointerlockchange") GK_ATOM(mozpointerlockerror, "mozpointerlockerror") +GK_ATOM(mozprivatebrowsing, "mozprivatebrowsing") GK_ATOM(moz_opaque, "moz-opaque") GK_ATOM(moz_action_hint, "mozactionhint") GK_ATOM(x_moz_errormessage, "x-moz-errormessage") diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index f7e1d7df4a3a..94d3d12a7875 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -851,6 +851,7 @@ nsDocShell::nsDocShell(): #endif mAffectPrivateSessionLifetime(true), mInvisible(false), + mHasLoadedNonBlankURI(false), mDefaultLoadFlags(nsIRequest::LOAD_NORMAL), mFrameType(eFrameTypeRegular), mOwnOrContainingAppId(nsIScriptSecurityManager::UNKNOWN_APP_ID), @@ -1928,6 +1929,10 @@ nsDocShell::SetCurrentURI(nsIURI *aURI, nsIRequest *aRequest, mCurrentURI = NS_TryToMakeImmutable(aURI); + if (!NS_IsAboutBlank(mCurrentURI)) { + mHasLoadedNonBlankURI = true; + } + bool isRoot = false; // Is this the root docshell bool isSubFrame = false; // Is this a subframe navigation? @@ -2277,6 +2282,15 @@ nsDocShell::SetPrivateBrowsing(bool aUsePrivateBrowsing) return NS_OK; } +NS_IMETHODIMP +nsDocShell::GetHasLoadedNonBlankURI(bool* aResult) +{ + NS_ENSURE_ARG_POINTER(aResult); + + *aResult = mHasLoadedNonBlankURI; + return NS_OK; +} + NS_IMETHODIMP nsDocShell::GetUseRemoteTabs(bool* aUseRemoteTabs) { diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index eda8f2215584..d9a82abe4f70 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -915,6 +915,7 @@ protected: #endif bool mAffectPrivateSessionLifetime; bool mInvisible; + bool mHasLoadedNonBlankURI; uint64_t mHistoryID; uint32_t mDefaultLoadFlags; diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl index 02c07d548dd4..cf81b57427e8 100644 --- a/docshell/base/nsIDocShell.idl +++ b/docshell/base/nsIDocShell.idl @@ -54,7 +54,7 @@ interface nsITabParent; typedef unsigned long nsLoadFlags; -[scriptable, builtinclass, uuid(2b8e4a50-7744-454d-a05b-debead8070fe)] +[scriptable, builtinclass, uuid(23157a63-26fd-44a0-a0f9-fdc64dcc004c)] interface nsIDocShell : nsIDocShellTreeItem { /** @@ -1017,4 +1017,11 @@ interface nsIDocShell : nsIDocShellTreeItem // URLSearchParams for the window.location is owned by the docShell. [noscript,notxpcom] URLSearchParams getURLSearchParams(); + + /** + * This attribute determines whether a document which is not about:blank has + * already be loaded by this docShell. + */ + [infallible] readonly attribute boolean hasLoadedNonBlankURI; + }; diff --git a/dom/browser-element/BrowserElementChild.js b/dom/browser-element/BrowserElementChild.js index aa06587c95fa..4996b178e0f9 100644 --- a/dom/browser-element/BrowserElementChild.js +++ b/dom/browser-element/BrowserElementChild.js @@ -56,3 +56,10 @@ let infos = sendSyncMessage('browser-element-api:call', { 'msg_name': 'hello' })[0]; docShell.QueryInterface(Ci.nsIDocShellTreeItem).name = infos.name; docShell.setFullscreenAllowed(infos.fullscreenAllowed); +if (infos.isPrivate) { + if (docShell.hasLoadedNonBlankURI) { + Cu.reportError("We should not switch to Private Browsing after loading a document."); + } else { + docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = true; + } +} diff --git a/dom/browser-element/BrowserElementParent.cpp b/dom/browser-element/BrowserElementParent.cpp index 62ca3c119d1d..83f5057ba4d7 100644 --- a/dom/browser-element/BrowserElementParent.cpp +++ b/dom/browser-element/BrowserElementParent.cpp @@ -76,6 +76,14 @@ CreateIframe(Element* aOpenerFrameElement, const nsAString& aName, bool aRemote) NS_LITERAL_STRING("false"), /* aNotify = */ false); + // Copy the opener frame's mozprivatebrowsing attribute to the popup frame. + nsAutoString mozprivatebrowsing; + if (aOpenerFrameElement->GetAttr(kNameSpaceID_None, nsGkAtoms::mozprivatebrowsing, + mozprivatebrowsing)) { + popupFrameElement->SetAttr(kNameSpaceID_None, nsGkAtoms::mozprivatebrowsing, + mozprivatebrowsing, /* aNotify = */ false); + } + return popupFrameElement.forget(); } diff --git a/dom/browser-element/BrowserElementParent.jsm b/dom/browser-element/BrowserElementParent.jsm index 066c59a040a8..3a7124be8001 100644 --- a/dom/browser-element/BrowserElementParent.jsm +++ b/dom/browser-element/BrowserElementParent.jsm @@ -389,7 +389,8 @@ BrowserElementParent.prototype = { name: this._frameElement.getAttribute('name'), fullscreenAllowed: this._frameElement.hasAttribute('allowfullscreen') || - this._frameElement.hasAttribute('mozallowfullscreen') + this._frameElement.hasAttribute('mozallowfullscreen'), + isPrivate: this._frameElement.hasAttribute('mozprivatebrowsing') }; }, From 6175b90e9f4d98ef7a7ec18437067babdda17156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabrice=20Desr=C3=A9?= Date: Fri, 10 Oct 2014 14:28:04 -0700 Subject: [PATCH 10/13] Bug 832700 - Add private browsing to b2g, tests r=smaug --- .../browserElement_PrivateBrowsing.js | 48 +++++++++++++++++++ .../file_browserElement_PrivateBrowsing.html | 10 ++++ .../mochitest/mochitest-oop.ini | 1 + dom/browser-element/mochitest/mochitest.ini | 3 ++ ...browserElement_inproc_PrivateBrowsing.html | 19 ++++++++ ...st_browserElement_oop_PrivateBrowsing.html | 19 ++++++++ 6 files changed, 100 insertions(+) create mode 100644 dom/browser-element/mochitest/browserElement_PrivateBrowsing.js create mode 100644 dom/browser-element/mochitest/file_browserElement_PrivateBrowsing.html create mode 100644 dom/browser-element/mochitest/test_browserElement_inproc_PrivateBrowsing.html create mode 100644 dom/browser-element/mochitest/test_browserElement_oop_PrivateBrowsing.html diff --git a/dom/browser-element/mochitest/browserElement_PrivateBrowsing.js b/dom/browser-element/mochitest/browserElement_PrivateBrowsing.js new file mode 100644 index 000000000000..2f4421d7ed3d --- /dev/null +++ b/dom/browser-element/mochitest/browserElement_PrivateBrowsing.js @@ -0,0 +1,48 @@ +/* Any copyright is dedicated to the public domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +// Test that the mozprivatebrowsing attribute works. +"use strict"; + +SimpleTest.waitForExplicitFinish(); +browserElementTestHelpers.setEnabledPref(true); +browserElementTestHelpers.addPermission(); + +function createFrame(aIsPrivate) { + var iframe = document.createElement("iframe"); + SpecialPowers.wrap(iframe).mozbrowser = true; + if (aIsPrivate) { + iframe.setAttribute("mozprivatebrowsing", "true"); + } + return iframe; +} + +function createTest(aIsPrivate, aExpected, aNext) { + info("createTest " + aIsPrivate + " " + aExpected); + var deferred = Promise.defer(); + + var iframe = createFrame(aIsPrivate); + document.body.appendChild(iframe); + + iframe.addEventListener("mozbrowsershowmodalprompt", function(e) { + is(e.detail.message, aExpected, "Checking localstorage"); + deferred.resolve(); + }); + + iframe.src = "file_browserElement_PrivateBrowsing.html"; + + return deferred.promise; +} + +function runTest() { + // We first create a iframe in non private browsing mode, set up some + // localstorage, reopen it to check that we get the previously set value. + // Finally, open it in private browsing mode and check that localstorage + // is clear. + createTest(false, "EMPTY") + .then(() => { return createTest(false, "bar"); }) + .then(() => { return createTest(true, "EMPTY"); }) + .then(SimpleTest.finish); +} + +addEventListener("testready", runTest); diff --git a/dom/browser-element/mochitest/file_browserElement_PrivateBrowsing.html b/dom/browser-element/mochitest/file_browserElement_PrivateBrowsing.html new file mode 100644 index 000000000000..2db63ccf88cc --- /dev/null +++ b/dom/browser-element/mochitest/file_browserElement_PrivateBrowsing.html @@ -0,0 +1,10 @@ + + + + + diff --git a/dom/browser-element/mochitest/mochitest-oop.ini b/dom/browser-element/mochitest/mochitest-oop.ini index 5bcd0239d64c..405687dda6ba 100644 --- a/dom/browser-element/mochitest/mochitest-oop.ini +++ b/dom/browser-element/mochitest/mochitest-oop.ini @@ -59,6 +59,7 @@ skip-if = (toolkit == 'gonk' && !debug) [test_browserElement_oop_OpenWindowRejected.html] skip-if = (toolkit == 'gonk' && !debug) [test_browserElement_oop_Opensearch.html] +[test_browserElement_oop_PrivateBrowsing.html] [test_browserElement_oop_PromptCheck.html] [test_browserElement_oop_PromptConfirm.html] [test_browserElement_oop_PurgeHistory.html] diff --git a/dom/browser-element/mochitest/mochitest.ini b/dom/browser-element/mochitest/mochitest.ini index 9705050f2276..9240a713dc51 100644 --- a/dom/browser-element/mochitest/mochitest.ini +++ b/dom/browser-element/mochitest/mochitest.ini @@ -43,6 +43,7 @@ support-files = browserElement_OpenWindowInFrame.js browserElement_OpenWindowRejected.js browserElement_Opensearch.js + browserElement_PrivateBrowsing.js browserElement_PromptCheck.js browserElement_PromptConfirm.js browserElement_PurgeHistory.js @@ -89,6 +90,7 @@ support-files = file_browserElement_OpenWindowDifferentOrigin.html file_browserElement_OpenWindowInFrame.html file_browserElement_OpenWindowRejected.html + file_browserElement_PrivateBrowsing.html file_browserElement_SecurityChange.html file_browserElement_SetVisibleFrames2_Outer.html file_browserElement_SetVisibleFrames_Inner.html @@ -170,6 +172,7 @@ skip-if = (toolkit == 'gonk' && !debug) [test_browserElement_inproc_OpenWindowRejected.html] skip-if = (toolkit == 'gonk' && !debug) [test_browserElement_inproc_Opensearch.html] +[test_browserElement_inproc_PrivateBrowsing.html] [test_browserElement_inproc_PromptCheck.html] [test_browserElement_inproc_PromptConfirm.html] [test_browserElement_inproc_PurgeHistory.html] diff --git a/dom/browser-element/mochitest/test_browserElement_inproc_PrivateBrowsing.html b/dom/browser-element/mochitest/test_browserElement_inproc_PrivateBrowsing.html new file mode 100644 index 000000000000..0947fd7c71a5 --- /dev/null +++ b/dom/browser-element/mochitest/test_browserElement_inproc_PrivateBrowsing.html @@ -0,0 +1,19 @@ + + + + + Test for Bug 832700 + + + + + +Mozilla Bug 832700 + + + + + diff --git a/dom/browser-element/mochitest/test_browserElement_oop_PrivateBrowsing.html b/dom/browser-element/mochitest/test_browserElement_oop_PrivateBrowsing.html new file mode 100644 index 000000000000..0947fd7c71a5 --- /dev/null +++ b/dom/browser-element/mochitest/test_browserElement_oop_PrivateBrowsing.html @@ -0,0 +1,19 @@ + + + + + Test for Bug 832700 + + + + + +Mozilla Bug 832700 + + + + + From 4f63cf0791e0858147789431c5a5e9ade64b9b66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabrice=20Desr=C3=A9?= Date: Sat, 11 Oct 2014 08:38:50 -0700 Subject: [PATCH 11/13] Backed out changeset 069cb3dad411 for M2 failure --- .../browserElement_PrivateBrowsing.js | 48 ------------------- .../file_browserElement_PrivateBrowsing.html | 10 ---- .../mochitest/mochitest-oop.ini | 1 - dom/browser-element/mochitest/mochitest.ini | 3 -- ...browserElement_inproc_PrivateBrowsing.html | 19 -------- ...st_browserElement_oop_PrivateBrowsing.html | 19 -------- 6 files changed, 100 deletions(-) delete mode 100644 dom/browser-element/mochitest/browserElement_PrivateBrowsing.js delete mode 100644 dom/browser-element/mochitest/file_browserElement_PrivateBrowsing.html delete mode 100644 dom/browser-element/mochitest/test_browserElement_inproc_PrivateBrowsing.html delete mode 100644 dom/browser-element/mochitest/test_browserElement_oop_PrivateBrowsing.html diff --git a/dom/browser-element/mochitest/browserElement_PrivateBrowsing.js b/dom/browser-element/mochitest/browserElement_PrivateBrowsing.js deleted file mode 100644 index 2f4421d7ed3d..000000000000 --- a/dom/browser-element/mochitest/browserElement_PrivateBrowsing.js +++ /dev/null @@ -1,48 +0,0 @@ -/* Any copyright is dedicated to the public domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Test that the mozprivatebrowsing attribute works. -"use strict"; - -SimpleTest.waitForExplicitFinish(); -browserElementTestHelpers.setEnabledPref(true); -browserElementTestHelpers.addPermission(); - -function createFrame(aIsPrivate) { - var iframe = document.createElement("iframe"); - SpecialPowers.wrap(iframe).mozbrowser = true; - if (aIsPrivate) { - iframe.setAttribute("mozprivatebrowsing", "true"); - } - return iframe; -} - -function createTest(aIsPrivate, aExpected, aNext) { - info("createTest " + aIsPrivate + " " + aExpected); - var deferred = Promise.defer(); - - var iframe = createFrame(aIsPrivate); - document.body.appendChild(iframe); - - iframe.addEventListener("mozbrowsershowmodalprompt", function(e) { - is(e.detail.message, aExpected, "Checking localstorage"); - deferred.resolve(); - }); - - iframe.src = "file_browserElement_PrivateBrowsing.html"; - - return deferred.promise; -} - -function runTest() { - // We first create a iframe in non private browsing mode, set up some - // localstorage, reopen it to check that we get the previously set value. - // Finally, open it in private browsing mode and check that localstorage - // is clear. - createTest(false, "EMPTY") - .then(() => { return createTest(false, "bar"); }) - .then(() => { return createTest(true, "EMPTY"); }) - .then(SimpleTest.finish); -} - -addEventListener("testready", runTest); diff --git a/dom/browser-element/mochitest/file_browserElement_PrivateBrowsing.html b/dom/browser-element/mochitest/file_browserElement_PrivateBrowsing.html deleted file mode 100644 index 2db63ccf88cc..000000000000 --- a/dom/browser-element/mochitest/file_browserElement_PrivateBrowsing.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - diff --git a/dom/browser-element/mochitest/mochitest-oop.ini b/dom/browser-element/mochitest/mochitest-oop.ini index 405687dda6ba..5bcd0239d64c 100644 --- a/dom/browser-element/mochitest/mochitest-oop.ini +++ b/dom/browser-element/mochitest/mochitest-oop.ini @@ -59,7 +59,6 @@ skip-if = (toolkit == 'gonk' && !debug) [test_browserElement_oop_OpenWindowRejected.html] skip-if = (toolkit == 'gonk' && !debug) [test_browserElement_oop_Opensearch.html] -[test_browserElement_oop_PrivateBrowsing.html] [test_browserElement_oop_PromptCheck.html] [test_browserElement_oop_PromptConfirm.html] [test_browserElement_oop_PurgeHistory.html] diff --git a/dom/browser-element/mochitest/mochitest.ini b/dom/browser-element/mochitest/mochitest.ini index 9240a713dc51..9705050f2276 100644 --- a/dom/browser-element/mochitest/mochitest.ini +++ b/dom/browser-element/mochitest/mochitest.ini @@ -43,7 +43,6 @@ support-files = browserElement_OpenWindowInFrame.js browserElement_OpenWindowRejected.js browserElement_Opensearch.js - browserElement_PrivateBrowsing.js browserElement_PromptCheck.js browserElement_PromptConfirm.js browserElement_PurgeHistory.js @@ -90,7 +89,6 @@ support-files = file_browserElement_OpenWindowDifferentOrigin.html file_browserElement_OpenWindowInFrame.html file_browserElement_OpenWindowRejected.html - file_browserElement_PrivateBrowsing.html file_browserElement_SecurityChange.html file_browserElement_SetVisibleFrames2_Outer.html file_browserElement_SetVisibleFrames_Inner.html @@ -172,7 +170,6 @@ skip-if = (toolkit == 'gonk' && !debug) [test_browserElement_inproc_OpenWindowRejected.html] skip-if = (toolkit == 'gonk' && !debug) [test_browserElement_inproc_Opensearch.html] -[test_browserElement_inproc_PrivateBrowsing.html] [test_browserElement_inproc_PromptCheck.html] [test_browserElement_inproc_PromptConfirm.html] [test_browserElement_inproc_PurgeHistory.html] diff --git a/dom/browser-element/mochitest/test_browserElement_inproc_PrivateBrowsing.html b/dom/browser-element/mochitest/test_browserElement_inproc_PrivateBrowsing.html deleted file mode 100644 index 0947fd7c71a5..000000000000 --- a/dom/browser-element/mochitest/test_browserElement_inproc_PrivateBrowsing.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - Test for Bug 832700 - - - - - -Mozilla Bug 832700 - - - - - diff --git a/dom/browser-element/mochitest/test_browserElement_oop_PrivateBrowsing.html b/dom/browser-element/mochitest/test_browserElement_oop_PrivateBrowsing.html deleted file mode 100644 index 0947fd7c71a5..000000000000 --- a/dom/browser-element/mochitest/test_browserElement_oop_PrivateBrowsing.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - Test for Bug 832700 - - - - - -Mozilla Bug 832700 - - - - - From 0e40321f9941ec84d150b2aa804a906a4f7cd4cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabrice=20Desr=C3=A9?= Date: Sat, 11 Oct 2014 08:40:19 -0700 Subject: [PATCH 12/13] backout 3efe998b6136 for M2 failure --- content/base/src/nsGkAtomList.h | 1 - docshell/base/nsDocShell.cpp | 14 -------------- docshell/base/nsDocShell.h | 1 - docshell/base/nsIDocShell.idl | 9 +-------- dom/browser-element/BrowserElementChild.js | 7 ------- dom/browser-element/BrowserElementParent.cpp | 8 -------- dom/browser-element/BrowserElementParent.jsm | 3 +-- 7 files changed, 2 insertions(+), 41 deletions(-) diff --git a/content/base/src/nsGkAtomList.h b/content/base/src/nsGkAtomList.h index 53162fee49c9..a680b6c381b4 100644 --- a/content/base/src/nsGkAtomList.h +++ b/content/base/src/nsGkAtomList.h @@ -609,7 +609,6 @@ GK_ATOM(mozfullscreenerror, "mozfullscreenerror") GK_ATOM(mozpasspointerevents, "mozpasspointerevents") GK_ATOM(mozpointerlockchange, "mozpointerlockchange") GK_ATOM(mozpointerlockerror, "mozpointerlockerror") -GK_ATOM(mozprivatebrowsing, "mozprivatebrowsing") GK_ATOM(moz_opaque, "moz-opaque") GK_ATOM(moz_action_hint, "mozactionhint") GK_ATOM(x_moz_errormessage, "x-moz-errormessage") diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 94d3d12a7875..f7e1d7df4a3a 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -851,7 +851,6 @@ nsDocShell::nsDocShell(): #endif mAffectPrivateSessionLifetime(true), mInvisible(false), - mHasLoadedNonBlankURI(false), mDefaultLoadFlags(nsIRequest::LOAD_NORMAL), mFrameType(eFrameTypeRegular), mOwnOrContainingAppId(nsIScriptSecurityManager::UNKNOWN_APP_ID), @@ -1929,10 +1928,6 @@ nsDocShell::SetCurrentURI(nsIURI *aURI, nsIRequest *aRequest, mCurrentURI = NS_TryToMakeImmutable(aURI); - if (!NS_IsAboutBlank(mCurrentURI)) { - mHasLoadedNonBlankURI = true; - } - bool isRoot = false; // Is this the root docshell bool isSubFrame = false; // Is this a subframe navigation? @@ -2282,15 +2277,6 @@ nsDocShell::SetPrivateBrowsing(bool aUsePrivateBrowsing) return NS_OK; } -NS_IMETHODIMP -nsDocShell::GetHasLoadedNonBlankURI(bool* aResult) -{ - NS_ENSURE_ARG_POINTER(aResult); - - *aResult = mHasLoadedNonBlankURI; - return NS_OK; -} - NS_IMETHODIMP nsDocShell::GetUseRemoteTabs(bool* aUseRemoteTabs) { diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index d9a82abe4f70..eda8f2215584 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -915,7 +915,6 @@ protected: #endif bool mAffectPrivateSessionLifetime; bool mInvisible; - bool mHasLoadedNonBlankURI; uint64_t mHistoryID; uint32_t mDefaultLoadFlags; diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl index cf81b57427e8..02c07d548dd4 100644 --- a/docshell/base/nsIDocShell.idl +++ b/docshell/base/nsIDocShell.idl @@ -54,7 +54,7 @@ interface nsITabParent; typedef unsigned long nsLoadFlags; -[scriptable, builtinclass, uuid(23157a63-26fd-44a0-a0f9-fdc64dcc004c)] +[scriptable, builtinclass, uuid(2b8e4a50-7744-454d-a05b-debead8070fe)] interface nsIDocShell : nsIDocShellTreeItem { /** @@ -1017,11 +1017,4 @@ interface nsIDocShell : nsIDocShellTreeItem // URLSearchParams for the window.location is owned by the docShell. [noscript,notxpcom] URLSearchParams getURLSearchParams(); - - /** - * This attribute determines whether a document which is not about:blank has - * already be loaded by this docShell. - */ - [infallible] readonly attribute boolean hasLoadedNonBlankURI; - }; diff --git a/dom/browser-element/BrowserElementChild.js b/dom/browser-element/BrowserElementChild.js index 4996b178e0f9..aa06587c95fa 100644 --- a/dom/browser-element/BrowserElementChild.js +++ b/dom/browser-element/BrowserElementChild.js @@ -56,10 +56,3 @@ let infos = sendSyncMessage('browser-element-api:call', { 'msg_name': 'hello' })[0]; docShell.QueryInterface(Ci.nsIDocShellTreeItem).name = infos.name; docShell.setFullscreenAllowed(infos.fullscreenAllowed); -if (infos.isPrivate) { - if (docShell.hasLoadedNonBlankURI) { - Cu.reportError("We should not switch to Private Browsing after loading a document."); - } else { - docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = true; - } -} diff --git a/dom/browser-element/BrowserElementParent.cpp b/dom/browser-element/BrowserElementParent.cpp index 83f5057ba4d7..62ca3c119d1d 100644 --- a/dom/browser-element/BrowserElementParent.cpp +++ b/dom/browser-element/BrowserElementParent.cpp @@ -76,14 +76,6 @@ CreateIframe(Element* aOpenerFrameElement, const nsAString& aName, bool aRemote) NS_LITERAL_STRING("false"), /* aNotify = */ false); - // Copy the opener frame's mozprivatebrowsing attribute to the popup frame. - nsAutoString mozprivatebrowsing; - if (aOpenerFrameElement->GetAttr(kNameSpaceID_None, nsGkAtoms::mozprivatebrowsing, - mozprivatebrowsing)) { - popupFrameElement->SetAttr(kNameSpaceID_None, nsGkAtoms::mozprivatebrowsing, - mozprivatebrowsing, /* aNotify = */ false); - } - return popupFrameElement.forget(); } diff --git a/dom/browser-element/BrowserElementParent.jsm b/dom/browser-element/BrowserElementParent.jsm index 3a7124be8001..066c59a040a8 100644 --- a/dom/browser-element/BrowserElementParent.jsm +++ b/dom/browser-element/BrowserElementParent.jsm @@ -389,8 +389,7 @@ BrowserElementParent.prototype = { name: this._frameElement.getAttribute('name'), fullscreenAllowed: this._frameElement.hasAttribute('allowfullscreen') || - this._frameElement.hasAttribute('mozallowfullscreen'), - isPrivate: this._frameElement.hasAttribute('mozprivatebrowsing') + this._frameElement.hasAttribute('mozallowfullscreen') }; }, From 3cfd2eabd89f1801ce2826bcc82da7c8aebf1b9a Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Sat, 11 Oct 2014 10:32:30 -0700 Subject: [PATCH 13/13] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 0bf226b2460c..c041a933110b 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -133,7 +133,7 @@ - +