зеркало из https://github.com/mozilla/gecko-dev.git
Bug 799600 - allow data urls in social panels. r=jaws
This commit is contained in:
Родитель
1967053525
Коммит
eaf93761f2
|
@ -96,6 +96,37 @@ var tests = {
|
|||
document.getElementById("menu_ToolsPopup").openPopup();
|
||||
}, "statusIcon was never found");
|
||||
},
|
||||
testAmbientNotificationContent: function(next) {
|
||||
let ambience = {
|
||||
name: "testIcon",
|
||||
iconURL: "https://example.com/browser/browser/base/content/test/moz.png",
|
||||
contentPanel: "data:text/html;charset=utf-8," +
|
||||
encodeURI('<html><body><div id="testdiv"/></body></html>'),
|
||||
counter: 42,
|
||||
label: "Test Ambient 1",
|
||||
menuURL: "https://example.com/testAmbient1"
|
||||
};
|
||||
Social.provider.setAmbientNotification(ambience);
|
||||
|
||||
let statusIcon = document.querySelector("#social-toolbar-item > box");
|
||||
waitForCondition(function() {
|
||||
statusIcon = document.querySelector("#social-toolbar-item > box");
|
||||
return !!statusIcon;
|
||||
}, function () {
|
||||
let panel = document.getElementById("social-notification-panel");
|
||||
let iframe = panel.firstChild;
|
||||
iframe.contentWindow.addEventListener("load", function frame_load() {
|
||||
iframe.contentWindow.removeEventListener("load", frame_load);
|
||||
ok(iframe.contentDocument.getElementById("testdiv"), "could find our div in the content");
|
||||
panel.addEventListener("popuphidden", function popuphidden() {
|
||||
panel.removeEventListener("popuphidden", popuphidden);
|
||||
next();
|
||||
});
|
||||
panel.hidePopup();
|
||||
})
|
||||
panel.openPopup();
|
||||
}, "statusIcon was never found");
|
||||
},
|
||||
testProfileUnset: function(next) {
|
||||
Social.provider.updateUserProfile({});
|
||||
// check dom values
|
||||
|
|
|
@ -74,7 +74,10 @@ function attachToWindow(provider, targetWindow) {
|
|||
// the mozSocial API.
|
||||
let origin = provider.origin;
|
||||
let targetDocURI = targetWindow.document.documentURIObject;
|
||||
if (provider.origin != targetDocURI.prePath) {
|
||||
// We allow data: URLs as it might be far more efficient for a provider to
|
||||
// synthesize a data URL from content already loaded in its sidebar or
|
||||
// worker.
|
||||
if (provider.origin != targetDocURI.prePath && targetDocURI.scheme != "data") {
|
||||
let msg = "MozSocialAPI: not attaching mozSocial API for " + origin +
|
||||
" to " + targetDocURI.spec + " since origins differ."
|
||||
Services.console.logStringMessage(msg);
|
||||
|
|
Загрузка…
Ссылка в новой задаче