Skip to content
This repository has been archived by the owner on Feb 26, 2022. It is now read-only.

Commit

Permalink
Bug 1094005 - remove unused panel code r=gozala
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvold committed Nov 19, 2014
1 parent 5d53bdd commit 2d75e55
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 92 deletions.
8 changes: 3 additions & 5 deletions lib/sdk/panel.js
Expand Up @@ -15,8 +15,6 @@ module.metadata = {

const { Ci } = require("chrome");
const { setTimeout } = require('./timers');
const { isPrivateBrowsingSupported } = require('./self');
const { isWindowPBSupported } = require('./private-browsing/utils');
const { Class } = require("./core/heritage");
const { merge } = require("./util/object");
const { WorkerHost } = require("./content/utils");
Expand Down Expand Up @@ -155,7 +153,7 @@ const Panel = Class({

// Load panel content.
domPanel.setURL(view, model.contentURL);

// Allow context menu
domPanel.allowContextMenu(view, model.contextMenu);

Expand Down Expand Up @@ -195,15 +193,15 @@ const Panel = Class({

/* Public API: Panel.position */
get position() modelFor(this).position,

/* Public API: Panel.contextMenu */
get contextMenu() modelFor(this).contextMenu,
set contextMenu(allow) {
let model = modelFor(this);
model.contextMenu = panelContract({ contextMenu: allow }).contextMenu;
domPanel.allowContextMenu(viewFor(this), model.contextMenu);
},

get contentURL() modelFor(this).contentURL,
set contentURL(value) {
let model = modelFor(this);
Expand Down
9 changes: 4 additions & 5 deletions lib/sdk/panel/utils.js
Expand Up @@ -213,7 +213,7 @@ function show(panel, options, anchor) {
// Prevent the panel from getting focus when showing up
// if focus is set to false
panel.setAttribute("noautofocus", !options.focus);

let window = anchor && getOwnerBrowserWindow(anchor);
let { document } = window ? window : getMostRecentBrowserWindow();
attach(panel, document);
Expand Down Expand Up @@ -286,8 +286,7 @@ function make(document) {
events.emit(type, { subject: panel });
}

function onContentChange({subject, type}) {
let document = subject;
function onContentChange({subject: document, type}) {
if (document === getContentDocument(panel) && document.defaultView)
events.emit(type, { subject: panel });
}
Expand Down Expand Up @@ -411,9 +410,9 @@ function setURL(panel, url) {
exports.setURL = setURL;

function allowContextMenu(panel, allow) {
if(allow) {
if (allow) {
panel.setAttribute("context", "contentAreaContextMenu");
}
}
else {
panel.removeAttribute("context");
}
Expand Down
65 changes: 0 additions & 65 deletions lib/sdk/panel/window.js

This file was deleted.

17 changes: 0 additions & 17 deletions test/test-panel.js
Expand Up @@ -19,7 +19,6 @@ const { isPrivate } = require('sdk/private-browsing');
const { isWindowPBSupported } = require('sdk/private-browsing/utils');
const { defer, all } = require('sdk/core/promise');
const { getMostRecentBrowserWindow } = require('sdk/window/utils');
const { getWindow } = require('sdk/panel/window');
const { URL } = require('sdk/url');
const { wait } = require('./event/helpers');

Expand Down Expand Up @@ -1331,20 +1330,4 @@ exports["test panel load doesn't show"] = function*(assert) {
loader.unload();
}

if (isWindowPBSupported) {
exports.testGetWindow = function(assert, done) {
let activeWindow = getMostRecentBrowserWindow();
open(null, { features: {
toolbar: true,
chrome: true,
private: true
} }).then(window => {
assert.ok(isPrivate(window), 'window is private');
assert.equal(getWindow(window.gBrowser), null, 'private window elements returns null');
assert.equal(getWindow(activeWindow.gBrowser), activeWindow, 'non-private window elements returns window');
return window;
}).then(close).then(done).then(null, assert.fail);
}
}

require("sdk/test").run(exports);

0 comments on commit 2d75e55

Please sign in to comment.