Skip to content

Commit

Permalink
Merge inbound to m-c
Browse files Browse the repository at this point in the history
--HG--
rename : mobile/android/chrome/content/PluginHelper.js => browser/metro/base/content/contenthandlers/PluginHelper.js
  • Loading branch information
KWierso committed Feb 26, 2014
2 parents 11bc10e + ef55348 commit 7b878fa
Show file tree
Hide file tree
Showing 42 changed files with 1,368 additions and 284 deletions.
2 changes: 1 addition & 1 deletion b2g/config/emulator-ics/sources.xml
Expand Up @@ -12,7 +12,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="8e21d0a5cdac94f05e9c3623fa3b9ad579ba2967"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="80d6405725788327102cab36e8d8c017cf25fb23"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>
Expand Down
2 changes: 1 addition & 1 deletion b2g/config/emulator-jb/sources.xml
Expand Up @@ -11,7 +11,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="8e21d0a5cdac94f05e9c3623fa3b9ad579ba2967"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="80d6405725788327102cab36e8d8c017cf25fb23"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8c449b53328059e9b55bb34baec9b27a15055a7e"/>
Expand Down
2 changes: 1 addition & 1 deletion b2g/config/emulator/sources.xml
Expand Up @@ -12,7 +12,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="8e21d0a5cdac94f05e9c3623fa3b9ad579ba2967"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="80d6405725788327102cab36e8d8c017cf25fb23"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>
Expand Down
2 changes: 1 addition & 1 deletion b2g/config/gaia.json
@@ -1,4 +1,4 @@
{
"revision": "823616f0af83eca32bceb0367a7a221f8b187110",
"revision": "b2b0a8234336f7004812bf27e4053957cecad492",
"repo_path": "/integration/gaia-central"
}
2 changes: 1 addition & 1 deletion b2g/config/hamachi/sources.xml
Expand Up @@ -11,7 +11,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="8e21d0a5cdac94f05e9c3623fa3b9ad579ba2967"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="80d6405725788327102cab36e8d8c017cf25fb23"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
Expand Down
2 changes: 1 addition & 1 deletion b2g/config/helix/sources.xml
Expand Up @@ -10,7 +10,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="8e21d0a5cdac94f05e9c3623fa3b9ad579ba2967"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="80d6405725788327102cab36e8d8c017cf25fb23"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
Expand Down
2 changes: 1 addition & 1 deletion b2g/config/inari/sources.xml
Expand Up @@ -12,7 +12,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="8e21d0a5cdac94f05e9c3623fa3b9ad579ba2967"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="80d6405725788327102cab36e8d8c017cf25fb23"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
Expand Down
2 changes: 1 addition & 1 deletion b2g/config/leo/sources.xml
Expand Up @@ -11,7 +11,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="8e21d0a5cdac94f05e9c3623fa3b9ad579ba2967"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="80d6405725788327102cab36e8d8c017cf25fb23"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
Expand Down
2 changes: 1 addition & 1 deletion b2g/config/mako/sources.xml
Expand Up @@ -11,7 +11,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="8e21d0a5cdac94f05e9c3623fa3b9ad579ba2967"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="80d6405725788327102cab36e8d8c017cf25fb23"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8c449b53328059e9b55bb34baec9b27a15055a7e"/>
Expand Down
2 changes: 1 addition & 1 deletion b2g/config/wasabi/sources.xml
Expand Up @@ -11,7 +11,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="8e21d0a5cdac94f05e9c3623fa3b9ad579ba2967"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="80d6405725788327102cab36e8d8c017cf25fb23"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
Expand Down
3 changes: 3 additions & 0 deletions browser/base/content/browser.xul
Expand Up @@ -592,6 +592,9 @@
cui-areatype="toolbar"
tooltiptext="&closeTab.label;"/>

#ifdef XP_WIN
<hbox id="private-browsing-indicator" skipintoolbarset="true" ordinal="1000"/>
#endif
#ifdef CAN_DRAW_IN_TITLEBAR
<hbox class="titlebar-placeholder" type="caption-buttons"
id="titlebar-placeholder-on-TabsToolbar-for-captions-buttons" persist="width"
Expand Down
13 changes: 13 additions & 0 deletions browser/components/customizableui/src/CustomizableWidgets.jsm
Expand Up @@ -191,6 +191,19 @@ const CustomizableWidgets = [{
}
recentlyClosedWindows.appendChild(windowsFragment);
},
onCreated: function(aNode) {
// Middle clicking recently closed items won't close the panel - cope:
let onRecentlyClosedClick = function(aEvent) {
if (aEvent.button == 1) {
CustomizableUI.hidePanelForNode(this);
}
};
let doc = aNode.ownerDocument;
let recentlyClosedTabs = doc.getElementById("PanelUI-recentlyClosedTabs");
let recentlyClosedWindows = doc.getElementById("PanelUI-recentlyClosedWindows");
recentlyClosedTabs.addEventListener("click", onRecentlyClosedClick);
recentlyClosedWindows.addEventListener("click", onRecentlyClosedClick);
},
onViewHiding: function(aEvent) {
LOG("History view is being hidden!");
}
Expand Down
3 changes: 3 additions & 0 deletions browser/devtools/webconsole/test/browser.ini
Expand Up @@ -107,6 +107,8 @@ support-files =
test-bug_923281_test2.js
test-bug_939783_console_trace_duplicates.html
test-bug-952277-highlight-nodes-in-vview.html
test-bug-609872-cd-iframe-parent.html
test-bug-609872-cd-iframe-child.html

