Merge m-c to m-i on a CLOSED TREE.

This commit is contained in:
Ms2ger 2013-02-28 14:42:12 +01:00
commit 830992e002
19 changed files with 253 additions and 279 deletions

View File

@ -110,12 +110,15 @@ let gTests = [
desc: "Check that performing a search records to Firefox Health Report.",
setup: function () { },
run: function () {
if (!("@mozilla.org/datareporting/service;1" in Components.classes)) {
try {
let cm = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager);
cm.getCategoryEntry("healthreport-js-provider", "SearchesProvider");
} catch (ex) {
// Health Report disabled, or no SearchesProvider.
runNextTest();
return;
}
let doc = gBrowser.contentDocument;
// We rely on the listener in browser.js being installed and fired before

View File

@ -26,7 +26,12 @@ function test() {
container.removeEventListener("TabOpen", tabAdded, false);
tabs.forEach(gBrowser.removeTab, gBrowser);
if (!"@mozilla.org/datareporting/service;1" in Components.classes) {
try {
let cm = Components.classes["@mozilla.org/categorymanager;1"]
.getService(Components.interfaces.nsICategoryManager);
cm.getCategoryEntry("healthreport-js-provider", "SearchesProvider");
} catch (ex) {
// Health Report disabled, or no SearchesProvider.
finish();
return;
}

View File

@ -5,8 +5,11 @@
function test() {
waitForExplicitFinish();
if (!("@mozilla.org/datareporting/service;1" in Cc)) {
try {
let cm = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager);
cm.getCategoryEntry("healthreport-js-provider", "SearchesProvider");
} catch (ex) {
// Health Report disabled, or no SearchesProvider.
ok(true, "Firefox Health Report is not enabled.");
finish();
return;

View File

@ -6,7 +6,12 @@
function test() {
waitForExplicitFinish();
if (!("@mozilla.org/datareporting/service;1" in Components.classes)) {
try {
let cm = Components.classes["@mozilla.org/categorymanager;1"]
.getService(Components.interfaces.nsICategoryManager);
cm.getCategoryEntry("healthreport-js-provider", "SearchesProvider");
} catch (ex) {
// Health Report disabled, or no SearchesProvider.
// We need a test or else we'll be marked as failure.
ok(true, "Firefox Health Report is not enabled.");
finish();

View File

@ -715,7 +715,6 @@ let TabItems = {
_lastUpdateTime: Date.now(),
_eventListeners: [],
_pauseUpdateForTest: false,
tempCanvas: null,
_reconnectingPaused: false,
tabItemPadding: {},
_mozAfterPaintHandler: null,
@ -744,11 +743,6 @@ let TabItems = {
.attr('moz-opaque', '');
$canvas.appendTo(iQ("body"));
$canvas.hide();
this.tempCanvas = $canvas[0];
// 150 pixels is an empirical size, below which FF's drawWindow()
// algorithm breaks down
this.tempCanvas.width = 150;
this.tempCanvas.height = 112;
let mm = gWindow.messageManager;
this._mozAfterPaintHandler = this.onMozAfterPaint.bind(this);
@ -1386,94 +1380,12 @@ TabCanvas.prototype = Utils.extend(new Subscribable(), {
return;
}
let ctx = this.canvas.getContext("2d");
let tempCanvas = TabItems.tempCanvas;
let bgColor = '#fff';
if (w < tempCanvas.width) {
// Small draw case where nearest-neighbor algorithm breaks down in Windows
// First draw to a larger canvas (150px wide), and then draw that image
// to the destination canvas.
let tempCtx = tempCanvas.getContext("2d");
this._drawWindow(tempCtx, tempCanvas.width, tempCanvas.height, bgColor);
// Now copy to tabitem canvas.
try {
this._fillCanvasBackground(ctx, w, h, bgColor);
ctx.drawImage(tempCanvas, 0, 0, w, h);
} catch (e) {
Utils.error('paint', e);
}
} else {
// General case where nearest neighbor algorithm looks good
// Draw directly to the destination canvas
this._drawWindow(ctx, w, h, bgColor);
}
let win = this.tab.linkedBrowser.contentWindow;
gPageThumbnails.captureToCanvas(win, this.canvas);
this._sendToSubscribers("painted");
},
// ----------
// Function: _fillCanvasBackground
// Draws a rectangle of <width>x<height> with color <bgColor> to the given
// canvas context.
_fillCanvasBackground: function TabCanvas__fillCanvasBackground(ctx, width, height, bgColor) {
ctx.fillStyle = bgColor;
ctx.fillRect(0, 0, width, height);
},
// ----------
// Function: _drawWindow
// Draws contents of the tabs' browser window to the given canvas context.
_drawWindow: function TabCanvas__drawWindow(ctx, width, height, bgColor) {
this._fillCanvasBackground(ctx, width, height, bgColor);
let rect = this._calculateClippingRect(width, height);
let scaler = width / rect.width;
ctx.save();
ctx.scale(scaler, scaler);
try {
let win = this.tab.linkedBrowser.contentWindow;
ctx.drawWindow(win, rect.left, rect.top, rect.width, rect.height,
bgColor, ctx.DRAWWINDOW_DO_NOT_FLUSH);
} catch (e) {
Utils.error('paint', e);
}
ctx.restore();
},
// ----------
// Function: _calculateClippingRect
// Calculate the clipping rect that will be projected to the tab's
// thumbnail canvas.
_calculateClippingRect: function TabCanvas__calculateClippingRect(origWidth, origHeight) {
let win = this.tab.linkedBrowser.contentWindow;
// TODO BUG 631593: retrieve actual scrollbar width
// 25px is supposed to be width of the vertical scrollbar
let maxWidth = Math.max(1, win.innerWidth - 25);
let maxHeight = win.innerHeight;
let height = Math.min(maxHeight, Math.floor(origHeight * maxWidth / origWidth));
let width = Math.floor(origWidth * height / origHeight);
// very short pages in combination with a very wide browser window force us
// to extend the clipping rect and add some empty space around the thumb
let factor = 0.7;
if (width < maxWidth * factor) {
width = maxWidth * factor;
height = Math.floor(origHeight * width / origWidth);
}
let left = win.scrollX + Math.max(0, Math.round((maxWidth - width) / 2));
let top = win.scrollY;
return new Rect(left, top, width, height);
},
// ----------
// Function: toImageData
toImageData: function TabCanvas_toImageData() {

View File

@ -27,7 +27,6 @@ _BROWSER_FILES = \
browser_tabview_bug590606.js \
browser_tabview_bug591706.js \
browser_tabview_bug593283.js \
browser_tabview_bug594958.js \
browser_tabview_bug595191.js \
browser_tabview_bug595436.js \
browser_tabview_bug595518.js \

View File

@ -1,144 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
let win;
let cw;
let getGroupItem = function (index) {
return cw.GroupItems.groupItems[index];
}
let finishTest = function () {
win.close();
finish();
}
// very long page that produces black bars at the right
let html1 = '<html><body style="background-color: %2300f;">' +
'<div style="background: %23fff; width: 95%; height: 10000px; ' +
' margin: 0 auto;"></div></body></html>';
// very short page that produces black bars at the bottom
let html2 = '<html><body style="background-color: %2300f;"></body></html>';
let tests = [{
url: 'data:text/html,' + html1,
colors: [
{right: [255, 255, 255], bottom: [255, 255, 255]},
{right: [255, 255, 255], bottom: [255, 255, 255]},
{right: [255, 255, 255], bottom: [255, 255, 255]}
]
}, {
url: 'about:blank',
colors: [
{right: [255, 255, 255], bottom: [255, 255, 255]},
{right: [255, 255, 255], bottom: [255, 255, 255]},
{right: [255, 255, 255], bottom: [255, 255, 255]}
]
}, {
url: 'data:text/html,' + html2,
colors: [
{right: [0, 0, 255], bottom: [0, 0, 255]},
{right: [0, 0, 255], bottom: [0, 0, 255]},
{right: [0, 0, 255], bottom: [0, 0, 255]}
]
}];
let next = function () {
if (!tests.length) {
finishTest();
return;
}
let test = tests.shift();
let tab = win.gBrowser.tabs[0];
let browser = tab.linkedBrowser;
browser.addEventListener("load", function onLoad(event) {
browser.removeEventListener("load", onLoad, true);
let tabItem = tab._tabViewTabItem;
tabItem.addSubscriber("updated", function onUpdated() {
tabItem.removeSubscriber("updated", onUpdated);
checkUrl(test);
});
}, true);
browser.loadURI(test.url);
}
let checkUrl = function (test) {
let sizes = [[-400, 0], [800, -200], [-400, 200]];
let nextSize = function () {
if (!sizes.length) {
next();
return;
}
let size = sizes.shift();
let colors = test.colors.shift();
let groupItem = getGroupItem(0);
let checkWithSmallItemSize = function () {
groupItem.setSize(150, 150, true);
groupItem.setUserSize();
afterAllTabItemsUpdated(function () {
checkPixelColors(test.url, colors, nextSize);
}, win);
}
let checkWithNormalItemSize = function () {
groupItem.setSize(300, 300, true);
groupItem.setUserSize();
afterAllTabItemsUpdated(function () {
checkPixelColors(test.url, colors, checkWithSmallItemSize);
}, win);
}
win.resizeBy.apply(win, size);
checkWithNormalItemSize();
}
nextSize();
}
let checkPixelColors = function (url, colors, callback) {
let tab = win.gBrowser.tabs[0];
let $canvas = tab._tabViewTabItem.$canvas;
// Use the direct canvas sizes instead of querying
// iQ bounds, which may not be current.
let width = $canvas[0].width;
let height = $canvas[0].height;
let ctx = $canvas[0].getContext("2d");
afterAllTabItemsUpdated(function () {
checkPixelColor(ctx, url, colors.bottom, Math.floor(width / 4), height - 1, 'bottom');
checkPixelColor(ctx, url, colors.right, width - 1, Math.floor(height / 4), 'right');
callback();
}, win);
}
let checkPixelColor = function (ctx, url, color, x, y, edge) {
let data = ctx.getImageData(x, y, 1, 1).data;
let check = (data[0] == color[0] && data[1] == color[1] && data[2] == color[2]);
ok(check, url + ': ' + edge + ' edge color matches pixel value');
}
waitForExplicitFinish();
newWindowWithTabView(function(newWin) {
win = newWin;
registerCleanupFunction(function () {
if (!win.closed)
win.close();
});
cw = win.TabView.getContentWindow();
next();
}, null, 800, 600);
}

Binary file not shown.

View File

@ -1,6 +1,6 @@
#
# Certificate "b2g-app-root-cert"
# Certificate "test-b2g-app-root-cert"
#
# Issuer: C=US,ST=CA,L=Mountain View,O=MarketplaceTest Corporation,OU=MarketplaceTest CA,CN=MarketplaceTest Root CA 1
# Serial Number: 1 (0x1)
@ -13,7 +13,7 @@ CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
CKA_TOKEN CK_BBOOL CK_TRUE
CKA_PRIVATE CK_BBOOL CK_FALSE
CKA_MODIFIABLE CK_BBOOL CK_FALSE
CKA_LABEL UTF8 "b2g-app-root-cert"
CKA_LABEL UTF8 "test-b2g-app-root-cert"
CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
CKA_SUBJECT MULTILINE_OCTAL
\060\201\231\061\042\060\040\006\003\125\004\003\023\031\115\141
@ -109,7 +109,7 @@ CKA_VALUE MULTILINE_OCTAL
\306\351\144\072\025\076\343\163\320\131\344\331\332\203
END
# Trust for "b2g-app-root-cert"
# Trust for "test-b2g-app-root-cert"
# Issuer: C=US,ST=CA,L=Mountain View,O=MarketplaceTest Corporation,OU=MarketplaceTest CA,CN=MarketplaceTest Root CA 1
# Serial Number: 1 (0x1)
# Subject: C=US,ST=CA,L=Mountain View,O=MarketplaceTest Corporation,OU=MarketplaceTest CA,CN=MarketplaceTest Root CA 1
@ -121,7 +121,7 @@ CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
CKA_TOKEN CK_BBOOL CK_TRUE
CKA_PRIVATE CK_BBOOL CK_FALSE
CKA_MODIFIABLE CK_BBOOL CK_FALSE
CKA_LABEL UTF8 "b2g-app-root-cert"
CKA_LABEL UTF8 "test-b2g-app-root-cert"
CKA_CERT_SHA1_HASH MULTILINE_OCTAL
\066\307\063\100\136\134\123\216\275\061\271\017\112\154\060\206
\144\362\322\341
@ -148,3 +148,161 @@ CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
#
# Certificate "b2g-app-root-cert"
#
# Issuer: CN=root-ca-production-marketplace,OU=Mozilla Marketplace Production Signing Service,O=Mozilla Corporation,C=US
# Serial Number: 1 (0x1)
# Subject: CN=root-ca-production-marketplace,OU=Mozilla Marketplace Production Signing Service,O=Mozilla Corporation,C=US
# Not Valid Before: Wed Feb 27 00:14:56 2013
# Not Valid After : Sat Feb 25 00:14:56 2023
# Fingerprint (MD5): 88:28:0F:FD:5E:1C:AB:EE:5A:2A:EA:80:40:52:75:8D
# Fingerprint (SHA1): 1B:EC:5F:10:98:02:35:7F:CD:7C:7E:A9:1B:D0:B0:96:4D:EA:79:34
CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
CKA_TOKEN CK_BBOOL CK_TRUE
CKA_PRIVATE CK_BBOOL CK_FALSE
CKA_MODIFIABLE CK_BBOOL CK_FALSE
CKA_LABEL UTF8 "b2g-app-root-cert"
CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
CKA_SUBJECT MULTILINE_OCTAL
\060\201\215\061\013\060\011\006\003\125\004\006\023\002\125\123
\061\034\060\032\006\003\125\004\012\023\023\115\157\172\151\154
\154\141\040\103\157\162\160\157\162\141\164\151\157\156\061\067
\060\065\006\003\125\004\013\023\056\115\157\172\151\154\154\141
\040\115\141\162\153\145\164\160\154\141\143\145\040\120\162\157
\144\165\143\164\151\157\156\040\123\151\147\156\151\156\147\040
\123\145\162\166\151\143\145\061\047\060\045\006\003\125\004\003
\023\036\162\157\157\164\055\143\141\055\160\162\157\144\165\143
\164\151\157\156\055\155\141\162\153\145\164\160\154\141\143\145
END
CKA_ID UTF8 "0"
CKA_ISSUER MULTILINE_OCTAL
\060\201\215\061\013\060\011\006\003\125\004\006\023\002\125\123
\061\034\060\032\006\003\125\004\012\023\023\115\157\172\151\154
\154\141\040\103\157\162\160\157\162\141\164\151\157\156\061\067
\060\065\006\003\125\004\013\023\056\115\157\172\151\154\154\141
\040\115\141\162\153\145\164\160\154\141\143\145\040\120\162\157
\144\165\143\164\151\157\156\040\123\151\147\156\151\156\147\040
\123\145\162\166\151\143\145\061\047\060\045\006\003\125\004\003
\023\036\162\157\157\164\055\143\141\055\160\162\157\144\165\143
\164\151\157\156\055\155\141\162\153\145\164\160\154\141\143\145
END
CKA_SERIAL_NUMBER MULTILINE_OCTAL
\002\001\001
END
CKA_VALUE MULTILINE_OCTAL
\060\202\004\225\060\202\003\175\240\003\002\001\002\002\001\001
\060\015\006\011\052\206\110\206\367\015\001\001\014\005\000\060
\201\215\061\013\060\011\006\003\125\004\006\023\002\125\123\061
\034\060\032\006\003\125\004\012\023\023\115\157\172\151\154\154
\141\040\103\157\162\160\157\162\141\164\151\157\156\061\067\060
\065\006\003\125\004\013\023\056\115\157\172\151\154\154\141\040
\115\141\162\153\145\164\160\154\141\143\145\040\120\162\157\144
\165\143\164\151\157\156\040\123\151\147\156\151\156\147\040\123
\145\162\166\151\143\145\061\047\060\045\006\003\125\004\003\023
\036\162\157\157\164\055\143\141\055\160\162\157\144\165\143\164
\151\157\156\055\155\141\162\153\145\164\160\154\141\143\145\060
\036\027\015\061\063\060\062\062\067\060\060\061\064\065\066\132
\027\015\062\063\060\062\062\065\060\060\061\064\065\066\132\060
\201\215\061\013\060\011\006\003\125\004\006\023\002\125\123\061
\034\060\032\006\003\125\004\012\023\023\115\157\172\151\154\154
\141\040\103\157\162\160\157\162\141\164\151\157\156\061\067\060
\065\006\003\125\004\013\023\056\115\157\172\151\154\154\141\040
\115\141\162\153\145\164\160\154\141\143\145\040\120\162\157\144
\165\143\164\151\157\156\040\123\151\147\156\151\156\147\040\123
\145\162\166\151\143\145\061\047\060\045\006\003\125\004\003\023
\036\162\157\157\164\055\143\141\055\160\162\157\144\165\143\164
\151\157\156\055\155\141\162\153\145\164\160\154\141\143\145\060
\202\001\040\060\015\006\011\052\206\110\206\367\015\001\001\001
\005\000\003\202\001\015\000\060\202\001\010\002\202\001\001\000
\247\162\151\213\076\310\222\363\334\154\146\146\016\060\313\203
\342\133\011\201\206\205\341\236\265\111\162\337\154\163\114\114
\056\023\374\024\374\157\204\110\223\124\235\112\142\152\007\151
\376\302\236\315\167\150\150\067\253\207\173\120\035\007\172\016
\135\263\061\115\251\037\176\377\134\265\267\043\123\255\333\044
\210\201\276\020\340\164\047\364\126\315\002\156\322\366\064\265
\063\365\113\326\220\122\213\011\253\053\021\150\235\140\007\252
\000\127\247\320\111\172\277\061\100\325\176\255\364\366\124\125
\005\076\355\204\256\011\254\240\373\060\116\350\116\100\014\035
\337\101\013\372\126\044\243\326\227\322\255\002\020\214\072\124
\276\211\154\104\246\161\267\172\156\247\333\365\046\056\213\030
\265\031\213\237\352\255\001\334\303\151\137\130\275\070\044\002
\344\314\045\276\075\303\255\131\135\053\246\200\060\206\074\130
\150\055\100\215\227\360\242\160\224\241\103\357\334\120\002\231
\070\062\375\037\321\150\246\350\265\214\261\030\071\123\110\277
\155\320\342\315\360\106\071\350\376\024\173\162\341\340\242\377
\002\001\003\243\201\377\060\201\374\060\014\006\003\125\035\023
\004\005\060\003\001\001\377\060\016\006\003\125\035\017\001\001
\377\004\004\003\002\001\006\060\026\006\003\125\035\045\001\001
\377\004\014\060\012\006\010\053\006\001\005\005\007\003\003\060
\201\244\006\003\125\035\043\004\201\234\060\201\231\241\201\223
\244\201\220\060\201\215\061\013\060\011\006\003\125\004\006\023
\002\125\123\061\034\060\032\006\003\125\004\012\023\023\115\157
\172\151\154\154\141\040\103\157\162\160\157\162\141\164\151\157
\156\061\067\060\065\006\003\125\004\013\023\056\115\157\172\151
\154\154\141\040\115\141\162\153\145\164\160\154\141\143\145\040
\120\162\157\144\165\143\164\151\157\156\040\123\151\147\156\151
\156\147\040\123\145\162\166\151\143\145\061\047\060\045\006\003
\125\004\003\023\036\162\157\157\164\055\143\141\055\160\162\157
\144\165\143\164\151\157\156\055\155\141\162\153\145\164\160\154
\141\143\145\202\001\001\060\035\006\003\125\035\016\004\026\004
\024\143\177\362\340\322\062\041\230\377\266\043\145\112\077\360
\275\352\307\245\154\060\015\006\011\052\206\110\206\367\015\001
\001\014\005\000\003\202\001\001\000\063\313\340\240\170\214\253
\145\170\076\242\217\337\362\037\173\002\344\271\077\272\056\025
\265\005\055\061\351\104\101\006\246\224\236\013\253\176\046\236
\233\110\266\225\230\074\036\053\366\105\072\217\165\241\320\205
\221\212\220\056\014\342\265\075\147\172\371\357\255\004\350\273
\156\112\166\340\306\302\067\135\067\374\311\127\120\341\013\007
\300\201\245\174\226\036\253\042\044\217\217\360\034\070\362\152
\343\113\166\224\371\304\121\034\222\356\255\115\011\204\160\020
\144\272\361\333\341\151\135\271\061\163\324\010\276\341\252\135
\023\162\376\175\255\350\165\353\240\063\250\067\132\345\211\170
\367\344\241\044\156\201\367\010\072\126\010\061\053\125\245\216
\165\262\047\277\325\064\304\374\055\333\274\332\364\361\210\122
\213\104\243\342\316\344\037\242\243\047\014\134\223\366\356\363
\047\065\155\241\130\252\072\320\210\312\354\306\045\260\146\124
\327\207\117\164\300\131\247\271\165\370\214\253\356\177\071\051
\303\273\137\365\100\313\143\236\214\133\217\066\150\253\037\112
\232\045\243\102\140\264\076\054\333
END
# Trust for "b2g-app-root-cert"
# Issuer: CN=root-ca-production-marketplace,OU=Mozilla Marketplace Production Signing Service,O=Mozilla Corporation,C=US
# Serial Number: 1 (0x1)
# Subject: CN=root-ca-production-marketplace,OU=Mozilla Marketplace Production Signing Service,O=Mozilla Corporation,C=US
# Not Valid Before: Wed Feb 27 00:14:56 2013
# Not Valid After : Sat Feb 25 00:14:56 2023
# Fingerprint (MD5): 88:28:0F:FD:5E:1C:AB:EE:5A:2A:EA:80:40:52:75:8D
# Fingerprint (SHA1): 1B:EC:5F:10:98:02:35:7F:CD:7C:7E:A9:1B:D0:B0:96:4D:EA:79:34
CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
CKA_TOKEN CK_BBOOL CK_TRUE
CKA_PRIVATE CK_BBOOL CK_FALSE
CKA_MODIFIABLE CK_BBOOL CK_FALSE
CKA_LABEL UTF8 "b2g-app-root-cert"
CKA_CERT_SHA1_HASH MULTILINE_OCTAL
\033\354\137\020\230\002\065\177\315\174\176\251\033\320\260\226
\115\352\171\064
END
CKA_CERT_MD5_HASH MULTILINE_OCTAL
\210\050\017\375\136\034\253\356\132\052\352\200\100\122\165\215
END
CKA_ISSUER MULTILINE_OCTAL
\060\201\215\061\013\060\011\006\003\125\004\006\023\002\125\123
\061\034\060\032\006\003\125\004\012\023\023\115\157\172\151\154
\154\141\040\103\157\162\160\157\162\141\164\151\157\156\061\067
\060\065\006\003\125\004\013\023\056\115\157\172\151\154\154\141
\040\115\141\162\153\145\164\160\154\141\143\145\040\120\162\157
\144\165\143\164\151\157\156\040\123\151\147\156\151\156\147\040
\123\145\162\166\151\143\145\061\047\060\045\006\003\125\004\003
\023\036\162\157\157\164\055\143\141\055\160\162\157\144\165\143
\164\151\157\156\055\155\141\162\153\145\164\160\154\141\143\145
END
CKA_SERIAL_NUMBER MULTILINE_OCTAL
\002\001\001
END
CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE

Binary file not shown.

View File

@ -49,6 +49,12 @@ function original_app_path(test_name) {
return do_get_file("test_signed_apps/" + test_name + ".zip", false);
}
add_test(function () {
certdb.openSignedJARFileAsync(
original_app_path("test-privileged-app-test-1.0"),
check_open_result("test-privileged-app-test-1.0", Cr.NS_OK));
});
add_test(function () {
certdb.openSignedJARFileAsync(
original_app_path("privileged-app-test-1.0"),

View File

@ -145,6 +145,7 @@ this.PageThumbs = {
let ctx = aCanvas.getContext("2d");
// Scale the canvas accordingly.
ctx.save();
ctx.scale(scale, scale);
try {
@ -155,6 +156,8 @@ this.PageThumbs = {
// We couldn't draw to the canvas for some reason.
}
ctx.restore();
let telemetry = Services.telemetry;
telemetry.getHistogramById("FX_THUMBNAILS_CAPTURE_TIME_MS")
.add(new Date() - telemetryCaptureTime);
@ -238,8 +241,15 @@ this.PageThumbs = {
* @return An array containing width, height and scale.
*/
_determineCropSize: function PageThumbs_determineCropSize(aWindow, aCanvas) {
let sw = aWindow.innerWidth;
let sh = aWindow.innerHeight;
let utils = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let sbWidth = {}, sbHeight = {};
utils.getScrollbarSize(false, sbWidth, sbHeight);
// Even in RTL mode, scrollbars are always on the right.
// So there's no need to determine a left offset.
let sw = aWindow.innerWidth - sbWidth.value;
let sh = aWindow.innerHeight - sbHeight.value;
let {width: thumbnailWidth, height: thumbnailHeight} = aCanvas;
let scale = Math.min(Math.max(thumbnailWidth / sw, thumbnailHeight / sh), 1);

View File

@ -19,8 +19,10 @@ _BROWSER_FILES = \
browser_thumbnails_storage.js \
browser_thumbnails_storage_migrate3.js \
browser_thumbnails_bug726727.js \
browser_thumbnails_bug727765.js \
head.js \
background_red.html \
background_red_scroll.html \
background_red_redirect.sjs \
privacy_cache_control.sjs \
$(NULL)

View File

@ -0,0 +1,3 @@
<html>
<body bgcolor=ff0000 style="overflow: scroll;"></body>
</html>

View File

@ -0,0 +1,20 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
const URL = "http://mochi.test:8888/browser/toolkit/components/thumbnails/" +
"test/background_red_scroll.html";
// Test for black borders caused by scrollbars.
function runTests() {
// Create a tab with a page with a red background and scrollbars.
yield addTab(URL);
yield captureAndCheckColor(255, 0, 0, "we have a red thumbnail");
// Check the thumbnail color of the bottom right pixel.
yield whenFileExists(URL);
yield retrieveImageDataForURL(URL, function (aData) {
let [r, g, b] = [].slice.call(aData, -4);
is("" + [r,g,b], "255,0,0", "we have a red thumbnail");
next();
});
}

View File

@ -18,5 +18,8 @@ function runTests() {
// Wait until the referrer's thumbnail's file has been written.
yield whenFileExists(URL);
yield checkThumbnailColor(URL, 255, 0, 0, "referrer has a red thumbnail");
yield retrieveImageDataForURL(URL, function ([r, g, b]) {
is("" + [r,g,b], "255,0,0", "referrer has a red thumbnail");
next();
});
}

View File

@ -3,8 +3,8 @@
let tmp = {};
Cu.import("resource://gre/modules/PageThumbs.jsm", tmp);
let PageThumbs = tmp.PageThumbs;
let PageThumbsStorage = tmp.PageThumbsStorage;
Cu.import("resource:///modules/sessionstore/SessionStore.jsm", tmp);
let {PageThumbs, PageThumbsStorage, SessionStore} = tmp;
Cu.import("resource://gre/modules/PlacesUtils.jsm");
@ -29,12 +29,15 @@ let TestRunner = {
*/
run: function () {
waitForExplicitFinish();
this._iter = runTests();
if (this._iter)
this.next();
else
finish();
SessionStore.promiseInitialized.then(function () {
this._iter = runTests();
if (this._iter) {
this.next();
} else {
finish();
}
}.bind(this));
},
/**
@ -102,19 +105,20 @@ function captureAndCheckColor(aRed, aGreen, aBlue, aMessage) {
// Capture the screenshot.
PageThumbs.captureAndStore(browser, function () {
checkThumbnailColor(browser.currentURI.spec, aRed, aGreen, aBlue, aMessage);
retrieveImageDataForURL(browser.currentURI.spec, function ([r, g, b]) {
is("" + [r,g,b], "" + [aRed, aGreen, aBlue], aMessage);
next();
});
});
}
/**
* Retrieve a thumbnail from the cache and compare its pixel color values.
* @param aURL The URL of the thumbnail's page.
* @param aRed The red component's intensity.
* @param aGreen The green component's intensity.
* @param aBlue The blue component's intensity.
* @param aMessage The info message to print when comparing the pixel color.
* For a given URL, loads the corresponding thumbnail
* to a canvas and passes its image data to the callback.
* @param aURL The url associated with the thumbnail.
* @param aCallback The function to pass the image data to.
*/
function checkThumbnailColor(aURL, aRed, aGreen, aBlue, aMessage) {
function retrieveImageDataForURL(aURL, aCallback) {
let width = 100, height = 100;
let thumb = PageThumbs.getThumbnailURL(aURL, width, height);
@ -130,25 +134,10 @@ function checkThumbnailColor(aURL, aRed, aGreen, aBlue, aMessage) {
// Draw the image to a canvas and compare the pixel color values.
let ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0, width, height);
checkCanvasColor(ctx, aRed, aGreen, aBlue, aMessage);
next();
aCallback(ctx.getImageData(0, 0, 100, 100).data);
});
}
/**
* Checks the top-left pixel of a given canvas' 2d context for a given color.
* @param aContext The 2D context of a canvas.
* @param aRed The red component's intensity.
* @param aGreen The green component's intensity.
* @param aBlue The blue component's intensity.
* @param aMessage The info message to print when comparing the pixel color.
*/
function checkCanvasColor(aContext, aRed, aGreen, aBlue, aMessage) {
let [r, g, b] = aContext.getImageData(0, 0, 1, 1).data;
ok(r == aRed && g == aGreen && b == aBlue, aMessage);
}
/**
* Checks if a thumbnail for the given URL exists.
* @param aURL The url associated to the thumbnail.