Skip to content

Commit

Permalink
Merge mozilla-central to mozilla-inbound
Browse files Browse the repository at this point in the history
  • Loading branch information
BavarianTomcat committed Apr 4, 2017
2 parents c88b464 + 278492e commit f2f4347
Show file tree
Hide file tree
Showing 103 changed files with 5,177 additions and 4,770 deletions.
2 changes: 1 addition & 1 deletion CLOBBER
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
# don't change CLOBBER for WebIDL changes any more.

Bug 1351604 - required because DER.jsm and X509.jsm are no longer shipped with the browser
Bug 1351074 - required because bug 1352982 means removing a .jsm requires a clobber
8 changes: 6 additions & 2 deletions browser/base/content/test/general/contextmenu_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ function openContextMenuFor(element, shiftkey, waitForSpellCheck) {
}

if (waitForSpellCheck) {
var { onSpellCheck } = SpecialPowers.Cu.import("resource://gre/modules/AsyncSpellCheckTestHelper.jsm", {});
var { onSpellCheck } =
SpecialPowers.Cu.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm", {});
onSpellCheck(element, actuallyOpenContextMenuFor);
} else {
actuallyOpenContextMenuFor();
Expand Down Expand Up @@ -278,7 +280,9 @@ function* test_contextmenu(selector, menuItems, options = {}) {
if (options.waitForSpellCheck) {
info("Waiting for spell check");
yield ContentTask.spawn(gBrowser.selectedBrowser, selector, function*(contentSelector) {
let {onSpellCheck} = Cu.import("resource://gre/modules/AsyncSpellCheckTestHelper.jsm", {});
let {onSpellCheck} =
Cu.import("resource://testing-common/AsyncSpellCheckTestHelper.jsm",
{});
let element = content.document.querySelector(contentSelector);
yield new Promise(resolve => onSpellCheck(element, resolve));
info("Spell check running");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,6 @@ var whitelist = new Set([
{file: "resource://gre-resources/checkmark.svg"},
{file: "resource://gre-resources/indeterminate-checkmark.svg"},
{file: "resource://gre-resources/radio.svg"},
// Bug 1351074
{file: "resource://gre/modules/AsyncSpellCheckTestHelper.jsm"},
// Bug 1351078
{file: "resource://gre/modules/Battery.jsm"},
// Bug 1351070
Expand Down
89 changes: 53 additions & 36 deletions browser/base/content/test/static/browser_parsable_css.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,24 @@ let whitelist = [
errorMessage: /Unknown property.*-moz-/i,
isFromDevTools: false},
// Reserved to UA sheets unless layout.css.overflow-clip-box.enabled flipped to true.
{sourceName: /res\/forms\.css$/i,
{sourceName: /(?:res|gre-resources)\/forms\.css$/i,
errorMessage: /Unknown property.*overflow-clip-box/i,
isFromDevTools: false},
// These variables are declared somewhere else, and error when we load the
// files directly. They're all marked intermittent because their appearance
// in the error console seems to not be consistent.
{sourceName: /jsonview\/css\/general\.css$/i,
intermittent: true,
errorMessage: /Property contained reference to invalid variable.*color/i,
isFromDevTools: true},
{sourceName: /webide\/skin\/logs\.css$/i,
intermittent: true,
errorMessage: /Property contained reference to invalid variable.*color/i,
isFromDevTools: true},
{sourceName: /devtools\/skin\/animationinspector\.css$/i,
intermittent: true,
errorMessage: /Property contained reference to invalid variable.*color/i,
isFromDevTools: true},
];

if (!Services.prefs.getBoolPref("full-screen-api.unprefix.enabled")) {
Expand Down Expand Up @@ -93,20 +108,20 @@ function ignoredError(aErrorObject) {
return false;
}

function once(target, name) {
return new Promise((resolve, reject) => {
let cb = () => {
target.removeEventListener(name, cb);
resolve();
};
target.addEventListener(name, cb);
});
}

var gChromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]
.getService(Ci.nsIChromeRegistry);
var gChromeMap = new Map();

var resHandler = Services.io.getProtocolHandler("resource")
.QueryInterface(Ci.nsIResProtocolHandler);
var gResourceMap = [];
function trackResourcePrefix(prefix) {
let uri = Services.io.newURI("resource://" + prefix + "/");
gResourceMap.unshift([prefix, resHandler.resolveURI(uri)]);
}
trackResourcePrefix("gre");
trackResourcePrefix("app");

function getBaseUriForChromeUri(chromeUri) {
let chromeFile = chromeUri + "gobbledygooknonexistentfile.reallynothere";
let uri = Services.io.newURI(chromeFile);
Expand All @@ -118,35 +133,34 @@ function parseManifest(manifestUri) {
return fetchFile(manifestUri.spec).then(data => {
for (let line of data.split("\n")) {
let [type, ...argv] = line.split(/\s+/);
let component;
if (type == "content" || type == "skin") {
[component] = argv;
} else {
// skip unrelated lines
continue;
let chromeUri = `chrome://${argv[0]}/${type}/`;
gChromeMap.set(getBaseUriForChromeUri(chromeUri), chromeUri);
} else if (type == "resource") {
trackResourcePrefix(argv[0]);
}
let chromeUri = `chrome://${component}/${type}/`;
gChromeMap.set(getBaseUriForChromeUri(chromeUri), chromeUri);
}
});
}

function convertToChromeUri(fileUri) {
let baseUri = fileUri.spec;
function convertToCodeURI(fileUri) {
let baseUri = fileUri;
let path = "";
while (true) {
let slashPos = baseUri.lastIndexOf("/", baseUri.length - 2);
if (slashPos < 0) {
info(`File not accessible from chrome protocol: ${fileUri.path}`);
if (slashPos <= 0) {
// File not accessible from chrome protocol, try resource://
for (let res of gResourceMap) {
if (fileUri.startsWith(res[1]))
return fileUri.replace(res[1], "resource://" + res[0] + "/");
}
// Give up and return the original URL.
return fileUri;
}
path = baseUri.slice(slashPos + 1) + path;
baseUri = baseUri.slice(0, slashPos + 1);
if (gChromeMap.has(baseUri)) {
let chromeBaseUri = gChromeMap.get(baseUri);
let chromeUri = `${chromeBaseUri}${path}`;
return Services.io.newURI(chromeUri);
}
if (gChromeMap.has(baseUri))
return gChromeMap.get(baseUri) + path;
}
}

Expand Down Expand Up @@ -235,10 +249,12 @@ add_task(function* checkAllTheCSS() {
// Create a clean iframe to load all the files into. This needs to live at a
// chrome URI so that it's allowed to load and parse any styles.
let testFile = getRootDirectory(gTestPath) + "dummy_page.html";
let windowless = Services.appShell.createWindowlessBrowser();
let iframe = windowless.document.createElementNS("http://www.w3.org/1999/xhtml", "html:iframe");
windowless.document.documentElement.appendChild(iframe);
let iframeLoaded = once(iframe, "load");
let HiddenFrame = Cu.import("resource:///modules/HiddenFrame.jsm", {}).HiddenFrame;
let hiddenFrame = new HiddenFrame();
let win = yield hiddenFrame.get();
let iframe = win.document.createElementNS("http://www.w3.org/1999/xhtml", "html:iframe");
win.document.documentElement.appendChild(iframe);
let iframeLoaded = BrowserTestUtils.waitForEvent(iframe, "load", true);
iframe.contentWindow.location = testFile;
yield iframeLoaded;
let doc = iframe.contentWindow.document;
Expand Down Expand Up @@ -285,8 +301,8 @@ add_task(function* checkAllTheCSS() {
linkEl.addEventListener("load", onLoad);
linkEl.addEventListener("error", onError);
linkEl.setAttribute("type", "text/css");
let chromeUri = convertToChromeUri(uri);
linkEl.setAttribute("href", chromeUri.spec + kPathSuffix);
let chromeUri = convertToCodeURI(uri.spec);
linkEl.setAttribute("href", chromeUri + kPathSuffix);
}));
doc.head.appendChild(linkEl);
}
Expand Down Expand Up @@ -322,7 +338,7 @@ add_task(function* checkAllTheCSS() {

// Confirm that all whitelist rules have been used.
for (let item of whitelist) {
if (!item.used && isDevtools == item.isFromDevTools) {
if (!item.used && isDevtools == item.isFromDevTools && !item.intermittent) {
ok(false, "Unused whitelist item. " +
(item.sourceName ? " sourceName: " + item.sourceName : "") +
(item.errorMessage ? " errorMessage: " + item.errorMessage : ""));
Expand All @@ -344,7 +360,8 @@ add_task(function* checkAllTheCSS() {
doc.head.innerHTML = "";
doc = null;
iframe = null;
windowless.close();
windowless = null;
win = null;
hiddenFrame.destroy();
hiddenFrame = null;
imageURIsToReferencesMap = null;
});
2 changes: 1 addition & 1 deletion browser/components/migration/SafariProfileMigrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ Bookmarks.prototype = {
return { url, title };
}
return null;
}).filter(e => !!e);
}, this).filter(e => !!e);
},
};

Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ add_task(function* () {
let expectedParents = [ PlacesUtils.toolbarFolderId ];
let itemCount = 0;

let gotFolder = false;
let bmObserver = {
onItemAdded(aItemId, aParentId, aIndex, aItemType, aURI, aTitle) {
if (aTitle != label) {
itemCount++;
}
if (aItemType == PlacesUtils.bookmarks.TYPE_FOLDER && aTitle == "Stuff") {
gotFolder = true;
}
if (expectedParents.length > 0 && aTitle == label) {
let index = expectedParents.indexOf(aParentId);
Assert.ok(index != -1, "Found expected parent");
Expand All @@ -40,6 +44,7 @@ add_task(function* () {

// Check the bookmarks have been imported to all the expected parents.
Assert.ok(!expectedParents.length, "No more expected parents");
Assert.ok(gotFolder, "Should have seen the folder get imported");
Assert.equal(itemCount, 13, "Should import all 13 items.");
// Check that the telemetry matches:
Assert.equal(MigrationUtils._importQuantities.bookmarks, itemCount, "Telemetry reporting correct.");
Expand Down
17 changes: 17 additions & 0 deletions caps/nsScriptSecurityManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,23 @@ nsScriptSecurityManager::CheckLoadURIFlags(nsIURI *aSourceURI,
}
}

static bool sCanLoadChromeInContent = false;
static bool sCachedCanLoadChromeInContentPref = false;
if (!sCachedCanLoadChromeInContentPref) {
sCachedCanLoadChromeInContentPref = true;
mozilla::Preferences::AddBoolVarCache(&sCanLoadChromeInContent,
"security.allow_chrome_frames_inside_content");
}
if (sCanLoadChromeInContent) {
// Special-case the hidden window: it's allowed to load
// URI_IS_UI_RESOURCE no matter what. Bug 1145470 tracks removing this.
nsAutoCString sourceSpec;
if (NS_SUCCEEDED(aSourceBaseURI->GetSpec(sourceSpec)) &&
sourceSpec.EqualsLiteral("resource://gre-resources/hiddenWindow.html")) {
return NS_OK;
}
}

if (reportErrors) {
ReportError(nullptr, errorTag, aSourceURI, aTargetURI);
}
Expand Down
35 changes: 35 additions & 0 deletions dom/media/gmp/GMPServiceChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,13 @@ GeckoMediaPluginServiceChild::UpdateGMPCapabilities(nsTArray<GMPCapabilityData>&
}
}

void
GeckoMediaPluginServiceChild::BeginShutdown()
{
MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
mShuttingDownOnGMPThread = true;
}

NS_IMETHODIMP
GeckoMediaPluginServiceChild::HasPluginForAPI(const nsACString& aAPI,
nsTArray<nsCString>* aTags,
Expand Down Expand Up @@ -374,6 +381,13 @@ GeckoMediaPluginServiceChild::GetServiceChild()
MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);

if (!mServiceChild) {
if (mShuttingDownOnGMPThread) {
// We have begun shutdown. Don't allow a new connection to the main
// process to be instantiated. This also prevents new plugins being
// instantiated.
return GetServiceChildPromise::CreateAndReject(NS_ERROR_FAILURE,
__func__);
}
dom::ContentChild* contentChild = dom::ContentChild::GetSingleton();
if (!contentChild) {
return GetServiceChildPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
Expand Down Expand Up @@ -411,6 +425,9 @@ GeckoMediaPluginServiceChild::RemoveGMPContentParent(GMPContentParent* aGMPConte

if (mServiceChild) {
mServiceChild->RemoveGMPContentParent(aGMPContentParent);
if (mShuttingDownOnGMPThread && !mServiceChild->HaveContentParents()) {
mServiceChild = nullptr;
}
}
}

Expand Down Expand Up @@ -515,5 +532,23 @@ GMPServiceChild::Create(Endpoint<PGMPServiceChild>&& aGMPService)
return NS_SUCCEEDED(rv);
}

ipc::IPCResult
GMPServiceChild::RecvBeginShutdown()
{
RefPtr<GeckoMediaPluginServiceChild> service =
GeckoMediaPluginServiceChild::GetSingleton();
MOZ_ASSERT(service && service->mServiceChild.get() == this);
if (service) {
service->BeginShutdown();
}
return IPC_OK();
}

bool
GMPServiceChild::HaveContentParents() const
{
return mContentParents.Count() > 0;
}

} // namespace gmp
} // namespace mozilla
6 changes: 6 additions & 0 deletions dom/media/gmp/GMPServiceChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class GeckoMediaPluginServiceChild : public GeckoMediaPluginService

static void UpdateGMPCapabilities(nsTArray<mozilla::dom::GMPCapabilityData>&& aCapabilities);

void BeginShutdown();

protected:
void InitializePlugins(AbstractThread*) override
{
Expand Down Expand Up @@ -85,6 +87,10 @@ class GMPServiceChild : public PGMPServiceChild

static bool Create(Endpoint<PGMPServiceChild>&& aGMPService);

ipc::IPCResult RecvBeginShutdown() override;

bool HaveContentParents() const;

private:
nsRefPtrHashtable<nsUint64HashKey, GMPContentParent> mContentParents;
};
Expand Down
Loading

0 comments on commit f2f4347

Please sign in to comment.