[browser_bug664688_sandbox_update_after_navigation.js]
[browser_bug_638949_copy_link_location.js]
Expand Down Expand Up @@ -267,3 +269,4 @@ run-if = os == "mac"
[browser_webconsole_output_events.js]
[browser_console_variables_view_highlighter.js]
[browser_webconsole_console_trace_duplicates.js]
[browser_webconsole_cd_iframe.js]
110 changes: 110 additions & 0 deletions browser/devtools/webconsole/test/browser_webconsole_cd_iframe.js
@@ -0,0 +1,110 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */

// Test that the cd() jsterm helper function works as expected. See bug 609872.

function test() {
let hud;

const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-609872-cd-iframe-parent.html";

const parentMessages = [{
name: "document.title in parent iframe",
text: "bug 609872 - iframe parent",
category: CATEGORY_OUTPUT,
}, {
name: "paragraph content",
text: "p: test for bug 609872 - iframe parent",
category: CATEGORY_OUTPUT,
}, {
name: "object content",
text: "obj: parent!",
category: CATEGORY_OUTPUT,
}];

const childMessages = [{
name: "document.title in child iframe",
text: "bug 609872 - iframe child",
category: CATEGORY_OUTPUT,
}, {
name: "paragraph content",
text: "p: test for bug 609872 - iframe child",
category: CATEGORY_OUTPUT,
}, {
name: "object content",
text: "obj: child!",
category: CATEGORY_OUTPUT,
}];

Task.spawn(runner).then(finishTest);

function* runner() {
const {tab} = yield loadTab(TEST_URI);
hud = yield openConsole(tab);

executeWindowTest();

yield waitForMessages({ webconsole: hud, messages: parentMessages });

info("cd() into the iframe using a selector");
hud.jsterm.clearOutput();
hud.jsterm.execute("cd('iframe')");
executeWindowTest();

yield waitForMessages({ webconsole: hud, messages: childMessages });

info("cd() out of the iframe, reset to default window");
hud.jsterm.clearOutput();
hud.jsterm.execute("cd()");
executeWindowTest();

yield waitForMessages({ webconsole: hud, messages: parentMessages });

info("call cd() with unexpected arguments");
hud.jsterm.clearOutput();
hud.jsterm.execute("cd(document)");

yield waitForMessages({
webconsole: hud,
messages: [{
text: "Cannot cd()",
category: CATEGORY_OUTPUT,
severity: SEVERITY_ERROR,
}],
});

hud.jsterm.clearOutput();
hud.jsterm.execute("cd('p')");

yield waitForMessages({
webconsole: hud,
messages: [{
text: "Cannot cd()",
category: CATEGORY_OUTPUT,
severity: SEVERITY_ERROR,
}],
});

info("cd() into the iframe using an iframe DOM element");
hud.jsterm.clearOutput();
hud.jsterm.execute("cd($('iframe'))");
executeWindowTest();

yield waitForMessages({ webconsole: hud, messages: childMessages });

info("cd(window.parent)");
hud.jsterm.clearOutput();
hud.jsterm.execute("cd(window.parent)");
executeWindowTest();

yield waitForMessages({ webconsole: hud, messages: parentMessages });

yield closeConsole(tab);
}

function executeWindowTest() {
hud.jsterm.execute("document.title");
hud.jsterm.execute("'p: ' + document.querySelector('p').textContent");
hud.jsterm.execute("'obj: ' + window.foobarBug609872");
}
}
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>test for bug 609872 - iframe child</title>
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
</head>
<body>
<p>test for bug 609872 - iframe child</p>
<script>window.foobarBug609872 = 'child!';</script>
</body>
</html>
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>test for bug 609872 - iframe parent</title>
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
</head>
<body>
<p>test for bug 609872 - iframe parent</p>
<script>window.foobarBug609872 = 'parent!';</script>
<iframe src="test-bug-609872-cd-iframe-child.html"></iframe>
</body>
</html>
Expand Up @@ -213,3 +213,7 @@ emptyPropertiesList=No properties to display
# #1 number of message repeats
# example: 3 repeats
messageRepeats.tooltip2=#1 repeat;#1 repeats

# LOCALIZATION NOTE (cdFunctionInvalidArgument): the text that is displayed when
# cd() is invoked with an invalid argument.
cdFunctionInvalidArgument=Cannot cd() to the given window. Invalid argument.
1 change: 1 addition & 0 deletions browser/metro/base/content/browser.js
Expand Up @@ -64,6 +64,7 @@ var Browser = {
messageManager.loadFrameScript("chrome://browser/content/contenthandlers/SelectionHandler.js", true);
messageManager.loadFrameScript("chrome://browser/content/contenthandlers/ContextMenuHandler.js", true);
messageManager.loadFrameScript("chrome://browser/content/contenthandlers/ConsoleAPIObserver.js", true);
messageManager.loadFrameScript("chrome://browser/content/contenthandlers/PluginHelper.js", true);
} catch (e) {
// XXX whatever is calling startup needs to dump errors!
dump("###########" + e + "\n");
Expand Down
3 changes: 3 additions & 0 deletions browser/metro/base/content/browser.xul
Expand Up @@ -1120,6 +1120,9 @@ Desktop browser's sync prefs.
<setting pref="signon.rememberSignons"
title="&optionsHeader.privacy.passwords.label;"
type="bool"/>
<setting pref="browser.display.overlaynavbuttons"
title="&optionsHeader.displayOverlayButtons.label;"
type="bool"/>
<settings id="prefs-reporting"
label="&optionsHeader.reporting.title;">
<setting pref="app.crashreporter.autosubmit"
Expand Down
95 changes: 95 additions & 0 deletions browser/metro/base/content/contenthandlers/PluginHelper.js
@@ -0,0 +1,95 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";

dump("### PluginHelper.js loaded\n");

/**
* Handle events generated by plugin click-to-play code.
*
* This "PluginBindingAttached" fires when a "pluginProblem" XBL binding is
* created. This binding overlays plugin content when the plugin is missing,
* blocked, click-to-play, or replaced by a "preview" extension plugin like
* Shumway or PDF.js.
*/
var PluginHelper = {
init: function () {
addEventListener("PluginBindingAttached", this, true, true);
},

handleEvent: function handleEvent(aEvent) {
switch (aEvent.type) {
case "PluginBindingAttached":
this.handlePluginBindingAttached(aEvent);
break;
}
},

getPluginMimeType: function (plugin) {
var tagMimetype = plugin.actualType;

if (tagMimetype == "") {
tagMimetype = plugin.type;
}
return tagMimetype;
},

handlePluginBindingAttached: function (aEvent) {
let plugin = aEvent.target;
let doc = plugin.ownerDocument;
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
if (!overlay || overlay._bindingHandled) {
return;
}
overlay._bindingHandled = true;

let eventType = PluginHelper._getBindingType(plugin);
if (!eventType) {
return;
}

switch (eventType) {
case "PluginPlayPreview": {
// Load the "preview" handler (an extension plugin like Shumway or PDF.js).
let previewContent = doc.getAnonymousElementByAttribute(plugin, "class", "previewPluginContent");
let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
let mimeType = PluginHelper.getPluginMimeType(plugin);
let playPreviewInfo = pluginHost.getPlayPreviewInfo(mimeType);

let iframe = previewContent.getElementsByClassName("previewPluginContentFrame")[0];
if (!iframe) {
// lazy initialization of the iframe
iframe = doc.createElementNS("http://www.w3.org/1999/xhtml", "iframe");
iframe.className = "previewPluginContentFrame";
previewContent.appendChild(iframe);
}
iframe.src = playPreviewInfo.redirectURL;
break;
}

case "PluginNotFound": {
// TODO: Display a message about missing plugins (bug 936907)
break;
}
}
},

// Helper to get the binding handler type from a plugin object
_getBindingType: function(plugin) {
if (!(plugin instanceof Ci.nsIObjectLoadingContent))
return null;

switch (plugin.pluginFallbackType) {
case Ci.nsIObjectLoadingContent.PLUGIN_UNSUPPORTED:
return "PluginNotFound";
case Ci.nsIObjectLoadingContent.PLUGIN_PLAY_PREVIEW:
return "PluginPlayPreview";
default:
// Metro Firefox does not yet support other fallback types.
return null;
}
},
};

PluginHelper.init();

0 comments on commit 7b878fa

Please sign in to comment.