Merge f-t to m-c, a=merge

This commit is contained in:
Phil Ringnalda 2015-01-31 09:06:14 -08:00
commit 1c0ae8ffca
110 changed files with 23163 additions and 20039 deletions

View File

@ -0,0 +1,8 @@
/* 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/. */
html:not(.crashDumpSubmitted) #reportSent,
html:not(.crashDumpAvailable) #report-box {
display: none;
}

View File

@ -12,21 +12,35 @@ function parseQueryString() {
document.title = parseQueryString(); document.title = parseQueryString();
addEventListener("DOMContentLoaded", () => { function shouldSendReport() {
let tryAgain = document.getElementById("tryAgain"); if (!document.documentElement.classList.contains("crashDumpAvailable"))
let sendCrashReport = document.getElementById("checkSendReport"); return false;
return document.getElementById("sendReport").checked;
}
tryAgain.addEventListener("click", () => { function sendEvent(message) {
let event = new CustomEvent("AboutTabCrashedTryAgain", { let event = new CustomEvent("AboutTabCrashedMessage", {
bubbles: true, bubbles: true,
detail: { detail: {
sendCrashReport: sendCrashReport.checked, message,
}, sendCrashReport: shouldSendReport(),
}); },
document.dispatchEvent(event);
}); });
});
document.dispatchEvent(event);
}
function closeTab() {
sendEvent("closeTab");
}
function restoreTab() {
sendEvent("restoreTab");
}
function restoreAll() {
sendEvent("restoreAll");
}
// Error pages are loaded as LOAD_BACKGROUND, so they don't get load events. // Error pages are loaded as LOAD_BACKGROUND, so they don't get load events.
var event = new CustomEvent("AboutTabCrashedLoad", {bubbles:true}); var event = new CustomEvent("AboutTabCrashedLoad", {bubbles:true});

View File

@ -12,18 +12,19 @@
<!ENTITY % globalDTD <!ENTITY % globalDTD
SYSTEM "chrome://global/locale/global.dtd"> SYSTEM "chrome://global/locale/global.dtd">
%globalDTD; %globalDTD;
<!ENTITY % browserDTD
SYSTEM "chrome://browser/locale/browser.dtd">
%browserDTD;
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" > <!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
%brandDTD; %brandDTD;
<!ENTITY % tabCrashedDTD
SYSTEM "chrome://browser/locale/aboutTabCrashed.dtd">
%tabCrashedDTD;
]> ]>
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<link rel="stylesheet" type="text/css" media="all" <link rel="stylesheet" type="text/css" media="all"
href="chrome://global/skin/in-content/info-pages.css"/> href="chrome://global/skin/in-content/info-pages.css"/>
<link rel="stylesheet" type="text/css" media="all"
href="chrome://browser/content/aboutTabCrashed.css"/>
<link rel="stylesheet" type="text/css" media="all" <link rel="stylesheet" type="text/css" media="all"
href="chrome://browser/skin/aboutTabCrashed.css"/> href="chrome://browser/skin/aboutTabCrashed.css"/>
</head> </head>
@ -36,12 +37,19 @@
<p>&tabCrashed.message;</p> <p>&tabCrashed.message;</p>
<div id="report-box"> <div id="report-box">
<input type="checkbox" id="checkSendReport" checked="checked"/> <input type="checkbox" id="sendReport" checked="checked"/>
<label for="checkSendReport">&tabCrashed.checkSendReport;</label> <label for="sendReport">&tabCrashed.sendReport;</label>
</div> </div>
<p id="reportSent">&tabCrashed.reportSent;</p>
<div class="button-container"> <div class="button-container">
<button id="tryAgain">&tabCrashed.tryAgain;</button> <button id="closeTab" onclick="closeTab()">
&tabCrashed.closeTab;</button>
<button id="restoreTab" onclick="restoreTab()">
&tabCrashed.restoreTab;</button>
<button id="restoreAll" onclick="restoreAll()" autofocus="true" class="primary">
&tabCrashed.restoreAll;</button>
</div> </div>
</div> </div>
</body> </body>

View File

@ -271,6 +271,12 @@ XPCOMUtils.defineLazyGetter(this, "PageMenuParent", function() {
return new tmp.PageMenuParent(); return new tmp.PageMenuParent();
}); });
function* browserWindows() {
let windows = Services.wm.getEnumerator("navigator:browser");
while (windows.hasMoreElements())
yield windows.getNext();
}
/** /**
* We can avoid adding multiple load event listeners and save some time by adding * We can avoid adding multiple load event listeners and save some time by adding
* one listener that calls all real handlers. * one listener that calls all real handlers.
@ -1116,7 +1122,7 @@ var gBrowserInit = {
#endif #endif
}, false, true); }, false, true);
gBrowser.addEventListener("AboutTabCrashedTryAgain", function(event) { gBrowser.addEventListener("AboutTabCrashedMessage", function(event) {
let ownerDoc = event.originalTarget; let ownerDoc = event.originalTarget;
if (!ownerDoc.documentURI.startsWith("about:tabcrashed")) { if (!ownerDoc.documentURI.startsWith("about:tabcrashed")) {
@ -1134,8 +1140,23 @@ var gBrowserInit = {
TabCrashReporter.submitCrashReport(browser); TabCrashReporter.submitCrashReport(browser);
} }
#endif #endif
let tab = gBrowser.getTabForBrowser(browser); let tab = gBrowser.getTabForBrowser(browser);
SessionStore.reviveCrashedTab(tab); switch (event.detail.message) {
case "closeTab":
gBrowser.removeTab(tab, { animate: true });
break;
case "restoreTab":
SessionStore.reviveCrashedTab(tab);
break;
case "restoreAll":
for (let browserWin of browserWindows()) {
for (let tab of window.gBrowser.tabs) {
SessionStore.reviveCrashedTab(tab);
}
}
break;
}
}, false, true); }, false, true);
let uriToLoad = this._getUriToLoad(); let uriToLoad = this._getUriToLoad();
@ -6471,11 +6492,9 @@ function warnAboutClosingWindow() {
return gBrowser.warnAboutClosingTabs(gBrowser.closingTabsEnum.ALL); return gBrowser.warnAboutClosingTabs(gBrowser.closingTabsEnum.ALL);
// Figure out if there's at least one other browser window around. // Figure out if there's at least one other browser window around.
let e = Services.wm.getEnumerator("navigator:browser");
let otherPBWindowExists = false; let otherPBWindowExists = false;
let nonPopupPresent = false; let nonPopupPresent = false;
while (e.hasMoreElements()) { for (let win of browserWindows()) {
let win = e.getNext();
if (!win.closed && win != window) { if (!win.closed && win != window) {
if (isPBWindow && PrivateBrowsingUtils.isWindowPrivate(win)) if (isPBWindow && PrivateBrowsingUtils.isWindowPrivate(win))
otherPBWindowExists = true; otherPBWindowExists = true;
@ -7574,9 +7593,7 @@ function switchToTabHavingURI(aURI, aOpenNew, aOpenParams={}) {
if (isBrowserWindow && switchIfURIInWindow(window)) if (isBrowserWindow && switchIfURIInWindow(window))
return true; return true;
let winEnum = Services.wm.getEnumerator("navigator:browser"); for (let browserWin of browserWindows()) {
while (winEnum.hasMoreElements()) {
let browserWin = winEnum.getNext();
// Skip closed (but not yet destroyed) windows, // Skip closed (but not yet destroyed) windows,
// and the current window (which was checked earlier). // and the current window (which was checked earlier).
if (browserWin.closed || browserWin == window) if (browserWin.closed || browserWin == window)

View File

@ -51,9 +51,10 @@ tabpanels {
} }
} }
.tab-icon-image:not([src]):not([pinned]), .tab-icon-image:not([src]):not([pinned]):not([crashed]),
.tab-throbber:not([busy]), .tab-throbber:not([busy]),
.tab-throbber[busy] + .tab-icon-image { .tab-icon-image[busy],
.tab-icon-overlay[busy] {
display: none; display: none;
} }

View File

@ -664,9 +664,13 @@
// We need to add 2 because loadURIWithFlags may have // We need to add 2 because loadURIWithFlags may have
// cancelled a pending load which would have cleared // cancelled a pending load which would have cleared
// its anchor scroll detection temporary increment. // its anchor scroll detection temporary increment.
if (aWebProgress.isTopLevel) if (aWebProgress.isTopLevel) {
this.mBrowser.userTypedClear += 2; this.mBrowser.userTypedClear += 2;
// If the browser is loading it must not be crashed anymore
this.mTab.removeAttribute("crashed");
}
if (this._shouldShowProgress(aRequest)) { if (this._shouldShowProgress(aRequest)) {
if (!(aStateFlags & nsIWebProgressListener.STATE_RESTORING)) { if (!(aStateFlags & nsIWebProgressListener.STATE_RESTORING)) {
this.mTab.setAttribute("busy", "true"); this.mTab.setAttribute("busy", "true");
@ -1484,6 +1488,10 @@
if (aShouldBeRemote) { if (aShouldBeRemote) {
tab.setAttribute("remote", "true"); tab.setAttribute("remote", "true");
// Switching the browser to be remote will connect to a new child
// process so the browser can no longer be considered to be
// crashed.
tab.removeAttribute("crashed");
} else { } else {
tab.removeAttribute("remote"); tab.removeAttribute("remote");
aBrowser.messageManager.sendAsyncMessage("Browser:AppTab", { isAppTab: tab.pinned }) aBrowser.messageManager.sendAsyncMessage("Browser:AppTab", { isAppTab: tab.pinned })
@ -3579,6 +3587,7 @@
browser.docShell.displayLoadError(Cr.NS_ERROR_CONTENT_CRASHED, uri, null); browser.docShell.displayLoadError(Cr.NS_ERROR_CONTENT_CRASHED, uri, null);
browser.removeAttribute("crashedPageTitle"); browser.removeAttribute("crashedPageTitle");
let tab = this.getTabForBrowser(browser); let tab = this.getTabForBrowser(browser);
tab.setAttribute("crashed", true);
this.setIcon(tab, icon); this.setIcon(tab, icon);
]]> ]]>
</handler> </handler>
@ -4980,11 +4989,14 @@
class="tab-throbber" class="tab-throbber"
role="presentation" role="presentation"
layer="true" /> layer="true" />
<xul:image xbl:inherits="src=image,fadein,pinned,selected" <xul:image xbl:inherits="src=image,fadein,pinned,selected,busy,crashed"
anonid="tab-icon-image" anonid="tab-icon-image"
class="tab-icon-image" class="tab-icon-image"
validate="never" validate="never"
role="presentation"/> role="presentation"/>
<xul:image xbl:inherits="crashed,busy"
class="tab-icon-overlay"
role="presentation"/>
<xul:label flex="1" <xul:label flex="1"
anonid="tab-label" anonid="tab-label"
xbl:inherits="value=visibleLabel,crop,accesskey,fadein,pinned,selected" xbl:inherits="value=visibleLabel,crop,accesskey,fadein,pinned,selected"

View File

@ -69,6 +69,7 @@ browser.jar:
content/browser/aboutRobots-widget-left.png (content/aboutRobots-widget-left.png) content/browser/aboutRobots-widget-left.png (content/aboutRobots-widget-left.png)
content/browser/aboutSocialError.xhtml (content/aboutSocialError.xhtml) content/browser/aboutSocialError.xhtml (content/aboutSocialError.xhtml)
content/browser/aboutProviderDirectory.xhtml (content/aboutProviderDirectory.xhtml) content/browser/aboutProviderDirectory.xhtml (content/aboutProviderDirectory.xhtml)
content/browser/aboutTabCrashed.css (content/aboutTabCrashed.css)
content/browser/aboutTabCrashed.js (content/aboutTabCrashed.js) content/browser/aboutTabCrashed.js (content/aboutTabCrashed.js)
content/browser/aboutTabCrashed.xhtml (content/aboutTabCrashed.xhtml) content/browser/aboutTabCrashed.xhtml (content/aboutTabCrashed.xhtml)
* content/browser/browser.css (content/browser.css) * content/browser/browser.css (content/browser.css)

View File

@ -3,11 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Shared conversation window styles */ /* Shared conversation window styles */
.standalone .video-layout-wrapper,
.conversation .media video {
background-color: #444;
}
.conversation { .conversation {
position: relative; position: relative;
} }
@ -508,10 +503,11 @@
* XXX this approach is fragile because it makes assumptions * XXX this approach is fragile because it makes assumptions
* about the generated OT markup, any change will break it * about the generated OT markup, any change will break it
*/ */
.local-stream.local-stream-audio,
.standalone .OT_subscriber .OT_video-poster, /*
.fx-embedded .OT_video-container .OT_video-poster, * For any audio-only streams, we want to display our own background
.local-stream-audio .OT_publisher .OT_video-poster { */
.OT_audio-only .OT_widget-container .OT_video-poster {
background-image: url("../img/audio-call-avatar.svg"); background-image: url("../img/audio-call-avatar.svg");
background-repeat: no-repeat; background-repeat: no-repeat;
background-color: #4BA6E7; background-color: #4BA6E7;
@ -519,6 +515,22 @@
background-position: center; background-position: center;
} }
/*
* Audio-only. For local streams, cancel out the SDK's opacity of 0.25.
* For remote streams we leave them shaded, as otherwise its too bright.
*/
.local-stream-audio .OT_publisher .OT_video-poster {
opacity: 1
}
/*
* In audio-only mode, don't display the video element, doing so interferes
* with the background opacity of the video-poster element.
*/
.OT_audio-only .OT_widget-container .OT_video-element {
display: none;
}
/* /*
* Ensure that the publisher (i.e. local) video is never cropped, so that it's * Ensure that the publisher (i.e. local) video is never cropped, so that it's
* not possible for someone to be presented with a picture that displays * not possible for someone to be presented with a picture that displays
@ -537,7 +549,7 @@
* Another less ugly possibility would be to work with Ted Mielczarek to use * Another less ugly possibility would be to work with Ted Mielczarek to use
* the fake camera drivers he has for Linux. * the fake camera drivers he has for Linux.
*/ */
.room-conversation .OT_publisher .OT_video-container { .room-conversation .OT_publisher .OT_widget-container {
height: 100% !important; height: 100% !important;
width: 100% !important; width: 100% !important;
top: 0 !important; top: 0 !important;
@ -545,12 +557,12 @@
background-color: transparent; /* avoid visually obvious letterboxing */ background-color: transparent; /* avoid visually obvious letterboxing */
} }
.room-conversation .OT_publisher .OT_video-container video { .room-conversation .OT_publisher .OT_widget-container video {
background-color: transparent; /* avoid visually obvious letterboxing */ background-color: transparent; /* avoid visually obvious letterboxing */
} }
.fx-embedded .room-conversation .room-preview .OT_publisher .OT_video-container, .fx-embedded .room-conversation .room-preview .OT_publisher .OT_widget-container,
.fx-embedded .room-conversation .room-preview .OT_publisher .OT_video-container video { .fx-embedded .room-conversation .room-preview .OT_publisher .OT_widget-container video {
/* Desktop conversation window room preview local stream actually wants /* Desktop conversation window room preview local stream actually wants
a black background */ a black background */
background-color: #000; background-color: #000;
@ -673,7 +685,6 @@ html, .fx-embedded, #main,
} }
.standalone { .standalone {
max-width: 1000px;
margin: 0 auto; margin: 0 auto;
} }
} }
@ -905,11 +916,6 @@ html, .fx-embedded, #main,
width: 75%; width: 75%;
} }
.standalone .room-conversation .local-stream {
width: 33%;
height: 26.5%;
}
.standalone .room-conversation .conversation-toolbar { .standalone .room-conversation .conversation-toolbar {
background: #000; background: #000;
border: none; border: none;
@ -945,11 +951,6 @@ html, .fx-embedded, #main,
.standalone .room-conversation .video_wrapper.remote_wrapper { .standalone .room-conversation .video_wrapper.remote_wrapper {
width: 100%; width: 100%;
} }
.standalone .room-conversation .local-stream {
/* Assumes 4:3 aspect ratio */
width: 180px;
height: 135px;
}
.standalone .conversation-toolbar { .standalone .conversation-toolbar {
height: 38px; height: 38px;
padding: 8px; padding: 8px;

View File

@ -176,6 +176,15 @@ loop.shared.actions = (function() {
MediaConnected: Action.define("mediaConnected", { MediaConnected: Action.define("mediaConnected", {
}), }),
/**
* Used for notifying that the dimensions of a stream just changed. Also
* dispatched when a stream connects for the first time.
*/
VideoDimensionsChanged: Action.define("videoDimensionsChanged", {
videoType: String,
dimensions: Object
}),
/** /**
* Used to mute or unmute a stream * Used to mute or unmute a stream
*/ */

View File

@ -68,7 +68,9 @@ loop.store.ActiveRoomStore = (function() {
// session. 'Used' means at least one call has been placed // session. 'Used' means at least one call has been placed
// with it. Entering and leaving the room without seeing // with it. Entering and leaving the room without seeing
// anyone is not considered as 'used' // anyone is not considered as 'used'
used: false used: false,
localVideoDimensions: {},
remoteVideoDimensions: {}
}; };
}, },
@ -119,7 +121,8 @@ loop.store.ActiveRoomStore = (function() {
"remotePeerConnected", "remotePeerConnected",
"windowUnload", "windowUnload",
"leaveRoom", "leaveRoom",
"feedbackComplete" "feedbackComplete",
"videoDimensionsChanged"
]); ]);
}, },
@ -477,6 +480,23 @@ loop.store.ActiveRoomStore = (function() {
// Note, that we want some values, such as the windowId, so we don't // Note, that we want some values, such as the windowId, so we don't
// do a full reset here. // do a full reset here.
this.setStoreState(this.getInitialStoreState()); this.setStoreState(this.getInitialStoreState());
},
/**
* Handles a change in dimensions of a video stream and updates the store data
* with the new dimensions of a local or remote stream.
*
* @param {sharedActions.VideoDimensionsChanged} actionData
*/
videoDimensionsChanged: function(actionData) {
// NOTE: in the future, when multiple remote video streams are supported,
// we'll need to make this support multiple remotes as well. Good
// starting point for video tiling.
var storeProp = (actionData.isLocal ? "local" : "remote") + "VideoDimensions";
var nextState = {};
nextState[storeProp] = this.getStoreState()[storeProp];
nextState[storeProp][actionData.videoType] = actionData.dimensions;
this.setStoreState(nextState);
} }
}); });

View File

@ -157,29 +157,217 @@ loop.shared.mixins = (function() {
* elements and handling updates of the media containers. * elements and handling updates of the media containers.
*/ */
var MediaSetupMixin = { var MediaSetupMixin = {
_videoDimensionsCache: {
local: {},
remote: {}
},
componentDidMount: function() { componentDidMount: function() {
rootObject.addEventListener('orientationchange', this.updateVideoContainer); rootObject.addEventListener("orientationchange", this.updateVideoContainer);
rootObject.addEventListener('resize', this.updateVideoContainer); rootObject.addEventListener("resize", this.updateVideoContainer);
}, },
componentWillUnmount: function() { componentWillUnmount: function() {
rootObject.removeEventListener('orientationchange', this.updateVideoContainer); rootObject.removeEventListener("orientationchange", this.updateVideoContainer);
rootObject.removeEventListener('resize', this.updateVideoContainer); rootObject.removeEventListener("resize", this.updateVideoContainer);
},
/**
* Whenever the dimensions change of a video stream, this function is called
* by `updateVideoDimensions` to store the new values and notifies the callee
* if the dimensions changed compared to the currently stored values.
*
* @param {String} which Type of video stream. May be 'local' or 'remote'
* @param {Object} newDimensions Object containing 'width' and 'height' properties
* @return {Boolean} `true` when the dimensions have changed,
* `false` if not
*/
_updateDimensionsCache: function(which, newDimensions) {
var cache = this._videoDimensionsCache[which];
var cacheKeys = Object.keys(cache);
var changed = false;
Object.keys(newDimensions).forEach(function(videoType) {
if (cacheKeys.indexOf(videoType) === -1) {
cache[videoType] = newDimensions[videoType];
cache[videoType].aspectRatio = this.getAspectRatio(cache[videoType]);
changed = true;
return;
}
if (cache[videoType].width !== newDimensions[videoType].width) {
cache[videoType].width = newDimensions[videoType].width;
changed = true;
}
if (cache[videoType].height !== newDimensions[videoType].height) {
cache[videoType].height = newDimensions[videoType].height;
changed = true;
}
if (changed) {
cache[videoType].aspectRatio = this.getAspectRatio(cache[videoType]);
}
}, this);
return changed;
},
/**
* Whenever the dimensions change of a video stream, this function is called
* to process these changes and possibly trigger an update to the video
* container elements.
*
* @param {Object} localVideoDimensions Object containing 'width' and 'height'
* properties grouped by stream name
* @param {Object} remoteVideoDimensions Object containing 'width' and 'height'
* properties grouped by stream name
*/
updateVideoDimensions: function(localVideoDimensions, remoteVideoDimensions) {
var localChanged = this._updateDimensionsCache("local", localVideoDimensions);
var remoteChanged = this._updateDimensionsCache("remote", remoteVideoDimensions);
if (localChanged || remoteChanged) {
this.updateVideoContainer();
}
},
/**
* Get the aspect ratio of a width/ height pair, which should be the dimensions
* of a stream. The returned object is an aspect ratio indexed by 1; the leading
* size has a value smaller than 1 and the slave size has a value of 1.
* this is exactly the same as notations like 4:3 and 16:9, which are merely
* human-readable forms of their fractional counterparts. 4:3 === 1:0.75 and
* 16:9 === 1:0.5625.
* So we're using the aspect ratios in their original form, because that's
* easier to do calculus with.
*
* Example:
* A stream with dimensions `{ width: 640, height: 480 }` yields an indexed
* aspect ratio of `{ width: 1, height: 0.75 }`. This means that the 'height'
* will determine the value of 'width' when the stream is stretched or shrunk
* to fit inside its container element at the maximum size.
*
* @param {Object} dimensions Object containing 'width' and 'height' properties
* @return {Object} Contains the indexed aspect ratio for 'width'
* and 'height' assigned to the corresponding
* properties.
*/
getAspectRatio: function(dimensions) {
if (dimensions.width === dimensions.height) {
return {width: 1, height: 1};
}
var denominator = Math.max(dimensions.width, dimensions.height);
return {
width: dimensions.width / denominator,
height: dimensions.height / denominator
};
},
/**
* Retrieve the dimensions of the remote video stream.
* Example output:
* {
* width: 680,
* height: 480,
* streamWidth: 640,
* streamHeight: 480,
* offsetX: 20,
* offsetY: 0
* }
*
* Note: Once we support multiple remote video streams, this function will
* need to be updated.
* @return {Object} contains the remote stream dimension properties of its
* container node, the stream itself and offset of the stream
* relative to its container node in pixels.
*/
getRemoteVideoDimensions: function() {
var remoteVideoDimensions;
Object.keys(this._videoDimensionsCache.remote).forEach(function(videoType) {
var node = this._getElement("." + (videoType === "camera" ? "remote" : videoType));
var width = node.offsetWidth;
// If the width > 0 then we record its real size by taking its aspect
// ratio in account. Due to the 'contain' fit-mode, the stream will be
// centered inside the video element.
// We'll need to deal with more than one remote video stream whenever
// that becomes something we need to support.
if (width) {
remoteVideoDimensions = {
width: width,
height: node.offsetHeight
};
var ratio = this._videoDimensionsCache.remote[videoType].aspectRatio;
var leadingAxis = Math.min(ratio.width, ratio.height) === ratio.width ?
"width" : "height";
var slaveSize = remoteVideoDimensions[leadingAxis] +
(remoteVideoDimensions[leadingAxis] * (1 - ratio[leadingAxis]));
remoteVideoDimensions.streamWidth = leadingAxis === "width" ?
remoteVideoDimensions.width : slaveSize;
remoteVideoDimensions.streamHeight = leadingAxis === "height" ?
remoteVideoDimensions.height: slaveSize;
}
}, this);
// Supply some sensible defaults for the remoteVideoDimensions if no remote
// stream is connected (yet).
if (!remoteVideoDimensions) {
var node = this._getElement(".remote");
var width = node.offsetWidth;
var height = node.offsetHeight;
remoteVideoDimensions = {
width: width,
height: height,
streamWidth: width,
streamHeight: height
};
}
// Calculate the size of each individual letter- or pillarbox for convenience.
remoteVideoDimensions.offsetX = remoteVideoDimensions.width -
remoteVideoDimensions.streamWidth
if (remoteVideoDimensions.offsetX > 0) {
remoteVideoDimensions.offsetX /= 2;
}
remoteVideoDimensions.offsetY = remoteVideoDimensions.height -
remoteVideoDimensions.streamHeight;
if (remoteVideoDimensions.offsetY > 0) {
remoteVideoDimensions.offsetY /= 2;
}
return remoteVideoDimensions;
}, },
/** /**
* Used to update the video container whenever the orientation or size of the * Used to update the video container whenever the orientation or size of the
* display area changes. * display area changes.
*
* Buffer the calls to this function to make sure we don't overflow the stack
* with update calls when many 'resize' event are fired, to prevent blocking
* the event loop.
*/ */
updateVideoContainer: function() { updateVideoContainer: function() {
var localStreamParent = this._getElement('.local .OT_publisher'); if (this._bufferedUpdateVideo) {
var remoteStreamParent = this._getElement('.remote .OT_subscriber'); rootObject.clearTimeout(this._bufferedUpdateVideo);
if (localStreamParent) { this._bufferedUpdateVideo = null;
localStreamParent.style.width = "100%";
}
if (remoteStreamParent) {
remoteStreamParent.style.height = "100%";
} }
this._bufferedUpdateVideo = rootObject.setTimeout(function() {
this._bufferedUpdateVideo = null;
var localStreamParent = this._getElement(".local .OT_publisher");
var remoteStreamParent = this._getElement(".remote .OT_subscriber");
if (localStreamParent) {
localStreamParent.style.width = "100%";
}
if (remoteStreamParent) {
remoteStreamParent.style.height = "100%";
}
// Update the position and dimensions of the containers of local video
// streams, if necessary. The consumer of this mixin should implement the
// actual updating mechanism.
Object.keys(this._videoDimensionsCache.local).forEach(function(videoType) {
var ratio = this._videoDimensionsCache.local[videoType].aspectRatio
if (videoType == "camera" && this.updateLocalCameraPosition) {
this.updateLocalCameraPosition(ratio);
}
}, this);
}.bind(this), 0);
}, },
/** /**
@ -198,15 +386,11 @@ loop.shared.mixins = (function() {
// @see https://bugzilla.mozilla.org/show_bug.cgi?id=1020445 // @see https://bugzilla.mozilla.org/show_bug.cgi?id=1020445
return { return {
insertMode: "append", insertMode: "append",
fitMode: "contain",
width: "100%", width: "100%",
height: "100%", height: "100%",
publishVideo: options.publishVideo, publishVideo: options.publishVideo,
style: { showControls: false,
audioLevelDisplayMode: "off",
buttonDisplayMode: "off",
nameDisplayMode: "off",
videoDisabledDisplayMode: "off"
}
}; };
}, },

View File

@ -9,6 +9,7 @@ loop.OTSdkDriver = (function() {
var sharedActions = loop.shared.actions; var sharedActions = loop.shared.actions;
var FAILURE_DETAILS = loop.shared.utils.FAILURE_DETAILS; var FAILURE_DETAILS = loop.shared.utils.FAILURE_DETAILS;
var STREAM_PROPERTIES = loop.shared.utils.STREAM_PROPERTIES;
/** /**
* This is a wrapper for the OT sdk. It is used to translate the SDK events into * This is a wrapper for the OT sdk. It is used to translate the SDK events into
@ -51,6 +52,7 @@ loop.OTSdkDriver = (function() {
// the media. // the media.
this.publisher = this.sdk.initPublisher(this.getLocalElement(), this.publisher = this.sdk.initPublisher(this.getLocalElement(),
this.publisherConfig); this.publisherConfig);
this.publisher.on("streamCreated", this._onLocalStreamCreated.bind(this));
this.publisher.on("accessAllowed", this._onPublishComplete.bind(this)); this.publisher.on("accessAllowed", this._onPublishComplete.bind(this));
this.publisher.on("accessDenied", this._onPublishDenied.bind(this)); this.publisher.on("accessDenied", this._onPublishDenied.bind(this));
this.publisher.on("accessDialogOpened", this.publisher.on("accessDialogOpened",
@ -91,6 +93,7 @@ loop.OTSdkDriver = (function() {
this._onConnectionDestroyed.bind(this)); this._onConnectionDestroyed.bind(this));
this.session.on("sessionDisconnected", this.session.on("sessionDisconnected",
this._onSessionDisconnected.bind(this)); this._onSessionDisconnected.bind(this));
this.session.on("streamPropertyChanged", this._onStreamPropertyChanged.bind(this));
// This starts the actual session connection. // This starts the actual session connection.
this.session.connect(sessionData.apiKey, sessionData.sessionToken, this.session.connect(sessionData.apiKey, sessionData.sessionToken,
@ -102,12 +105,13 @@ loop.OTSdkDriver = (function() {
*/ */
disconnectSession: function() { disconnectSession: function() {
if (this.session) { if (this.session) {
this.session.off("streamCreated connectionDestroyed sessionDisconnected"); this.session.off("streamCreated streamDestroyed connectionDestroyed " +
"sessionDisconnected streamPropertyChanged");
this.session.disconnect(); this.session.disconnect();
delete this.session; delete this.session;
} }
if (this.publisher) { if (this.publisher) {
this.publisher.off("accessAllowed accessDenied accessDialogOpened"); this.publisher.off("accessAllowed accessDenied accessDialogOpened streamCreated");
this.publisher.destroy(); this.publisher.destroy();
delete this.publisher; delete this.publisher;
} }
@ -234,6 +238,14 @@ loop.OTSdkDriver = (function() {
* https://tokbox.com/opentok/libraries/client/js/reference/StreamEvent.html * https://tokbox.com/opentok/libraries/client/js/reference/StreamEvent.html
*/ */
_onRemoteStreamCreated: function(event) { _onRemoteStreamCreated: function(event) {
if (event.stream[STREAM_PROPERTIES.HAS_VIDEO]) {
this.dispatcher.dispatch(new sharedActions.VideoDimensionsChanged({
isLocal: false,
videoType: event.stream.videoType,
dimensions: event.stream[STREAM_PROPERTIES.VIDEO_DIMENSIONS]
}));
}
this.session.subscribe(event.stream, this.session.subscribe(event.stream,
this.getRemoteElement(), this.publisherConfig); this.getRemoteElement(), this.publisherConfig);
@ -243,6 +255,22 @@ loop.OTSdkDriver = (function() {
} }
}, },
/**
* Handles the event when the local stream is created.
*
* @param {StreamEvent} event The event details:
* https://tokbox.com/opentok/libraries/client/js/reference/StreamEvent.html
*/
_onLocalStreamCreated: function(event) {
if (event.stream[STREAM_PROPERTIES.HAS_VIDEO]) {
this.dispatcher.dispatch(new sharedActions.VideoDimensionsChanged({
isLocal: true,
videoType: event.stream.videoType,
dimensions: event.stream[STREAM_PROPERTIES.VIDEO_DIMENSIONS]
}));
}
},
/** /**
* Called from the sdk when the media access dialog is opened. * Called from the sdk when the media access dialog is opened.
* Prevents the default action, to prevent the SDK's "allow access" * Prevents the default action, to prevent the SDK's "allow access"
@ -282,6 +310,19 @@ loop.OTSdkDriver = (function() {
})); }));
}, },
/**
* Handles publishing of property changes to a stream.
*/
_onStreamPropertyChanged: function(event) {
if (event.changedProperty == STREAM_PROPERTIES.VIDEO_DIMENSIONS) {
this.dispatcher.dispatch(new sharedActions.VideoDimensionsChanged({
isLocal: event.stream.connection.id == this.session.connection.id,
videoType: event.stream.videoType,
dimensions: event.stream[STREAM_PROPERTIES.VIDEO_DIMENSIONS]
}));
}
},
/** /**
* Publishes the local stream if the session is connected * Publishes the local stream if the session is connected
* and the publisher is ready. * and the publisher is ready.

View File

@ -42,6 +42,12 @@ loop.shared.utils = (function(mozL10n) {
UNKNOWN: "reason-unknown" UNKNOWN: "reason-unknown"
}; };
var STREAM_PROPERTIES = {
VIDEO_DIMENSIONS: "videoDimensions",
HAS_AUDIO: "hasAudio",
HAS_VIDEO: "hasVideo"
};
/** /**
* Format a given date into an l10n-friendly string. * Format a given date into an l10n-friendly string.
* *
@ -138,6 +144,7 @@ loop.shared.utils = (function(mozL10n) {
FAILURE_DETAILS: FAILURE_DETAILS, FAILURE_DETAILS: FAILURE_DETAILS,
REST_ERRNOS: REST_ERRNOS, REST_ERRNOS: REST_ERRNOS,
WEBSOCKET_REASONS: WEBSOCKET_REASONS, WEBSOCKET_REASONS: WEBSOCKET_REASONS,
STREAM_PROPERTIES: STREAM_PROPERTIES,
Helper: Helper, Helper: Helper,
composeCallUrlEmail: composeCallUrlEmail, composeCallUrlEmail: composeCallUrlEmail,
formatDate: formatDate, formatDate: formatDate,

View File

@ -11,16 +11,15 @@
/* Root OT object, this is where our CSS reset happens */ /* Root OT object, this is where our CSS reset happens */
.OT_root, .OT_root,
.OT_root * { .OT_root * {
color: #ffffff; color: #ffffff;
margin: 0; margin: 0;
padding: 0; padding: 0;
border: 0; border: 0;
font-size: 100%; font-size: 100%;
font-family: Arial, Helvetica, sans-serif; font-family: Arial, Helvetica, sans-serif;
vertical-align: baseline; vertical-align: baseline;
} }
/** /**
* Specific Element Reset * Specific Element Reset
*/ */
@ -31,10 +30,10 @@
.OT_root h4, .OT_root h4,
.OT_root h5, .OT_root h5,
.OT_root h6 { .OT_root h6 {
color: #ffffff; color: #ffffff;
font-family: Arial, Helvetica, sans-serif; font-family: Arial, Helvetica, sans-serif;
font-size: 100%; font-size: 100%;
font-weight: bold; font-weight: bold;
} }
.OT_root header { .OT_root header {
@ -62,11 +61,11 @@
} }
.OT_root strong { .OT_root strong {
font-weight: bold; font-weight: bold;
} }
.OT_root em { .OT_root em {
font-style: italic; font-style: italic;
} }
.OT_root a, .OT_root a,
@ -74,46 +73,46 @@
.OT_root a:visited, .OT_root a:visited,
.OT_root a:hover, .OT_root a:hover,
.OT_root a:active { .OT_root a:active {
font-family: Arial, Helvetica, sans-serif; font-family: Arial, Helvetica, sans-serif;
} }
.OT_root ul, .OT_root ol { .OT_root ul, .OT_root ol {
margin: 1em 1em 1em 2em; margin: 1em 1em 1em 2em;
} }
.OT_root ol { .OT_root ol {
list-style: decimal outside; list-style: decimal outside;
} }
.OT_root ul { .OT_root ul {
list-style: disc outside; list-style: disc outside;
} }
.OT_root dl { .OT_root dl {
margin: 4px; margin: 4px;
} }
.OT_root dl dt,
.OT_root dl dd {
float: left;
margin: 0;
padding: 0;
}
.OT_root dl dt { .OT_root dl dt,
clear: left; .OT_root dl dd {
text-align: right; float: left;
width: 50px; margin: 0;
} padding: 0;
.OT_root dl dd { }
margin-left: 10px;
} .OT_root dl dt {
clear: left;
text-align: right;
width: 50px;
}
.OT_root dl dd {
margin-left: 10px;
}
.OT_root img { .OT_root img {
border: 0 none; border: 0 none;
} }
/* Modal dialog styles */ /* Modal dialog styles */
/* Modal dialog styles */ /* Modal dialog styles */
@ -166,7 +165,6 @@
text-align: center; text-align: center;
} }
.OT_dialog-messages-main { .OT_dialog-messages-main {
margin-bottom: 36px; margin-bottom: 36px;
line-height: 36px; line-height: 36px;
@ -302,37 +300,34 @@
/* Publisher and Subscriber styles */ /* Publisher and Subscriber styles */
.OT_publisher, .OT_subscriber { .OT_publisher, .OT_subscriber {
position: relative; position: relative;
min-width: 48px; min-width: 48px;
min-height: 48px; min-height: 48px;
} }
.OT_publisher video, .OT_publisher .OT_video-element,
.OT_subscriber video, .OT_subscriber .OT_video-element {
.OT_publisher object, display: block;
.OT_subscriber object { position: absolute;
width: 100%; width: 100%;
height: 100%;
}
.OT_publisher object, transform-origin: 0 0;
.OT_subscriber object {
} }
/* Styles that are applied when the video element should be mirrored */ /* Styles that are applied when the video element should be mirrored */
.OT_publisher.OT_mirrored video{ .OT_publisher.OT_mirrored .OT_video-element {
-webkit-transform: scale(-1, 1); transform: scale(-1, 1);
-moz-transform:scale(-1,1); transform-origin: 50% 50%;
} }
.OT_subscriber_error { .OT_subscriber_error {
background-color: #000; background-color: #000;
color: #fff; color: #fff;
text-align: center; text-align: center;
} }
.OT_subscriber_error > p { .OT_subscriber_error > p {
padding: 20px; padding: 20px;
} }
/* The publisher/subscriber name/mute background */ /* The publisher/subscriber name/mute background */
@ -346,67 +341,67 @@
.OT_subscriber .OT_archiving-status, .OT_subscriber .OT_archiving-status,
.OT_publihser .OT_archiving-light-box, .OT_publihser .OT_archiving-light-box,
.OT_subscriber .OT_archiving-light-box { .OT_subscriber .OT_archiving-light-box {
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
-ms-box-sizing: border-box; -ms-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
top: 0; top: 0;
left: 0; left: 0;
right: 0; right: 0;
display: block; display: block;
height: 34px; height: 34px;
position: absolute; position: absolute;
} }
.OT_publisher .OT_bar, .OT_publisher .OT_bar,
.OT_subscriber .OT_bar { .OT_subscriber .OT_bar {
background: rgba(0, 0, 0, 0.4); background: rgba(0, 0, 0, 0.4);
} }
.OT_publisher .OT_edge-bar-item, .OT_publisher .OT_edge-bar-item,
.OT_subscriber .OT_edge-bar-item { .OT_subscriber .OT_edge-bar-item {
z-index: 1; /* required to get audio level meter underneath */ z-index: 1; /* required to get audio level meter underneath */
} }
/* The publisher/subscriber name panel/archiving status bar */ /* The publisher/subscriber name panel/archiving status bar */
.OT_publisher .OT_name, .OT_publisher .OT_name,
.OT_subscriber .OT_name { .OT_subscriber .OT_name {
background-color: transparent; background-color: transparent;
color: #ffffff; color: #ffffff;
font-size: 15px; font-size: 15px;
line-height: 34px; line-height: 34px;
font-weight: normal; font-weight: normal;
padding: 0 4px 0 36px; padding: 0 4px 0 36px;
} }
.OT_publisher .OT_archiving-status, .OT_publisher .OT_archiving-status,
.OT_subscriber .OT_archiving-status { .OT_subscriber .OT_archiving-status {
background: rgba(0, 0, 0, 0.4); background: rgba(0, 0, 0, 0.4);
top: auto; top: auto;
bottom: 0; bottom: 0;
left: 34px; left: 34px;
padding: 0 4px; padding: 0 4px;
color: rgba(255,255,255,0.8); color: rgba(255, 255, 255, 0.8);
font-size: 15px; font-size: 15px;
line-height: 34px; line-height: 34px;
font-weight: normal; font-weight: normal;
} }
.OT_micro .OT_archiving-status, .OT_micro .OT_archiving-status,
.OT_micro:hover .OT_archiving-status, .OT_micro:hover .OT_archiving-status,
.OT_mini .OT_archiving-status, .OT_mini .OT_archiving-status,
.OT_mini:hover .OT_archiving-status { .OT_mini:hover .OT_archiving-status {
display: none; display: none;
} }
.OT_publisher .OT_archiving-light-box, .OT_publisher .OT_archiving-light-box,
.OT_subscriber .OT_archiving-light-box { .OT_subscriber .OT_archiving-light-box {
background: rgba(0, 0, 0, 0.4); background: rgba(0, 0, 0, 0.4);
top: auto; top: auto;
bottom: 0; bottom: 0;
right: auto; right: auto;
width: 34px; width: 34px;
height: 34px; height: 34px;
} }
.OT_archiving-light { .OT_archiving-light {
@ -423,6 +418,7 @@
-moz-box-shadow: 0 0 5px 1px #575757; -moz-box-shadow: 0 0 5px 1px #575757;
box-shadow: 0 0 5px 1px #575757; box-shadow: 0 0 5px 1px #575757;
} }
.OT_archiving-light.OT_active { .OT_archiving-light.OT_active {
background-color: #970d13; background-color: #970d13;
-webkit-animation: OT_pulse 1.3s ease-in; -webkit-animation: OT_pulse 1.3s ease-in;
@ -432,6 +428,7 @@
-moz-animation-iteration-count: infinite; -moz-animation-iteration-count: infinite;
-webkit-animation-iteration-count: infinite; -webkit-animation-iteration-count: infinite;
} }
@-moz-keyframes OT_pulse { @-moz-keyframes OT_pulse {
0% { 0% {
-webkit-box-shadow: 0 0 0px 0px #c70019; -webkit-box-shadow: 0 0 0px 0px #c70019;
@ -463,6 +460,7 @@
box-shadow: 0 0 0px 0px #c70019; box-shadow: 0 0 0px 0px #c70019;
} }
} }
@-webkit-keyframes OT_pulse { @-webkit-keyframes OT_pulse {
0% { 0% {
-webkit-box-shadow: 0 0 0px 0px #c70019; -webkit-box-shadow: 0 0 0px 0px #c70019;
@ -494,6 +492,7 @@
box-shadow: 0 0 0px 0px #c70019; box-shadow: 0 0 0px 0px #c70019;
} }
} }
@-o-keyframes OT_pulse { @-o-keyframes OT_pulse {
0% { 0% {
-webkit-box-shadow: 0 0 0px 0px #c70019; -webkit-box-shadow: 0 0 0px 0px #c70019;
@ -525,6 +524,7 @@
box-shadow: 0 0 0px 0px #c70019; box-shadow: 0 0 0px 0px #c70019;
} }
} }
@-ms-keyframes OT_pulse { @-ms-keyframes OT_pulse {
0% { 0% {
-webkit-box-shadow: 0 0 0px 0px #c70019; -webkit-box-shadow: 0 0 0px 0px #c70019;
@ -556,6 +556,7 @@
box-shadow: 0 0 0px 0px #c70019; box-shadow: 0 0 0px 0px #c70019;
} }
} }
@-webkit-keyframes OT_pulse { @-webkit-keyframes OT_pulse {
0% { 0% {
-webkit-box-shadow: 0 0 0px 0px #c70019; -webkit-box-shadow: 0 0 0px 0px #c70019;
@ -591,15 +592,15 @@
.OT_mini .OT_bar, .OT_mini .OT_bar,
.OT_bar.OT_mode-mini, .OT_bar.OT_mode-mini,
.OT_bar.OT_mode-mini-auto { .OT_bar.OT_mode-mini-auto {
bottom: 0; bottom: 0;
height: auto; height: auto;
} }
.OT_mini .OT_name.OT_mode-off, .OT_mini .OT_name.OT_mode-off,
.OT_mini .OT_name.OT_mode-on, .OT_mini .OT_name.OT_mode-on,
.OT_mini .OT_name.OT_mode-auto, .OT_mini .OT_name.OT_mode-auto,
.OT_mini:hover .OT_name.OT_mode-auto { .OT_mini:hover .OT_name.OT_mode-auto {
display: none; display: none;
} }
.OT_publisher .OT_name, .OT_publisher .OT_name,
@ -624,42 +625,42 @@
.OT_publisher .OT_mute, .OT_publisher .OT_mute,
.OT_subscriber .OT_mute { .OT_subscriber .OT_mute {
right: 0; right: 0;
top: 0; top: 0;
border-left: 1px solid rgba(255, 255, 255, 0.2); border-left: 1px solid rgba(255, 255, 255, 0.2);
height: 36px; height: 36px;
width: 37px; width: 37px;
} }
.OT_mini .OT_mute, .OT_mini .OT_mute,
.OT_mute.OT_mode-mini, .OT_publisher.OT_mini .OT_mute.OT_mode-auto.OT_mode-on-hold,
.OT_mute.OT_mode-mini-auto { .OT_subscriber.OT_mini .OT_mute.OT_mode-auto.OT_mode-on-hold {
top: 50%; top: 50%;
left: 50%; left: 50%;
right: auto; right: auto;
margin-top: -18px; margin-top: -18px;
margin-left: -18.5px; margin-left: -18.5px;
border-left: none; border-left: none;
} }
.OT_publisher .OT_mute { .OT_publisher .OT_mute {
background-image: url(../images/rtc/mic-on.png); background-image: url(../images/rtc/mic-on.png);
background-position: 9px 5px; background-position: 9px 5px;
} }
.OT_publisher .OT_mute.OT_active { .OT_publisher .OT_mute.OT_active {
background-image: url(../images/rtc/mic-off.png); background-image: url(../images/rtc/mic-off.png);
background-position: 9px 4px; background-position: 9px 4px;
} }
.OT_subscriber .OT_mute { .OT_subscriber .OT_mute {
background-image: url(../images/rtc/speaker-on.png); background-image: url(../images/rtc/speaker-on.png);
background-position: 8px 7px; background-position: 8px 7px;
} }
.OT_subscriber .OT_mute.OT_active { .OT_subscriber .OT_mute.OT_active {
background-image: url(../images/rtc/speaker-off.png); background-image: url(../images/rtc/speaker-off.png);
background-position: 7px 7px; background-position: 7px 7px;
} }
/** /**
@ -672,17 +673,9 @@
/* Default display mode transitions for various chrome elements */ /* Default display mode transitions for various chrome elements */
.OT_publisher .OT_edge-bar-item, .OT_publisher .OT_edge-bar-item,
.OT_subscriber .OT_edge-bar-item { .OT_subscriber .OT_edge-bar-item {
-ms-transition-property: top, bottom, opacity; transition-property: top, bottom, opacity;
-ms-transition-duration: 0.5s; transition-duration: 0.5s;
-moz-transition-property: top, bottom, opacity; transition-timing-function: ease-in;
-moz-transition-duration: 0.5s;
-webkit-transition-property: top, bottom, opacity;
-webkit-transition-duration: 0.5s;
-o-transition-property: top, bottom, opacity;
-o-transition-duration: 0.5s;
transition-property: top, bottom, opacity;
transition-duration: 0.5s;
transition-timing-function: ease-in;
} }
.OT_publisher .OT_edge-bar-item.OT_mode-off, .OT_publisher .OT_edge-bar-item.OT_mode-off,
@ -691,14 +684,14 @@
.OT_subscriber .OT_edge-bar-item.OT_mode-auto, .OT_subscriber .OT_edge-bar-item.OT_mode-auto,
.OT_publisher .OT_edge-bar-item.OT_mode-mini-auto, .OT_publisher .OT_edge-bar-item.OT_mode-mini-auto,
.OT_subscriber .OT_edge-bar-item.OT_mode-mini-auto { .OT_subscriber .OT_edge-bar-item.OT_mode-mini-auto {
top: -25px; top: -25px;
opacity: 0; opacity: 0;
} }
.OT_mini .OT_mute.OT_mode-auto, .OT_mini .OT_mute.OT_mode-auto,
.OT_publisher .OT_mute.OT_mode-mini-auto, .OT_publisher .OT_mute.OT_mode-mini-auto,
.OT_subscriber .OT_mute.OT_mode-mini-auto { .OT_subscriber .OT_mute.OT_mode-mini-auto {
top: 50%; top: 50%;
} }
.OT_publisher .OT_edge-bar-item.OT_edge-bottom.OT_mode-off, .OT_publisher .OT_edge-bar-item.OT_edge-bottom.OT_mode-off,
@ -707,8 +700,8 @@
.OT_subscriber .OT_edge-bar-item.OT_edge-bottom.OT_mode-auto, .OT_subscriber .OT_edge-bar-item.OT_edge-bottom.OT_mode-auto,
.OT_publisher .OT_edge-bar-item.OT_edge-bottom.OT_mode-mini-auto, .OT_publisher .OT_edge-bar-item.OT_edge-bottom.OT_mode-mini-auto,
.OT_subscriber .OT_edge-bar-item.OT_edge-bottom.OT_mode-mini-auto { .OT_subscriber .OT_edge-bar-item.OT_edge-bottom.OT_mode-mini-auto {
top: auto; top: auto;
bottom: -25px; bottom: -25px;
} }
.OT_publisher .OT_edge-bar-item.OT_mode-on, .OT_publisher .OT_edge-bar-item.OT_mode-on,
@ -719,127 +712,148 @@
.OT_subscriber:hover .OT_edge-bar-item.OT_mode-auto, .OT_subscriber:hover .OT_edge-bar-item.OT_mode-auto,
.OT_publisher:hover .OT_edge-bar-item.OT_mode-mini-auto, .OT_publisher:hover .OT_edge-bar-item.OT_mode-mini-auto,
.OT_subscriber:hover .OT_edge-bar-item.OT_mode-mini-auto { .OT_subscriber:hover .OT_edge-bar-item.OT_mode-mini-auto {
top: 0; top: 0;
opacity: 1; opacity: 1;
} }
.OT_mini .OT_mute.OT_mode-on, .OT_mini .OT_mute.OT_mode-on,
.OT_mini:hover .OT_mute.OT_mode-auto, .OT_mini:hover .OT_mute.OT_mode-auto,
.OT_mute.OT_mode-mini, .OT_mute.OT_mode-mini,
.OT_root:hover .OT_mute.OT_mode-mini-auto { .OT_root:hover .OT_mute.OT_mode-mini-auto {
top: 50%; top: 50%;
} }
.OT_publisher .OT_edge-bar-item.OT_edge-bottom.OT_mode-on, .OT_publisher .OT_edge-bar-item.OT_edge-bottom.OT_mode-on,
.OT_subscriber .OT_edge-bar-item.OT_edge-bottom.OT_mode-on, .OT_subscriber .OT_edge-bar-item.OT_edge-bottom.OT_mode-on,
.OT_publisher:hover .OT_edge-bar-item.OT_edge-bottom.OT_mode-auto, .OT_publisher:hover .OT_edge-bar-item.OT_edge-bottom.OT_mode-auto,
.OT_subscriber:hover .OT_edge-bar-item.OT_edge-bottom.OT_mode-auto { .OT_subscriber:hover .OT_edge-bar-item.OT_edge-bottom.OT_mode-auto {
top: auto; top: auto;
bottom: 0; bottom: 0;
opacity: 1; opacity: 1;
} }
/* Contains the video element, used to fix video letter-boxing */ /* Contains the video element, used to fix video letter-boxing */
.OT_video-container { .OT_widget-container {
position: absolute; position: absolute;
background-color: #000000; background-color: #000000;
overflow: hidden; overflow: hidden;
} }
.OT_hidden-audio { .OT_hidden-audio {
position: absolute !important; position: absolute !important;
height: 1px !important; height: 1px !important;
width: 1px !important; width: 1px !important;
} }
/* Load animation */ /* Load animation */
.OT_root .OT_video-loading { .OT_root .OT_video-loading {
background: url('../images/rtc/loader.gif') no-repeat; background: url('../images/rtc/loader.gif') no-repeat;
display:none; display: none;
position: absolute; position: absolute;
width: 32px; width: 32px;
height: 32px; height: 32px;
left: 50%; left: 50%;
top: 50%; top: 50%;
margin-left: -16px; margin-left: -16px;
margin-top: -16px; margin-top: -16px;
} }
.OT_publisher.OT_loading .OT_video-loading, .OT_publisher.OT_loading .OT_video-loading,
.OT_subscriber.OT_loading .OT_video-loading { .OT_subscriber.OT_loading .OT_video-loading {
display: block; display: block;
} }
.OT_publisher.OT_loading video, .OT_publisher.OT_loading .OT_video-element,
.OT_subscriber.OT_loading video, .OT_subscriber.OT_loading .OT_video-element {
.OT_publisher.OT_loading object, /*display: none;*/
.OT_subscriber.OT_loading object {
display: none;
} }
.OT_video-centering {
display: table;
width: 100%;
height: 100%;
}
.OT_video-container {
display: table-cell;
vertical-align: middle;
}
.OT_video-poster { .OT_video-poster {
width: 100%; position: absolute;
height: 100%; z-index: 1;
display: none; width: 100%;
height: 100%;
display: none;
opacity: .25; opacity: .25;
background-size: auto 76%;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center bottom; background-image: url(../images/rtc/audioonly-silhouette.svg);
background-image: url(../images/rtc/audioonly-silhouette.svg); }
.OT_fit-mode-cover .OT_video-poster {
background-size: auto 76%;
background-position: center bottom;
}
.OT_fit-mode-contain .OT_video-poster {
background-size: contain;
background-position: center;
} }
.OT_audio-level-meter { .OT_audio-level-meter {
position: absolute; position: absolute;
width: 25%; width: 25%;
max-width: 224px; max-width: 224px;
min-width: 21px; min-width: 21px;
top: 0; top: 0;
right: 0; right: 0;
overflow: hidden; overflow: hidden;
} }
.OT_audio-level-meter:before { .OT_audio-level-meter:before {
/* makes the height of the container equals its width */ /* makes the height of the container equals its width */
content: ''; content: '';
display: block; display: block;
padding-top: 100%; padding-top: 100%;
} }
.OT_audio-level-meter__bar { .OT_audio-level-meter__bar {
position: absolute; position: absolute;
width: 192%; /* meter value can overflow of 8% */ width: 192%; /* meter value can overflow of 8% */
height: 192%; height: 192%;
top: -96% /* half of the size */; top: -96% /* half of the size */;
right: -96%; right: -96%;
border-radius: 50%; border-radius: 50%;
background-color: rgba(0, 0, 0, .8); background-color: rgba(0, 0, 0, .8);
} }
.OT_audio-level-meter__audio-only-img { .OT_audio-level-meter__audio-only-img {
position: absolute; position: absolute;
top: 22%; top: 22%;
right: 15%; right: 15%;
width: 40%; width: 40%;
opacity: .7; opacity: .7;
background: url(../images/rtc/audioonly-headset.svg) no-repeat center; background: url(../images/rtc/audioonly-headset.svg) no-repeat center;
} }
.OT_audio-level-meter__audio-only-img:before { .OT_audio-level-meter__audio-only-img:before {
/* makes the height of the container equals its width */ /* makes the height of the container equals its width */
content: ''; content: '';
display: block; display: block;
padding-top: 100%; padding-top: 100%;
} }
.OT_audio-level-meter__value { .OT_audio-level-meter__value {
position: absolute; position: absolute;
border-radius: 50%; border-radius: 50%;
background-image: radial-gradient(circle, rgba(151,206,0,1) 0%, rgba(151,206,0,0) 100%); background-image: radial-gradient(circle, rgba(151, 206, 0, 1) 0%, rgba(151, 206, 0, 0) 100%);
} }
.OT_audio-level-meter.OT_mode-off { .OT_audio-level-meter.OT_mode-off {
@ -848,31 +862,31 @@
.OT_audio-level-meter.OT_mode-on, .OT_audio-level-meter.OT_mode-on,
.OT_audio-only .OT_audio-level-meter.OT_mode-auto { .OT_audio-only .OT_audio-level-meter.OT_mode-auto {
display: block; display: block;
} }
.OT_video-disabled-indicator { .OT_video-disabled-indicator {
opacity: 1; opacity: 1;
border: none; border: none;
display: none; display: none;
position: absolute; position: absolute;
background-color: transparent; background-color: transparent;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position:bottom right; background-position: bottom right;
top: 0; top: 0;
left: 0; left: 0;
bottom: 3px; bottom: 3px;
right: 3px; right: 3px;
} }
.OT_video-disabled { .OT_video-disabled {
background-image: url(../images/rtc/video-disabled.png); background-image: url(../images/rtc/video-disabled.png);
} }
.OT_video-disabled-warning { .OT_video-disabled-warning {
background-image: url(../images/rtc/video-disabled-warning.png); background-image: url(../images/rtc/video-disabled-warning.png);
} }
.OT_video-disabled-indicator.OT_active { .OT_video-disabled-indicator.OT_active {
display: block; display: block;
} }

View File

@ -1,7 +1,7 @@
/* /**
* @license
Copyright (c) 2014 TokBox, Inc. * Copyright (c) 2014 TokBox, Inc.
Released under the MIT license * Released under the MIT license
http://opensource.org/licenses/MIT * http://opensource.org/licenses/MIT
*/ */
!function(){TB.Config.replaceWith({global:{exceptionLogging:{enabled:!0,messageLimitPerPartner:100},iceServers:{enabled:!1},instrumentation:{enabled:!1,debugging:!1},tokshow:{textchat:!0}},partners:{change878:{instrumentation:{enabled:!0,debugging:!0}}}})}(TB); !function(){TB.Config.replaceWith({global:{exceptionLogging:{enabled:!0,messageLimitPerPartner:100},iceServers:{enabled:!1},instrumentation:{enabled:!1,debugging:!1},tokshow:{textchat:!0}},partners:{change878:{instrumentation:{enabled:!0,debugging:!0}}}})}(TB);

File diff suppressed because it is too large Load Diff

View File

@ -224,7 +224,9 @@ loop.standaloneRoomViews = (function(mozL10n) {
* @private * @private
*/ */
_onActiveRoomStateChanged: function() { _onActiveRoomStateChanged: function() {
this.setState(this.props.activeRoomStore.getStoreState()); var state = this.props.activeRoomStore.getStoreState();
this.updateVideoDimensions(state.localVideoDimensions, state.remoteVideoDimensions);
this.setState(state);
}, },
componentDidMount: function() { componentDidMount: function() {
@ -283,6 +285,41 @@ loop.standaloneRoomViews = (function(mozL10n) {
})); }));
}, },
/**
* Specifically updates the local camera stream size and position, depending
* on the size and position of the remote video stream.
* This method gets called from `updateVideoContainer`, which is defined in
* the `MediaSetupMixin`.
*
* @param {Object} ratio Aspect ratio of the local camera stream
*/
updateLocalCameraPosition: function(ratio) {
var node = this._getElement(".local");
var parent = node.offsetParent || this._getElement(".media");
// The local camera view should be a sixth of the size of its offset parent
// and positioned to overlap with the remote stream at a quarter of its width.
var parentWidth = parent.offsetWidth;
var targetWidth = parentWidth / 6;
node.style.right = "auto";
if (window.matchMedia && window.matchMedia("screen and (max-width:640px)").matches) {
targetWidth = 180;
node.style.left = "auto";
} else {
// Now position the local camera view correctly with respect to the remote
// video stream.
var remoteVideoDimensions = this.getRemoteVideoDimensions();
var offsetX = (remoteVideoDimensions.streamWidth + remoteVideoDimensions.offsetX);
// The horizontal offset of the stream, and the width of the resulting
// pillarbox, is determined by the height exponent of the aspect ratio.
// Therefore we multiply the width of the local camera view by the height
// ratio.
node.style.left = (offsetX - ((targetWidth * ratio.height) / 4)) + "px";
}
node.style.width = (targetWidth * ratio.width) + "px";
node.style.height = (targetWidth * ratio.height) + "px";
},
/** /**
* Checks if current room is active. * Checks if current room is active.
* *

View File

@ -224,7 +224,9 @@ loop.standaloneRoomViews = (function(mozL10n) {
* @private * @private
*/ */
_onActiveRoomStateChanged: function() { _onActiveRoomStateChanged: function() {
this.setState(this.props.activeRoomStore.getStoreState()); var state = this.props.activeRoomStore.getStoreState();
this.updateVideoDimensions(state.localVideoDimensions, state.remoteVideoDimensions);
this.setState(state);
}, },
componentDidMount: function() { componentDidMount: function() {
@ -283,6 +285,41 @@ loop.standaloneRoomViews = (function(mozL10n) {
})); }));
}, },
/**
* Specifically updates the local camera stream size and position, depending
* on the size and position of the remote video stream.
* This method gets called from `updateVideoContainer`, which is defined in
* the `MediaSetupMixin`.
*
* @param {Object} ratio Aspect ratio of the local camera stream
*/
updateLocalCameraPosition: function(ratio) {
var node = this._getElement(".local");
var parent = node.offsetParent || this._getElement(".media");
// The local camera view should be a sixth of the size of its offset parent
// and positioned to overlap with the remote stream at a quarter of its width.
var parentWidth = parent.offsetWidth;
var targetWidth = parentWidth / 6;
node.style.right = "auto";
if (window.matchMedia && window.matchMedia("screen and (max-width:640px)").matches) {
targetWidth = 180;
node.style.left = "auto";
} else {
// Now position the local camera view correctly with respect to the remote
// video stream.
var remoteVideoDimensions = this.getRemoteVideoDimensions();
var offsetX = (remoteVideoDimensions.streamWidth + remoteVideoDimensions.offsetX);
// The horizontal offset of the stream, and the width of the resulting
// pillarbox, is determined by the height exponent of the aspect ratio.
// Therefore we multiply the width of the local camera view by the height
// ratio.
node.style.left = (offsetX - ((targetWidth * ratio.height) / 4)) + "px";
}
node.style.width = (targetWidth * ratio.width) + "px";
node.style.height = (targetWidth * ratio.height) + "px";
},
/** /**
* Checks if current room is active. * Checks if current room is active.
* *

View File

@ -68,7 +68,9 @@ describe("loop.roomViews", function () {
videoMuted: false, videoMuted: false,
failureReason: undefined, failureReason: undefined,
used: false, used: false,
foo: "bar" foo: "bar",
localVideoDimensions: {},
remoteVideoDimensions: {}
}); });
}); });

View File

@ -129,7 +129,7 @@ class Test1BrowserCall(MarionetteTestCase):
def check_remote_video(self): def check_remote_video(self):
video_wrapper = self.wait_for_element_displayed( video_wrapper = self.wait_for_element_displayed(
By.CSS_SELECTOR, By.CSS_SELECTOR,
".media .OT_subscriber .OT_video-container", 20) ".media .OT_subscriber .OT_widget-container", 20)
video = self.wait_for_subelement_displayed( video = self.wait_for_subelement_displayed(
video_wrapper, By.TAG_NAME, "video") video_wrapper, By.TAG_NAME, "video")

View File

@ -282,6 +282,31 @@ describe("loop.store.ActiveRoomStore", function () {
}); });
}); });
describe("#videoDimensionsChanged", function() {
it("should not contain any video dimensions at the very start", function() {
expect(store.getStoreState()).eql(store.getInitialStoreState());
});
it("should update the store with new video dimensions", function() {
var actionData = {
isLocal: true,
videoType: "camera",
dimensions: { width: 640, height: 480 }
};
store.videoDimensionsChanged(new sharedActions.VideoDimensionsChanged(actionData));
expect(store.getStoreState().localVideoDimensions)
.to.have.property(actionData.videoType, actionData.dimensions);
actionData.isLocal = false;
store.videoDimensionsChanged(new sharedActions.VideoDimensionsChanged(actionData));
expect(store.getStoreState().remoteVideoDimensions)
.to.have.property(actionData.videoType, actionData.dimensions);
});
});
describe("#setupRoomInfo", function() { describe("#setupRoomInfo", function() {
var fakeRoomInfo; var fakeRoomInfo;

View File

@ -204,8 +204,16 @@ describe("loop.shared.mixins", function() {
} }
}); });
sandbox.useFakeTimers();
rootObject = { rootObject = {
events: {}, events: {},
setTimeout: function(func, timeout) {
return setTimeout(func, timeout);
},
clearTimeout: function(timer) {
return clearTimeout(timer);
},
addEventListener: function(eventName, listener) { addEventListener: function(eventName, listener) {
this.events[eventName] = listener; this.events[eventName] = listener;
}, },
@ -244,20 +252,26 @@ describe("loop.shared.mixins", function() {
describe("resize", function() { describe("resize", function() {
it("should update the width on the local stream element", function() { it("should update the width on the local stream element", function() {
localElement = { localElement = {
offsetWidth: 100,
offsetHeight: 100,
style: { width: "0%" } style: { width: "0%" }
}; };
rootObject.events.resize(); rootObject.events.resize();
sandbox.clock.tick(10);
expect(localElement.style.width).eql("100%"); expect(localElement.style.width).eql("100%");
}); });
it("should update the height on the remote stream element", function() { it("should update the height on the remote stream element", function() {
remoteElement = { remoteElement = {
offsetWidth: 100,
offsetHeight: 100,
style: { height: "0%" } style: { height: "0%" }
}; };
rootObject.events.resize(); rootObject.events.resize();
sandbox.clock.tick(10);
expect(remoteElement.style.height).eql("100%"); expect(remoteElement.style.height).eql("100%");
}); });
@ -266,24 +280,81 @@ describe("loop.shared.mixins", function() {
describe("orientationchange", function() { describe("orientationchange", function() {
it("should update the width on the local stream element", function() { it("should update the width on the local stream element", function() {
localElement = { localElement = {
offsetWidth: 100,
offsetHeight: 100,
style: { width: "0%" } style: { width: "0%" }
}; };
rootObject.events.orientationchange(); rootObject.events.orientationchange();
sandbox.clock.tick(10);
expect(localElement.style.width).eql("100%"); expect(localElement.style.width).eql("100%");
}); });
it("should update the height on the remote stream element", function() { it("should update the height on the remote stream element", function() {
remoteElement = { remoteElement = {
offsetWidth: 100,
offsetHeight: 100,
style: { height: "0%" } style: { height: "0%" }
}; };
rootObject.events.orientationchange(); rootObject.events.orientationchange();
sandbox.clock.tick(10);
expect(remoteElement.style.height).eql("100%"); expect(remoteElement.style.height).eql("100%");
}); });
}); });
describe("Video stream dimensions", function() {
var localVideoDimensions = {
camera: {
width: 640,
height: 480
}
};
var remoteVideoDimensions = {
camera: {
width: 420,
height: 138
}
};
beforeEach(function() {
view.updateVideoDimensions(localVideoDimensions, remoteVideoDimensions);
});
it("should register video dimension updates correctly", function() {
expect(view._videoDimensionsCache.local.camera.width)
.eql(localVideoDimensions.camera.width);
expect(view._videoDimensionsCache.local.camera.height)
.eql(localVideoDimensions.camera.height);
expect(view._videoDimensionsCache.local.camera.aspectRatio.width).eql(1);
expect(view._videoDimensionsCache.local.camera.aspectRatio.height).eql(0.75);
expect(view._videoDimensionsCache.remote.camera.width)
.eql(remoteVideoDimensions.camera.width);
expect(view._videoDimensionsCache.remote.camera.height)
.eql(remoteVideoDimensions.camera.height);
expect(view._videoDimensionsCache.remote.camera.aspectRatio.width).eql(1);
expect(view._videoDimensionsCache.remote.camera.aspectRatio.height)
.eql(0.32857142857142857);
});
it("should fetch remote video stream dimensions correctly", function() {
remoteElement = {
offsetWidth: 600,
offsetHeight: 320
};
var remoteVideoDimensions = view.getRemoteVideoDimensions();
expect(remoteVideoDimensions.width).eql(remoteElement.offsetWidth);
expect(remoteVideoDimensions.height).eql(remoteElement.offsetHeight);
expect(remoteVideoDimensions.streamWidth).eql(534.8571428571429);
expect(remoteVideoDimensions.streamHeight).eql(remoteElement.offsetHeight);
expect(remoteVideoDimensions.offsetX).eql(32.571428571428555);
expect(remoteVideoDimensions.offsetY).eql(0);
});
});
}); });
}); });

View File

@ -8,6 +8,7 @@ describe("loop.OTSdkDriver", function () {
var sharedActions = loop.shared.actions; var sharedActions = loop.shared.actions;
var FAILURE_DETAILS = loop.shared.utils.FAILURE_DETAILS; var FAILURE_DETAILS = loop.shared.utils.FAILURE_DETAILS;
var STREAM_PROPERTIES = loop.shared.utils.STREAM_PROPERTIES;
var sandbox; var sandbox;
var dispatcher, driver, publisher, sdk, session, sessionData; var dispatcher, driver, publisher, sdk, session, sessionData;
var fakeLocalElement, fakeRemoteElement, publisherConfig, fakeEvent; var fakeLocalElement, fakeRemoteElement, publisherConfig, fakeEvent;
@ -310,6 +311,44 @@ describe("loop.OTSdkDriver", function () {
}); });
}); });
describe("streamPropertyChanged", function() {
var fakeStream = {
connection: { id: "fake" },
videoType: "screen",
videoDimensions: {
width: 320,
height: 160
}
};
it("should not dispatch a VideoDimensionsChanged action for other properties", function() {
session.trigger("streamPropertyChanged", {
stream: fakeStream,
changedProperty: STREAM_PROPERTIES.HAS_AUDIO
});
session.trigger("streamPropertyChanged", {
stream: fakeStream,
changedProperty: STREAM_PROPERTIES.HAS_VIDEO
});
sinon.assert.notCalled(dispatcher.dispatch);
});
it("should dispatch a VideoDimensionsChanged action", function() {
session.connection = {
id: "localUser"
};
session.trigger("streamPropertyChanged", {
stream: fakeStream,
changedProperty: STREAM_PROPERTIES.VIDEO_DIMENSIONS
});
sinon.assert.calledOnce(dispatcher.dispatch);
sinon.assert.calledWithMatch(dispatcher.dispatch,
sinon.match.hasOwn("name", "videoDimensionsChanged"))
})
});
describe("connectionCreated", function() { describe("connectionCreated", function() {
beforeEach(function() { beforeEach(function() {
session.connection = { session.connection = {

View File

@ -24,7 +24,7 @@ add_task(function smart_bookmarks_disabled() {
let smartBookmarkItemIds = let smartBookmarkItemIds =
PlacesUtils.annotations.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO); PlacesUtils.annotations.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO);
do_check_eq(smartBookmarkItemIds.length, 0); do_check_eq(smartBookmarkItemIds.length, 0);
do_log_info("check that pref has not been bumped up"); do_print("check that pref has not been bumped up");
do_check_eq(Services.prefs.getIntPref("browser.places.smartBookmarksVersion"), -1); do_check_eq(Services.prefs.getIntPref("browser.places.smartBookmarksVersion"), -1);
}); });
@ -34,7 +34,7 @@ add_task(function create_smart_bookmarks() {
let smartBookmarkItemIds = let smartBookmarkItemIds =
PlacesUtils.annotations.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO); PlacesUtils.annotations.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO);
do_check_neq(smartBookmarkItemIds.length, 0); do_check_neq(smartBookmarkItemIds.length, 0);
do_log_info("check that pref has been bumped up"); do_print("check that pref has been bumped up");
do_check_true(Services.prefs.getIntPref("browser.places.smartBookmarksVersion") > 0); do_check_true(Services.prefs.getIntPref("browser.places.smartBookmarksVersion") > 0);
}); });
@ -42,14 +42,14 @@ add_task(function remove_smart_bookmark_and_restore() {
let smartBookmarkItemIds = let smartBookmarkItemIds =
PlacesUtils.annotations.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO); PlacesUtils.annotations.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO);
let smartBookmarksCount = smartBookmarkItemIds.length; let smartBookmarksCount = smartBookmarkItemIds.length;
do_log_info("remove one smart bookmark and restore"); do_print("remove one smart bookmark and restore");
PlacesUtils.bookmarks.removeItem(smartBookmarkItemIds[0]); PlacesUtils.bookmarks.removeItem(smartBookmarkItemIds[0]);
Services.prefs.setIntPref("browser.places.smartBookmarksVersion", 0); Services.prefs.setIntPref("browser.places.smartBookmarksVersion", 0);
gluesvc.ensurePlacesDefaultQueriesInitialized(); gluesvc.ensurePlacesDefaultQueriesInitialized();
smartBookmarkItemIds = smartBookmarkItemIds =
PlacesUtils.annotations.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO); PlacesUtils.annotations.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO);
do_check_eq(smartBookmarkItemIds.length, smartBookmarksCount); do_check_eq(smartBookmarkItemIds.length, smartBookmarksCount);
do_log_info("check that pref has been bumped up"); do_print("check that pref has been bumped up");
do_check_true(Services.prefs.getIntPref("browser.places.smartBookmarksVersion") > 0); do_check_true(Services.prefs.getIntPref("browser.places.smartBookmarksVersion") > 0);
}); });
@ -57,7 +57,7 @@ add_task(function move_smart_bookmark_rename_and_restore() {
let smartBookmarkItemIds = let smartBookmarkItemIds =
PlacesUtils.annotations.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO); PlacesUtils.annotations.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO);
let smartBookmarksCount = smartBookmarkItemIds.length; let smartBookmarksCount = smartBookmarkItemIds.length;
do_log_info("smart bookmark should be restored in place"); do_print("smart bookmark should be restored in place");
let parent = PlacesUtils.bookmarks.getFolderIdForItem(smartBookmarkItemIds[0]); let parent = PlacesUtils.bookmarks.getFolderIdForItem(smartBookmarkItemIds[0]);
let oldTitle = PlacesUtils.bookmarks.getItemTitle(smartBookmarkItemIds[0]); let oldTitle = PlacesUtils.bookmarks.getItemTitle(smartBookmarkItemIds[0]);
// create a subfolder and move inside it // create a subfolder and move inside it
@ -76,6 +76,6 @@ add_task(function move_smart_bookmark_rename_and_restore() {
do_check_eq(smartBookmarkItemIds.length, smartBookmarksCount); do_check_eq(smartBookmarkItemIds.length, smartBookmarksCount);
do_check_eq(PlacesUtils.bookmarks.getFolderIdForItem(smartBookmarkItemIds[0]), newParent); do_check_eq(PlacesUtils.bookmarks.getFolderIdForItem(smartBookmarkItemIds[0]), newParent);
do_check_eq(PlacesUtils.bookmarks.getItemTitle(smartBookmarkItemIds[0]), oldTitle); do_check_eq(PlacesUtils.bookmarks.getItemTitle(smartBookmarkItemIds[0]), oldTitle);
do_log_info("check that pref has been bumped up"); do_print("check that pref has been bumped up");
do_check_true(Services.prefs.getIntPref("browser.places.smartBookmarksVersion") > 0); do_check_true(Services.prefs.getIntPref("browser.places.smartBookmarksVersion") > 0);
}); });

View File

@ -63,7 +63,7 @@ function waitForImportAndSmartBookmarks(aCallback) {
function test_import() function test_import()
{ {
do_log_info("Import from bookmarks.html if importBookmarksHTML is true."); do_print("Import from bookmarks.html if importBookmarksHTML is true.");
remove_all_bookmarks(); remove_all_bookmarks();
// Sanity check: we should not have any bookmark on the toolbar. // Sanity check: we should not have any bookmark on the toolbar.
@ -86,7 +86,7 @@ function waitForImportAndSmartBookmarks(aCallback) {
run_next_test(); run_next_test();
}); });
// Force nsBrowserGlue::_initPlaces(). // Force nsBrowserGlue::_initPlaces().
do_log_info("Simulate Places init"); do_print("Simulate Places init");
bg.QueryInterface(Ci.nsIObserver).observe(null, bg.QueryInterface(Ci.nsIObserver).observe(null,
TOPIC_BROWSERGLUE_TEST, TOPIC_BROWSERGLUE_TEST,
TOPICDATA_FORCE_PLACES_INIT); TOPICDATA_FORCE_PLACES_INIT);
@ -94,8 +94,8 @@ function waitForImportAndSmartBookmarks(aCallback) {
function test_import_noSmartBookmarks() function test_import_noSmartBookmarks()
{ {
do_log_info("import from bookmarks.html, but don't create smart bookmarks \ do_print("import from bookmarks.html, but don't create smart bookmarks \
if they are disabled"); if they are disabled");
remove_all_bookmarks(); remove_all_bookmarks();
// Sanity check: we should not have any bookmark on the toolbar. // Sanity check: we should not have any bookmark on the toolbar.
@ -119,7 +119,7 @@ function waitForImportAndSmartBookmarks(aCallback) {
run_next_test(); run_next_test();
}); });
// Force nsBrowserGlue::_initPlaces(). // Force nsBrowserGlue::_initPlaces().
do_log_info("Simulate Places init"); do_print("Simulate Places init");
bg.QueryInterface(Ci.nsIObserver).observe(null, bg.QueryInterface(Ci.nsIObserver).observe(null,
TOPIC_BROWSERGLUE_TEST, TOPIC_BROWSERGLUE_TEST,
TOPICDATA_FORCE_PLACES_INIT); TOPICDATA_FORCE_PLACES_INIT);
@ -127,8 +127,8 @@ function waitForImportAndSmartBookmarks(aCallback) {
function test_import_autoExport_updatedSmartBookmarks() function test_import_autoExport_updatedSmartBookmarks()
{ {
do_log_info("Import from bookmarks.html, but don't create smart bookmarks \ do_print("Import from bookmarks.html, but don't create smart bookmarks \
if autoExportHTML is true and they are at latest version"); if autoExportHTML is true and they are at latest version");
remove_all_bookmarks(); remove_all_bookmarks();
// Sanity check: we should not have any bookmark on the toolbar. // Sanity check: we should not have any bookmark on the toolbar.
@ -154,7 +154,7 @@ function waitForImportAndSmartBookmarks(aCallback) {
run_next_test(); run_next_test();
}); });
// Force nsBrowserGlue::_initPlaces() // Force nsBrowserGlue::_initPlaces()
do_log_info("Simulate Places init"); do_print("Simulate Places init");
bg.QueryInterface(Ci.nsIObserver).observe(null, bg.QueryInterface(Ci.nsIObserver).observe(null,
TOPIC_BROWSERGLUE_TEST, TOPIC_BROWSERGLUE_TEST,
TOPICDATA_FORCE_PLACES_INIT); TOPICDATA_FORCE_PLACES_INIT);
@ -162,8 +162,8 @@ function waitForImportAndSmartBookmarks(aCallback) {
function test_import_autoExport_oldSmartBookmarks() function test_import_autoExport_oldSmartBookmarks()
{ {
do_log_info("Import from bookmarks.html, and create smart bookmarks if \ do_print("Import from bookmarks.html, and create smart bookmarks if \
autoExportHTML is true and they are not at latest version."); autoExportHTML is true and they are not at latest version.");
remove_all_bookmarks(); remove_all_bookmarks();
// Sanity check: we should not have any bookmark on the toolbar. // Sanity check: we should not have any bookmark on the toolbar.
@ -190,7 +190,7 @@ function waitForImportAndSmartBookmarks(aCallback) {
run_next_test(); run_next_test();
}); });
// Force nsBrowserGlue::_initPlaces() // Force nsBrowserGlue::_initPlaces()
do_log_info("Simulate Places init"); do_print("Simulate Places init");
bg.QueryInterface(Ci.nsIObserver).observe(null, bg.QueryInterface(Ci.nsIObserver).observe(null,
TOPIC_BROWSERGLUE_TEST, TOPIC_BROWSERGLUE_TEST,
TOPICDATA_FORCE_PLACES_INIT); TOPICDATA_FORCE_PLACES_INIT);
@ -198,8 +198,8 @@ function waitForImportAndSmartBookmarks(aCallback) {
function test_restore() function test_restore()
{ {
do_log_info("restore from default bookmarks.html if \ do_print("restore from default bookmarks.html if \
restore_default_bookmarks is true."); restore_default_bookmarks is true.");
remove_all_bookmarks(); remove_all_bookmarks();
// Sanity check: we should not have any bookmark on the toolbar. // Sanity check: we should not have any bookmark on the toolbar.
@ -222,7 +222,7 @@ function waitForImportAndSmartBookmarks(aCallback) {
run_next_test(); run_next_test();
}); });
// Force nsBrowserGlue::_initPlaces() // Force nsBrowserGlue::_initPlaces()
do_log_info("Simulate Places init"); do_print("Simulate Places init");
bg.QueryInterface(Ci.nsIObserver).observe(null, bg.QueryInterface(Ci.nsIObserver).observe(null,
TOPIC_BROWSERGLUE_TEST, TOPIC_BROWSERGLUE_TEST,
TOPICDATA_FORCE_PLACES_INIT); TOPICDATA_FORCE_PLACES_INIT);
@ -231,8 +231,8 @@ function waitForImportAndSmartBookmarks(aCallback) {
function test_restore_import() function test_restore_import()
{ {
do_log_info("setting both importBookmarksHTML and \ do_print("setting both importBookmarksHTML and \
restore_default_bookmarks should restore defaults."); restore_default_bookmarks should restore defaults.");
remove_all_bookmarks(); remove_all_bookmarks();
// Sanity check: we should not have any bookmark on the toolbar. // Sanity check: we should not have any bookmark on the toolbar.
@ -257,7 +257,7 @@ function waitForImportAndSmartBookmarks(aCallback) {
run_next_test(); run_next_test();
}); });
// Force nsBrowserGlue::_initPlaces() // Force nsBrowserGlue::_initPlaces()
do_log_info("Simulate Places init"); do_print("Simulate Places init");
bg.QueryInterface(Ci.nsIObserver).observe(null, bg.QueryInterface(Ci.nsIObserver).observe(null,
TOPIC_BROWSERGLUE_TEST, TOPIC_BROWSERGLUE_TEST,
TOPICDATA_FORCE_PLACES_INIT); TOPICDATA_FORCE_PLACES_INIT);

View File

@ -38,7 +38,7 @@ function setupBehaviorAndMigrate(aDefaultBehavior, aAutocompleteEnabled = true)
}; };
add_task(function*() { add_task(function*() {
do_log_info("Migrate default.behavior = 0"); do_print("Migrate default.behavior = 0");
setupBehaviorAndMigrate(0); setupBehaviorAndMigrate(0);
Assert.ok(gGetBoolPref("browser.urlbar.suggest.history"), Assert.ok(gGetBoolPref("browser.urlbar.suggest.history"),
@ -52,7 +52,7 @@ add_task(function*() {
}); });
add_task(function*() { add_task(function*() {
do_log_info("Migrate default.behavior = 1"); do_print("Migrate default.behavior = 1");
setupBehaviorAndMigrate(1); setupBehaviorAndMigrate(1);
Assert.ok(gGetBoolPref("browser.urlbar.suggest.history"), Assert.ok(gGetBoolPref("browser.urlbar.suggest.history"),
@ -66,7 +66,7 @@ add_task(function*() {
}); });
add_task(function*() { add_task(function*() {
do_log_info("Migrate default.behavior = 2"); do_print("Migrate default.behavior = 2");
setupBehaviorAndMigrate(2); setupBehaviorAndMigrate(2);
Assert.equal(gGetBoolPref("browser.urlbar.suggest.history"), false, Assert.equal(gGetBoolPref("browser.urlbar.suggest.history"), false,
@ -80,7 +80,7 @@ add_task(function*() {
}); });
add_task(function*() { add_task(function*() {
do_log_info("Migrate default.behavior = 3"); do_print("Migrate default.behavior = 3");
setupBehaviorAndMigrate(3); setupBehaviorAndMigrate(3);
Assert.ok(gGetBoolPref("browser.urlbar.suggest.history"), Assert.ok(gGetBoolPref("browser.urlbar.suggest.history"),
@ -94,7 +94,7 @@ add_task(function*() {
}); });
add_task(function*() { add_task(function*() {
do_log_info("Migrate default.behavior = 19"); do_print("Migrate default.behavior = 19");
setupBehaviorAndMigrate(19); setupBehaviorAndMigrate(19);
Assert.ok(gGetBoolPref("browser.urlbar.suggest.history"), Assert.ok(gGetBoolPref("browser.urlbar.suggest.history"),
@ -108,7 +108,7 @@ add_task(function*() {
}); });
add_task(function*() { add_task(function*() {
do_log_info("Migrate default.behavior = 33"); do_print("Migrate default.behavior = 33");
setupBehaviorAndMigrate(33); setupBehaviorAndMigrate(33);
Assert.ok(gGetBoolPref("browser.urlbar.suggest.history"), Assert.ok(gGetBoolPref("browser.urlbar.suggest.history"),
@ -122,7 +122,7 @@ add_task(function*() {
}); });
add_task(function*() { add_task(function*() {
do_log_info("Migrate default.behavior = 129"); do_print("Migrate default.behavior = 129");
setupBehaviorAndMigrate(129); setupBehaviorAndMigrate(129);
Assert.ok(gGetBoolPref("browser.urlbar.suggest.history"), Assert.ok(gGetBoolPref("browser.urlbar.suggest.history"),
@ -136,7 +136,7 @@ add_task(function*() {
}); });
add_task(function*() { add_task(function*() {
do_log_info("Migrate default.behavior = 0, autocomplete.enabled = false"); do_print("Migrate default.behavior = 0, autocomplete.enabled = false");
setupBehaviorAndMigrate(0, false); setupBehaviorAndMigrate(0, false);
Assert.equal(gGetBoolPref("browser.urlbar.suggest.history"), false, Assert.equal(gGetBoolPref("browser.urlbar.suggest.history"), false,

View File

@ -6,6 +6,15 @@
const PAGE_1 = "data:text/html,<html><body>A%20regular,%20everyday,%20normal%20page."; const PAGE_1 = "data:text/html,<html><body>A%20regular,%20everyday,%20normal%20page.";
const PAGE_2 = "data:text/html,<html><body>Another%20regular,%20everyday,%20normal%20page."; const PAGE_2 = "data:text/html,<html><body>Another%20regular,%20everyday,%20normal%20page.";
// Turn off tab animations for testing
Services.prefs.setBoolPref("browser.tabs.animate", false);
registerCleanupFunction(() => {
Services.prefs.clearUserPref("browser.tabs.animate");
});
// Allow tabs to restore on demand so we can test pending states
Services.prefs.clearUserPref("browser.sessionstore.restore_on_demand");
/** /**
* Returns a Promise that resolves once a remote <xul:browser> has experienced * Returns a Promise that resolves once a remote <xul:browser> has experienced
* a crash. Also does the job of cleaning up the minidump of the crash. * a crash. Also does the job of cleaning up the minidump of the crash.
@ -58,6 +67,7 @@ function crashBrowser(browser) {
} }
Services.obs.removeObserver(observer, 'ipc:content-shutdown'); Services.obs.removeObserver(observer, 'ipc:content-shutdown');
info("Crash cleaned up");
resolve(); resolve();
}; };
@ -67,6 +77,7 @@ function crashBrowser(browser) {
let aboutTabCrashedLoadPromise = new Promise((resolve, reject) => { let aboutTabCrashedLoadPromise = new Promise((resolve, reject) => {
browser.addEventListener("AboutTabCrashedLoad", function onCrash() { browser.addEventListener("AboutTabCrashedLoad", function onCrash() {
browser.removeEventListener("AboutTabCrashedLoad", onCrash, false); browser.removeEventListener("AboutTabCrashedLoad", onCrash, false);
info("about:tabcrashed loaded");
resolve(); resolve();
}, false, true); }, false, true);
}); });
@ -75,7 +86,22 @@ function crashBrowser(browser) {
// evaluated. // evaluated.
let mm = browser.messageManager; let mm = browser.messageManager;
mm.loadFrameScript("data:,(" + frame_script.toString() + ")();", false); mm.loadFrameScript("data:,(" + frame_script.toString() + ")();", false);
return Promise.all([crashCleanupPromise, aboutTabCrashedLoadPromise]); return Promise.all([crashCleanupPromise, aboutTabCrashedLoadPromise]).then(() => {
let tab = gBrowser.getTabForBrowser(browser);
is(tab.getAttribute("crashed"), "true", "Tab should be marked as crashed");
});
}
function clickButton(browser, id) {
info("Clicking " + id);
let frame_script = (id) => {
let button = content.document.getElementById(id);
button.click();
};
let mm = browser.messageManager;
mm.loadFrameScript("data:,(" + frame_script.toString() + ")('" + id + "');", false);
} }
/** /**
@ -194,8 +220,6 @@ add_task(function test_crash_page_not_in_history() {
// Crash the tab // Crash the tab
yield crashBrowser(browser); yield crashBrowser(browser);
// Flush out any notifications from the crashed browser.
TabState.flush(browser);
// Check the tab state and make sure the tab crashed page isn't // Check the tab state and make sure the tab crashed page isn't
// mentioned. // mentioned.
@ -225,13 +249,12 @@ add_task(function test_revived_history_from_remote() {
// Crash the tab // Crash the tab
yield crashBrowser(browser); yield crashBrowser(browser);
// Flush out any notifications from the crashed browser.
TabState.flush(browser);
// Browse to a new site that will cause the browser to // Browse to a new site that will cause the browser to
// become remote again. // become remote again.
browser.loadURI(PAGE_2); browser.loadURI(PAGE_2);
yield promiseTabRestored(newTab); yield promiseTabRestored(newTab);
ok(!newTab.hasAttribute("crashed"), "Tab shouldn't be marked as crashed anymore.");
ok(browser.isRemoteBrowser, "Should be a remote browser"); ok(browser.isRemoteBrowser, "Should be a remote browser");
TabState.flush(browser); TabState.flush(browser);
@ -265,13 +288,12 @@ add_task(function test_revived_history_from_non_remote() {
// Crash the tab // Crash the tab
yield crashBrowser(browser); yield crashBrowser(browser);
// Flush out any notifications from the crashed browser.
TabState.flush(browser);
// Browse to a new site that will not cause the browser to // Browse to a new site that will not cause the browser to
// become remote again. // become remote again.
browser.loadURI("about:mozilla"); browser.loadURI("about:mozilla");
yield promiseBrowserLoaded(browser); yield promiseBrowserLoaded(browser);
ok(!newTab.hasAttribute("crashed"), "Tab shouldn't be marked as crashed anymore.");
ok(!browser.isRemoteBrowser, "Should not be a remote browser"); ok(!browser.isRemoteBrowser, "Should not be a remote browser");
TabState.flush(browser); TabState.flush(browser);
@ -301,6 +323,14 @@ add_task(function test_revive_tab_from_session_store() {
browser.loadURI(PAGE_1); browser.loadURI(PAGE_1);
yield promiseBrowserLoaded(browser); yield promiseBrowserLoaded(browser);
let newTab2 = gBrowser.addTab();
let browser2 = newTab2.linkedBrowser;
ok(browser2.isRemoteBrowser, "Should be a remote browser");
yield promiseBrowserLoaded(browser2);
browser.loadURI(PAGE_1);
yield promiseBrowserLoaded(browser);
browser.loadURI(PAGE_2); browser.loadURI(PAGE_2);
yield promiseBrowserLoaded(browser); yield promiseBrowserLoaded(browser);
@ -308,12 +338,13 @@ add_task(function test_revive_tab_from_session_store() {
// Crash the tab // Crash the tab
yield crashBrowser(browser); yield crashBrowser(browser);
// Flush out any notifications from the crashed browser. is(newTab2.getAttribute("crashed"), "true", "Second tab should be crashed too.");
TabState.flush(browser);
// Use SessionStore to revive the tab // Use SessionStore to revive the tab
SessionStore.reviveCrashedTab(newTab); clickButton(browser, "restoreTab");
yield promiseBrowserLoaded(browser); yield promiseTabRestored(newTab);
ok(!newTab.hasAttribute("crashed"), "Tab shouldn't be marked as crashed anymore.");
is(newTab2.getAttribute("crashed"), "true", "Second tab should still be crashed though.");
// We can't just check browser.currentURI.spec, because from // We can't just check browser.currentURI.spec, because from
// the outside, a crashed tab has the same URI as the page // the outside, a crashed tab has the same URI as the page
@ -325,4 +356,90 @@ add_task(function test_revive_tab_from_session_store() {
yield promiseHistoryLength(browser, 2); yield promiseHistoryLength(browser, 2);
gBrowser.removeTab(newTab); gBrowser.removeTab(newTab);
}); gBrowser.removeTab(newTab2);
});
/**
* Checks that we can revive a crashed tab back to the page that
* it was on when it crashed.
*/
add_task(function test_revive_all_tabs_from_session_store() {
let newTab = gBrowser.addTab();
gBrowser.selectedTab = newTab;
let browser = newTab.linkedBrowser;
ok(browser.isRemoteBrowser, "Should be a remote browser");
yield promiseBrowserLoaded(browser);
browser.loadURI(PAGE_1);
yield promiseBrowserLoaded(browser);
let newTab2 = gBrowser.addTab(PAGE_1);
let browser2 = newTab2.linkedBrowser;
ok(browser2.isRemoteBrowser, "Should be a remote browser");
yield promiseBrowserLoaded(browser2);
browser.loadURI(PAGE_1);
yield promiseBrowserLoaded(browser);
browser.loadURI(PAGE_2);
yield promiseBrowserLoaded(browser);
TabState.flush(browser);
TabState.flush(browser2);
// Crash the tab
yield crashBrowser(browser);
is(newTab2.getAttribute("crashed"), "true", "Second tab should be crashed too.");
// Use SessionStore to revive all the tabs
clickButton(browser, "restoreAll");
yield promiseTabRestored(newTab);
ok(!newTab.hasAttribute("crashed"), "Tab shouldn't be marked as crashed anymore.");
ok(!newTab.hasAttribute("pending"), "Tab shouldn't be pending.");
ok(!newTab2.hasAttribute("crashed"), "Second tab shouldn't be marked as crashed anymore.");
ok(newTab2.hasAttribute("pending"), "Second tab should be pending.");
gBrowser.selectedTab = newTab2;
yield promiseTabRestored(newTab2);
ok(!newTab2.hasAttribute("pending"), "Second tab shouldn't be pending.");
// We can't just check browser.currentURI.spec, because from
// the outside, a crashed tab has the same URI as the page
// it crashed on (much like an about:neterror page). Instead,
// we have to use the documentURI on the content.
yield promiseContentDocumentURIEquals(browser, PAGE_2);
yield promiseContentDocumentURIEquals(browser2, PAGE_1);
// We should also have two entries in the browser history.
yield promiseHistoryLength(browser, 2);
gBrowser.removeTab(newTab);
gBrowser.removeTab(newTab2);
});
/**
* Checks that about:tabcrashed can close the current tab
*/
add_task(function test_close_tab_after_crash() {
let newTab = gBrowser.addTab();
gBrowser.selectedTab = newTab;
let browser = newTab.linkedBrowser;
ok(browser.isRemoteBrowser, "Should be a remote browser");
yield promiseBrowserLoaded(browser);
browser.loadURI(PAGE_1);
yield promiseBrowserLoaded(browser);
TabState.flush(browser);
// Crash the tab
yield crashBrowser(browser);
let promise = promiseEvent(gBrowser.tabContainer, "TabClose");
// Click the close tab button
clickButton(browser, "closeTab");
yield promise;
is(gBrowser.tabs.length, 1, "Should have closed the tab");
});

View File

@ -488,15 +488,19 @@ function promiseDelayedStartupFinished(aWindow) {
return new Promise(resolve => whenDelayedStartupFinished(aWindow, resolve)); return new Promise(resolve => whenDelayedStartupFinished(aWindow, resolve));
} }
function promiseTabRestored(tab) { function promiseEvent(element, eventType, isCapturing = false) {
return new Promise(resolve => { return new Promise(resolve => {
tab.addEventListener("SSTabRestored", function onRestored() { element.addEventListener(eventType, function listener(event) {
tab.removeEventListener("SSTabRestored", onRestored); element.removeEventListener(eventType, listener, isCapturing);
resolve(); resolve(event);
}); }, isCapturing);
}); });
} }
function promiseTabRestored(tab) {
return promiseEvent(tab, "SSTabRestored");
}
function sendMessage(browser, name, data = {}) { function sendMessage(browser, name, data = {}) {
browser.messageManager.sendAsyncMessage(name, data); browser.messageManager.sendAsyncMessage(name, data);
return promiseContentMessage(browser, name); return promiseContentMessage(browser, name);

View File

@ -16,6 +16,16 @@ function test() {
UITourTest(); UITourTest();
} }
function runOffline(fun) {
return (done) => {
Services.io.offline = true;
fun(function onComplete() {
Services.io.offline = false;
done();
});
}
}
let tests = [ let tests = [
taskify(function* test_menu_show_hide() { taskify(function* test_menu_show_hide() {
ise(loopButton.open, false, "Menu should initially be closed"); ise(loopButton.open, false, "Menu should initially be closed");
@ -94,7 +104,7 @@ let tests = [
}); });
}); });
}, },
function test_notifyLoopChatWindowOpenedClosed(done) { runOffline(function test_notifyLoopChatWindowOpenedClosed(done) {
gContentAPI.observe((event, params) => { gContentAPI.observe((event, params) => {
is(event, "Loop:ChatWindowOpened", "Check Loop:ChatWindowOpened notification"); is(event, "Loop:ChatWindowOpened", "Check Loop:ChatWindowOpened notification");
gContentAPI.observe((event, params) => { gContentAPI.observe((event, params) => {
@ -110,8 +120,8 @@ let tests = [
document.querySelector("#pinnedchats > chatbox").close(); document.querySelector("#pinnedchats > chatbox").close();
}); });
LoopRooms.open("fakeTourRoom"); LoopRooms.open("fakeTourRoom");
}, }),
function test_notifyLoopRoomURLCopied(done) { runOffline(function test_notifyLoopRoomURLCopied(done) {
gContentAPI.observe((event, params) => { gContentAPI.observe((event, params) => {
is(event, "Loop:ChatWindowOpened", "Loop chat window should've opened"); is(event, "Loop:ChatWindowOpened", "Loop chat window should've opened");
gContentAPI.observe((event, params) => { gContentAPI.observe((event, params) => {
@ -131,8 +141,8 @@ let tests = [
}); });
setupFakeRoom(); setupFakeRoom();
LoopRooms.open("fakeTourRoom"); LoopRooms.open("fakeTourRoom");
}, }),
function test_notifyLoopRoomURLEmailed(done) { runOffline(function test_notifyLoopRoomURLEmailed(done) {
gContentAPI.observe((event, params) => { gContentAPI.observe((event, params) => {
is(event, "Loop:ChatWindowOpened", "Loop chat window should've opened"); is(event, "Loop:ChatWindowOpened", "Loop chat window should've opened");
gContentAPI.observe((event, params) => { gContentAPI.observe((event, params) => {
@ -162,7 +172,7 @@ let tests = [
}); });
}); });
LoopRooms.open("fakeTourRoom"); LoopRooms.open("fakeTourRoom");
}, }),
taskify(function* test_arrow_panel_position() { taskify(function* test_arrow_panel_position() {
ise(loopButton.open, false, "Menu should initially be closed"); ise(loopButton.open, false, "Menu should initially be closed");
let popup = document.getElementById("UITourTooltip"); let popup = document.getElementById("UITourTooltip");
@ -274,6 +284,7 @@ if (Services.prefs.getBoolPref("loop.enabled")) {
Services.prefs.clearUserPref("loop.gettingStarted.resumeOnFirstJoin"); Services.prefs.clearUserPref("loop.gettingStarted.resumeOnFirstJoin");
Services.prefs.clearUserPref("loop.gettingStarted.seen"); Services.prefs.clearUserPref("loop.gettingStarted.seen");
Services.prefs.clearUserPref("loop.gettingStarted.url"); Services.prefs.clearUserPref("loop.gettingStarted.url");
Services.io.offline = false;
// Copied from browser/components/loop/test/mochitest/head.js // Copied from browser/components/loop/test/mochitest/head.js
// Remove the iframe after each test. This also avoids mochitest complaining // Remove the iframe after each test. This also avoids mochitest complaining

View File

@ -1,4 +1,4 @@
This is the pdf.js project output, https://github.com/mozilla/pdf.js This is the pdf.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 1.0.1040 Current extension version is: 1.0.1130

View File

@ -349,7 +349,11 @@ ChromeActions.prototype = {
return (!!prefBrowser && prefGfx); return (!!prefBrowser && prefGfx);
}, },
supportsDocumentColors: function() { supportsDocumentColors: function() {
return getBoolPref('browser.display.use_document_colors', true); if (getIntPref('browser.display.document_color_use', 0) === 2 ||
!getBoolPref('browser.display.use_document_colors', true)) {
return false;
}
return true;
}, },
reportTelemetry: function (data) { reportTelemetry: function (data) {
var probeInfo = JSON.parse(data); var probeInfo = JSON.parse(data);

View File

@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') {
(typeof window !== 'undefined' ? window : this).PDFJS = {}; (typeof window !== 'undefined' ? window : this).PDFJS = {};
} }
PDFJS.version = '1.0.1040'; PDFJS.version = '1.0.1130';
PDFJS.build = '997096f'; PDFJS.build = 'e4f0ae2';
(function pdfjsWrapper() { (function pdfjsWrapper() {
// Use strict in our context only - users might not want it // Use strict in our context only - users might not want it
@ -341,6 +341,7 @@ function isValidUrl(url, allowRelative) {
case 'https': case 'https':
case 'ftp': case 'ftp':
case 'mailto': case 'mailto':
case 'tel':
return true; return true;
default: default:
return false; return false;
@ -470,6 +471,8 @@ var XRefParseException = (function XRefParseExceptionClosure() {
function bytesToString(bytes) { function bytesToString(bytes) {
assert(bytes !== null && typeof bytes === 'object' &&
bytes.length !== undefined, 'Invalid argument for bytesToString');
var length = bytes.length; var length = bytes.length;
var MAX_ARGUMENT_COUNT = 8192; var MAX_ARGUMENT_COUNT = 8192;
if (length < MAX_ARGUMENT_COUNT) { if (length < MAX_ARGUMENT_COUNT) {
@ -485,6 +488,7 @@ function bytesToString(bytes) {
} }
function stringToBytes(str) { function stringToBytes(str) {
assert(typeof str === 'string', 'Invalid argument for stringToBytes');
var length = str.length; var length = str.length;
var bytes = new Uint8Array(length); var bytes = new Uint8Array(length);
for (var i = 0; i < length; ++i) { for (var i = 0; i < length; ++i) {
@ -1374,6 +1378,9 @@ PDFJS.disableStream = (PDFJS.disableStream === undefined ?
* Disable pre-fetching of PDF file data. When range requests are enabled PDF.js * Disable pre-fetching of PDF file data. When range requests are enabled PDF.js
* will automatically keep fetching more data even if it isn't needed to display * will automatically keep fetching more data even if it isn't needed to display
* the current page. This default behavior can be disabled. * the current page. This default behavior can be disabled.
*
* NOTE: It is also necessary to disable streaming, see above,
* in order for disabling of pre-fetching to work correctly.
* @var {boolean} * @var {boolean}
*/ */
PDFJS.disableAutoFetch = (PDFJS.disableAutoFetch === undefined ? PDFJS.disableAutoFetch = (PDFJS.disableAutoFetch === undefined ?
@ -1437,7 +1444,9 @@ PDFJS.maxCanvasPixels = (PDFJS.maxCanvasPixels === undefined ?
* *
* @typedef {Object} DocumentInitParameters * @typedef {Object} DocumentInitParameters
* @property {string} url - The URL of the PDF. * @property {string} url - The URL of the PDF.
* @property {TypedArray} data - A typed array with PDF data. * @property {TypedArray|Array|string} data - Binary PDF data. Use typed arrays
* (Uint8Array) to improve the memory usage. If PDF data is BASE64-encoded,
* use atob() to convert it to a binary string first.
* @property {Object} httpHeaders - Basic authentication headers. * @property {Object} httpHeaders - Basic authentication headers.
* @property {boolean} withCredentials - Indicates whether or not cross-site * @property {boolean} withCredentials - Indicates whether or not cross-site
* Access-Control requests should be made using credentials such as cookies * Access-Control requests should be made using credentials such as cookies
@ -1446,6 +1455,9 @@ PDFJS.maxCanvasPixels = (PDFJS.maxCanvasPixels === undefined ?
* @property {TypedArray} initialData - A typed array with the first portion or * @property {TypedArray} initialData - A typed array with the first portion or
* all of the pdf data. Used by the extension since some data is already * all of the pdf data. Used by the extension since some data is already
* loaded before the switch to range requests. * loaded before the switch to range requests.
* @property {number} length - The PDF file length. It's used for progress
* reports and range requests operations.
* @property {PDFDataRangeTransport} range
*/ */
/** /**
@ -1462,68 +1474,226 @@ PDFJS.maxCanvasPixels = (PDFJS.maxCanvasPixels === undefined ?
* is used, which means it must follow the same origin rules that any XHR does * is used, which means it must follow the same origin rules that any XHR does
* e.g. No cross domain requests without CORS. * e.g. No cross domain requests without CORS.
* *
* @param {string|TypedArray|DocumentInitParameters} source Can be a url to * @param {string|TypedArray|DocumentInitParameters|PDFDataRangeTransport} src
* where a PDF is located, a typed array (Uint8Array) already populated with * Can be a url to where a PDF is located, a typed array (Uint8Array)
* data or parameter object. * already populated with data or parameter object.
* *
* @param {Object} pdfDataRangeTransport is optional. It is used if you want * @param {PDFDataRangeTransport} pdfDataRangeTransport (deprecated) It is used
* to manually serve range requests for data in the PDF. See viewer.js for * if you want to manually serve range requests for data in the PDF.
* an example of pdfDataRangeTransport's interface.
* *
* @param {function} passwordCallback is optional. It is used to request a * @param {function} passwordCallback (deprecated) It is used to request a
* password if wrong or no password was provided. The callback receives two * password if wrong or no password was provided. The callback receives two
* parameters: function that needs to be called with new password and reason * parameters: function that needs to be called with new password and reason
* (see {PasswordResponses}). * (see {PasswordResponses}).
* *
* @param {function} progressCallback is optional. It is used to be able to * @param {function} progressCallback (deprecated) It is used to be able to
* monitor the loading progress of the PDF file (necessary to implement e.g. * monitor the loading progress of the PDF file (necessary to implement e.g.
* a loading bar). The callback receives an {Object} with the properties: * a loading bar). The callback receives an {Object} with the properties:
* {number} loaded and {number} total. * {number} loaded and {number} total.
* *
* @return {Promise} A promise that is resolved with {@link PDFDocumentProxy} * @return {PDFDocumentLoadingTask}
* object.
*/ */
PDFJS.getDocument = function getDocument(source, PDFJS.getDocument = function getDocument(src,
pdfDataRangeTransport, pdfDataRangeTransport,
passwordCallback, passwordCallback,
progressCallback) { progressCallback) {
var workerInitializedCapability, workerReadyCapability, transport; var task = new PDFDocumentLoadingTask();
if (typeof source === 'string') { // Support of the obsolete arguments (for compatibility with API v1.0)
source = { url: source }; if (pdfDataRangeTransport) {
} else if (isArrayBuffer(source)) { if (!(pdfDataRangeTransport instanceof PDFDataRangeTransport)) {
source = { data: source }; // Not a PDFDataRangeTransport instance, trying to add missing properties.
} else if (typeof source !== 'object') { pdfDataRangeTransport = Object.create(pdfDataRangeTransport);
error('Invalid parameter in getDocument, need either Uint8Array, ' + pdfDataRangeTransport.length = src.length;
'string or a parameter object'); pdfDataRangeTransport.initialData = src.initialData;
}
src = Object.create(src);
src.range = pdfDataRangeTransport;
}
task.onPassword = passwordCallback || null;
task.onProgress = progressCallback || null;
var workerInitializedCapability, transport;
var source;
if (typeof src === 'string') {
source = { url: src };
} else if (isArrayBuffer(src)) {
source = { data: src };
} else if (src instanceof PDFDataRangeTransport) {
source = { range: src };
} else {
if (typeof src !== 'object') {
error('Invalid parameter in getDocument, need either Uint8Array, ' +
'string or a parameter object');
}
if (!src.url && !src.data && !src.range) {
error('Invalid parameter object: need either .data, .range or .url');
}
source = src;
} }
if (!source.url && !source.data) {
error('Invalid parameter array, need either .data or .url');
}
// copy/use all keys as is except 'url' -- full path is required
var params = {}; var params = {};
for (var key in source) { for (var key in source) {
if (key === 'url' && typeof window !== 'undefined') { if (key === 'url' && typeof window !== 'undefined') {
// The full path is required in the 'url' field.
params[key] = combineUrl(window.location.href, source[key]); params[key] = combineUrl(window.location.href, source[key]);
continue; continue;
} else if (key === 'range') {
continue;
} else if (key === 'data' && !(source[key] instanceof Uint8Array)) {
// Converting string or array-like data to Uint8Array.
var pdfBytes = source[key];
if (typeof pdfBytes === 'string') {
params[key] = stringToBytes(pdfBytes);
} else if (typeof pdfBytes === 'object' && pdfBytes !== null &&
!isNaN(pdfBytes.length)) {
params[key] = new Uint8Array(pdfBytes);
} else {
error('Invalid PDF binary data: either typed array, string or ' +
'array-like object is expected in the data property.');
}
continue;
} }
params[key] = source[key]; params[key] = source[key];
} }
workerInitializedCapability = createPromiseCapability(); workerInitializedCapability = createPromiseCapability();
workerReadyCapability = createPromiseCapability(); transport = new WorkerTransport(workerInitializedCapability, source.range);
transport = new WorkerTransport(workerInitializedCapability,
workerReadyCapability, pdfDataRangeTransport,
progressCallback);
workerInitializedCapability.promise.then(function transportInitialized() { workerInitializedCapability.promise.then(function transportInitialized() {
transport.passwordCallback = passwordCallback; transport.fetchDocument(task, params);
transport.fetchDocument(params);
}); });
return workerReadyCapability.promise;
return task;
}; };
/**
* PDF document loading operation.
* @class
*/
var PDFDocumentLoadingTask = (function PDFDocumentLoadingTaskClosure() {
/** @constructs PDFDocumentLoadingTask */
function PDFDocumentLoadingTask() {
this._capability = createPromiseCapability();
/**
* Callback to request a password if wrong or no password was provided.
* The callback receives two parameters: function that needs to be called
* with new password and reason (see {PasswordResponses}).
*/
this.onPassword = null;
/**
* Callback to be able to monitor the loading progress of the PDF file
* (necessary to implement e.g. a loading bar). The callback receives
* an {Object} with the properties: {number} loaded and {number} total.
*/
this.onProgress = null;
}
PDFDocumentLoadingTask.prototype =
/** @lends PDFDocumentLoadingTask.prototype */ {
/**
* @return {Promise}
*/
get promise() {
return this._capability.promise;
},
// TODO add cancel or abort method
/**
* Registers callbacks to indicate the document loading completion.
*
* @param {function} onFulfilled The callback for the loading completion.
* @param {function} onRejected The callback for the loading failure.
* @return {Promise} A promise that is resolved after the onFulfilled or
* onRejected callback.
*/
then: function PDFDocumentLoadingTask_then(onFulfilled, onRejected) {
return this.promise.then.apply(this.promise, arguments);
}
};
return PDFDocumentLoadingTask;
})();
/**
* Abstract class to support range requests file loading.
* @class
*/
var PDFDataRangeTransport = (function pdfDataRangeTransportClosure() {
/**
* @constructs PDFDataRangeTransport
* @param {number} length
* @param {Uint8Array} initialData
*/
function PDFDataRangeTransport(length, initialData) {
this.length = length;
this.initialData = initialData;
this._rangeListeners = [];
this._progressListeners = [];
this._progressiveReadListeners = [];
this._readyCapability = createPromiseCapability();
}
PDFDataRangeTransport.prototype =
/** @lends PDFDataRangeTransport.prototype */ {
addRangeListener:
function PDFDataRangeTransport_addRangeListener(listener) {
this._rangeListeners.push(listener);
},
addProgressListener:
function PDFDataRangeTransport_addProgressListener(listener) {
this._progressListeners.push(listener);
},
addProgressiveReadListener:
function PDFDataRangeTransport_addProgressiveReadListener(listener) {
this._progressiveReadListeners.push(listener);
},
onDataRange: function PDFDataRangeTransport_onDataRange(begin, chunk) {
var listeners = this._rangeListeners;
for (var i = 0, n = listeners.length; i < n; ++i) {
listeners[i](begin, chunk);
}
},
onDataProgress: function PDFDataRangeTransport_onDataProgress(loaded) {
this._readyCapability.promise.then(function () {
var listeners = this._progressListeners;
for (var i = 0, n = listeners.length; i < n; ++i) {
listeners[i](loaded);
}
}.bind(this));
},
onDataProgressiveRead:
function PDFDataRangeTransport_onDataProgress(chunk) {
this._readyCapability.promise.then(function () {
var listeners = this._progressiveReadListeners;
for (var i = 0, n = listeners.length; i < n; ++i) {
listeners[i](chunk);
}
}.bind(this));
},
transportReady: function PDFDataRangeTransport_transportReady() {
this._readyCapability.resolve();
},
requestDataRange:
function PDFDataRangeTransport_requestDataRange(begin, end) {
throw new Error('Abstract method PDFDataRangeTransport.requestDataRange');
}
};
return PDFDataRangeTransport;
})();
PDFJS.PDFDataRangeTransport = PDFDataRangeTransport;
/** /**
* Proxy to a PDFDocument in the worker thread. Also, contains commonly used * Proxy to a PDFDocument in the worker thread. Also, contains commonly used
* properties that can be read synchronously. * properties that can be read synchronously.
@ -1639,7 +1809,7 @@ var PDFDocumentProxy = (function PDFDocumentProxyClosure() {
return this.transport.downloadInfoCapability.promise; return this.transport.downloadInfoCapability.promise;
}, },
/** /**
* @returns {Promise} A promise this is resolved with current stats about * @return {Promise} A promise this is resolved with current stats about
* document structures (see {@link PDFDocumentStats}). * document structures (see {@link PDFDocumentStats}).
*/ */
getStats: function PDFDocumentProxy_getStats() { getStats: function PDFDocumentProxy_getStats() {
@ -1703,7 +1873,7 @@ var PDFDocumentProxy = (function PDFDocumentProxyClosure() {
* (default value is 'display'). * (default value is 'display').
* @property {Object} imageLayer - (optional) An object that has beginLayout, * @property {Object} imageLayer - (optional) An object that has beginLayout,
* endLayout and appendImage functions. * endLayout and appendImage functions.
* @property {function} continueCallback - (optional) A function that will be * @property {function} continueCallback - (deprecated) A function that will be
* called each time the rendering is paused. To continue * called each time the rendering is paused. To continue
* rendering call the function that is the first argument * rendering call the function that is the first argument
* to the callback. * to the callback.
@ -1836,7 +2006,12 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
intentState.renderTasks = []; intentState.renderTasks = [];
} }
intentState.renderTasks.push(internalRenderTask); intentState.renderTasks.push(internalRenderTask);
var renderTask = new RenderTask(internalRenderTask); var renderTask = internalRenderTask.task;
// Obsolete parameter support
if (params.continueCallback) {
renderTask.onContinue = params.continueCallback;
}
var self = this; var self = this;
intentState.displayReadyCapability.promise.then( intentState.displayReadyCapability.promise.then(
@ -2001,19 +2176,16 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
* @ignore * @ignore
*/ */
var WorkerTransport = (function WorkerTransportClosure() { var WorkerTransport = (function WorkerTransportClosure() {
function WorkerTransport(workerInitializedCapability, workerReadyCapability, function WorkerTransport(workerInitializedCapability, pdfDataRangeTransport) {
pdfDataRangeTransport, progressCallback) {
this.pdfDataRangeTransport = pdfDataRangeTransport; this.pdfDataRangeTransport = pdfDataRangeTransport;
this.workerInitializedCapability = workerInitializedCapability; this.workerInitializedCapability = workerInitializedCapability;
this.workerReadyCapability = workerReadyCapability;
this.progressCallback = progressCallback;
this.commonObjs = new PDFObjects(); this.commonObjs = new PDFObjects();
this.loadingTask = null;
this.pageCache = []; this.pageCache = [];
this.pagePromises = []; this.pagePromises = [];
this.downloadInfoCapability = createPromiseCapability(); this.downloadInfoCapability = createPromiseCapability();
this.passwordCallback = null;
// If worker support isn't disabled explicit and the browser has worker // If worker support isn't disabled explicit and the browser has worker
// support, create a new web worker and test if it/the browser fullfills // support, create a new web worker and test if it/the browser fullfills
@ -2152,48 +2324,50 @@ var WorkerTransport = (function WorkerTransportClosure() {
this.numPages = data.pdfInfo.numPages; this.numPages = data.pdfInfo.numPages;
var pdfDocument = new PDFDocumentProxy(pdfInfo, this); var pdfDocument = new PDFDocumentProxy(pdfInfo, this);
this.pdfDocument = pdfDocument; this.pdfDocument = pdfDocument;
this.workerReadyCapability.resolve(pdfDocument); this.loadingTask._capability.resolve(pdfDocument);
}, this); }, this);
messageHandler.on('NeedPassword', messageHandler.on('NeedPassword',
function transportNeedPassword(exception) { function transportNeedPassword(exception) {
if (this.passwordCallback) { var loadingTask = this.loadingTask;
return this.passwordCallback(updatePassword, if (loadingTask.onPassword) {
PasswordResponses.NEED_PASSWORD); return loadingTask.onPassword(updatePassword,
PasswordResponses.NEED_PASSWORD);
} }
this.workerReadyCapability.reject( loadingTask._capability.reject(
new PasswordException(exception.message, exception.code)); new PasswordException(exception.message, exception.code));
}, this); }, this);
messageHandler.on('IncorrectPassword', messageHandler.on('IncorrectPassword',
function transportIncorrectPassword(exception) { function transportIncorrectPassword(exception) {
if (this.passwordCallback) { var loadingTask = this.loadingTask;
return this.passwordCallback(updatePassword, if (loadingTask.onPassword) {
PasswordResponses.INCORRECT_PASSWORD); return loadingTask.onPassword(updatePassword,
PasswordResponses.INCORRECT_PASSWORD);
} }
this.workerReadyCapability.reject( loadingTask._capability.reject(
new PasswordException(exception.message, exception.code)); new PasswordException(exception.message, exception.code));
}, this); }, this);
messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) { messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) {
this.workerReadyCapability.reject( this.loadingTask._capability.reject(
new InvalidPDFException(exception.message)); new InvalidPDFException(exception.message));
}, this); }, this);
messageHandler.on('MissingPDF', function transportMissingPDF(exception) { messageHandler.on('MissingPDF', function transportMissingPDF(exception) {
this.workerReadyCapability.reject( this.loadingTask._capability.reject(
new MissingPDFException(exception.message)); new MissingPDFException(exception.message));
}, this); }, this);
messageHandler.on('UnexpectedResponse', messageHandler.on('UnexpectedResponse',
function transportUnexpectedResponse(exception) { function transportUnexpectedResponse(exception) {
this.workerReadyCapability.reject( this.loadingTask._capability.reject(
new UnexpectedResponseException(exception.message, exception.status)); new UnexpectedResponseException(exception.message, exception.status));
}, this); }, this);
messageHandler.on('UnknownError', messageHandler.on('UnknownError',
function transportUnknownError(exception) { function transportUnknownError(exception) {
this.workerReadyCapability.reject( this.loadingTask._capability.reject(
new UnknownErrorException(exception.message, exception.details)); new UnknownErrorException(exception.message, exception.details));
}, this); }, this);
@ -2288,8 +2462,9 @@ var WorkerTransport = (function WorkerTransportClosure() {
}, this); }, this);
messageHandler.on('DocProgress', function transportDocProgress(data) { messageHandler.on('DocProgress', function transportDocProgress(data) {
if (this.progressCallback) { var loadingTask = this.loadingTask;
this.progressCallback({ if (loadingTask.onProgress) {
loadingTask.onProgress({
loaded: data.loaded, loaded: data.loaded,
total: data.total total: data.total
}); });
@ -2349,10 +2524,16 @@ var WorkerTransport = (function WorkerTransportClosure() {
}); });
}, },
fetchDocument: function WorkerTransport_fetchDocument(source) { fetchDocument: function WorkerTransport_fetchDocument(loadingTask, source) {
this.loadingTask = loadingTask;
source.disableAutoFetch = PDFJS.disableAutoFetch; source.disableAutoFetch = PDFJS.disableAutoFetch;
source.disableStream = PDFJS.disableStream; source.disableStream = PDFJS.disableStream;
source.chunkedViewerLoading = !!this.pdfDataRangeTransport; source.chunkedViewerLoading = !!this.pdfDataRangeTransport;
if (this.pdfDataRangeTransport) {
source.length = this.pdfDataRangeTransport.length;
source.initialData = this.pdfDataRangeTransport.initialData;
}
this.messageHandler.send('GetDocRequest', { this.messageHandler.send('GetDocRequest', {
source: source, source: source,
disableRange: PDFJS.disableRange, disableRange: PDFJS.disableRange,
@ -2563,26 +2744,37 @@ var PDFObjects = (function PDFObjectsClosure() {
*/ */
var RenderTask = (function RenderTaskClosure() { var RenderTask = (function RenderTaskClosure() {
function RenderTask(internalRenderTask) { function RenderTask(internalRenderTask) {
this.internalRenderTask = internalRenderTask; this._internalRenderTask = internalRenderTask;
/** /**
* Promise for rendering task completion. * Callback for incremental rendering -- a function that will be called
* @type {Promise} * each time the rendering is paused. To continue rendering call the
* function that is the first argument to the callback.
* @type {function}
*/ */
this.promise = this.internalRenderTask.capability.promise; this.onContinue = null;
} }
RenderTask.prototype = /** @lends RenderTask.prototype */ { RenderTask.prototype = /** @lends RenderTask.prototype */ {
/**
* Promise for rendering task completion.
* @return {Promise}
*/
get promise() {
return this._internalRenderTask.capability.promise;
},
/** /**
* Cancels the rendering task. If the task is currently rendering it will * Cancels the rendering task. If the task is currently rendering it will
* not be cancelled until graphics pauses with a timeout. The promise that * not be cancelled until graphics pauses with a timeout. The promise that
* this object extends will resolved when cancelled. * this object extends will resolved when cancelled.
*/ */
cancel: function RenderTask_cancel() { cancel: function RenderTask_cancel() {
this.internalRenderTask.cancel(); this._internalRenderTask.cancel();
}, },
/** /**
* Registers callback to indicate the rendering task completion. * Registers callbacks to indicate the rendering task completion.
* *
* @param {function} onFulfilled The callback for the rendering completion. * @param {function} onFulfilled The callback for the rendering completion.
* @param {function} onRejected The callback for the rendering failure. * @param {function} onRejected The callback for the rendering failure.
@ -2590,7 +2782,7 @@ var RenderTask = (function RenderTaskClosure() {
* onRejected callback. * onRejected callback.
*/ */
then: function RenderTask_then(onFulfilled, onRejected) { then: function RenderTask_then(onFulfilled, onRejected) {
return this.promise.then(onFulfilled, onRejected); return this.promise.then.apply(this.promise, arguments);
} }
}; };
@ -2617,6 +2809,7 @@ var InternalRenderTask = (function InternalRenderTaskClosure() {
this.graphicsReady = false; this.graphicsReady = false;
this.cancelled = false; this.cancelled = false;
this.capability = createPromiseCapability(); this.capability = createPromiseCapability();
this.task = new RenderTask(this);
// caching this-bound methods // caching this-bound methods
this._continueBound = this._continue.bind(this); this._continueBound = this._continue.bind(this);
this._scheduleNextBound = this._scheduleNext.bind(this); this._scheduleNextBound = this._scheduleNext.bind(this);
@ -2679,8 +2872,8 @@ var InternalRenderTask = (function InternalRenderTaskClosure() {
if (this.cancelled) { if (this.cancelled) {
return; return;
} }
if (this.params.continueCallback) { if (this.task.onContinue) {
this.params.continueCallback(this._scheduleNextBound); this.task.onContinue.call(this.task, this._scheduleNextBound);
} else { } else {
this._scheduleNext(); this._scheduleNext();
} }

View File

@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') {
(typeof window !== 'undefined' ? window : this).PDFJS = {}; (typeof window !== 'undefined' ? window : this).PDFJS = {};
} }
PDFJS.version = '1.0.1040'; PDFJS.version = '1.0.1130';
PDFJS.build = '997096f'; PDFJS.build = 'e4f0ae2';
(function pdfjsWrapper() { (function pdfjsWrapper() {
// Use strict in our context only - users might not want it // Use strict in our context only - users might not want it
@ -341,6 +341,7 @@ function isValidUrl(url, allowRelative) {
case 'https': case 'https':
case 'ftp': case 'ftp':
case 'mailto': case 'mailto':
case 'tel':
return true; return true;
default: default:
return false; return false;
@ -470,6 +471,8 @@ var XRefParseException = (function XRefParseExceptionClosure() {
function bytesToString(bytes) { function bytesToString(bytes) {
assert(bytes !== null && typeof bytes === 'object' &&
bytes.length !== undefined, 'Invalid argument for bytesToString');
var length = bytes.length; var length = bytes.length;
var MAX_ARGUMENT_COUNT = 8192; var MAX_ARGUMENT_COUNT = 8192;
if (length < MAX_ARGUMENT_COUNT) { if (length < MAX_ARGUMENT_COUNT) {
@ -485,6 +488,7 @@ function bytesToString(bytes) {
} }
function stringToBytes(str) { function stringToBytes(str) {
assert(typeof str === 'string', 'Invalid argument for stringToBytes');
var length = str.length; var length = str.length;
var bytes = new Uint8Array(length); var bytes = new Uint8Array(length);
for (var i = 0; i < length; ++i) { for (var i = 0; i < length; ++i) {
@ -1449,6 +1453,9 @@ var ChunkedStream = (function ChunkedStreamClosure() {
getUint16: function ChunkedStream_getUint16() { getUint16: function ChunkedStream_getUint16() {
var b0 = this.getByte(); var b0 = this.getByte();
var b1 = this.getByte(); var b1 = this.getByte();
if (b0 === -1 || b1 === -1) {
return -1;
}
return (b0 << 8) + b1; return (b0 << 8) + b1;
}, },
@ -14056,7 +14063,7 @@ var SpecialPUASymbols = {
'63731': 0x23A9, // braceleftbt (0xF8F3) '63731': 0x23A9, // braceleftbt (0xF8F3)
'63740': 0x23AB, // bracerighttp (0xF8FC) '63740': 0x23AB, // bracerighttp (0xF8FC)
'63741': 0x23AC, // bracerightmid (0xF8FD) '63741': 0x23AC, // bracerightmid (0xF8FD)
'63742': 0x23AD, // bracerightmid (0xF8FE) '63742': 0x23AD, // bracerightbt (0xF8FE)
'63726': 0x23A1, // bracketlefttp (0xF8EE) '63726': 0x23A1, // bracketlefttp (0xF8EE)
'63727': 0x23A2, // bracketleftex (0xF8EF) '63727': 0x23A2, // bracketleftex (0xF8EF)
'63728': 0x23A3, // bracketleftbt (0xF8F0) '63728': 0x23A3, // bracketleftbt (0xF8F0)
@ -15996,7 +16003,7 @@ var Font = (function FontClosure() {
// to be used with the canvas.font. // to be used with the canvas.font.
var fontName = name.replace(/[,_]/g, '-'); var fontName = name.replace(/[,_]/g, '-');
var isStandardFont = !!stdFontMap[fontName] || var isStandardFont = !!stdFontMap[fontName] ||
(nonStdFontMap[fontName] && !!stdFontMap[nonStdFontMap[fontName]]); !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName; fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
this.bold = (fontName.search(/bold/gi) !== -1); this.bold = (fontName.search(/bold/gi) !== -1);
@ -29595,6 +29602,102 @@ var Parser = (function ParserClosure() {
} }
return ((stream.pos - 4) - startPos); return ((stream.pos - 4) - startPos);
}, },
/**
* Find the EOI (end-of-image) marker 0xFFD9 of the stream.
* @returns {number} The inline stream length.
*/
findDCTDecodeInlineStreamEnd:
function Parser_findDCTDecodeInlineStreamEnd(stream) {
var startPos = stream.pos, foundEOI = false, b, markerLength, length;
while ((b = stream.getByte()) !== -1) {
if (b !== 0xFF) { // Not a valid marker.
continue;
}
switch (stream.getByte()) {
case 0x00: // Byte stuffing.
// 0xFF00 appears to be a very common byte sequence in JPEG images.
break;
case 0xFF: // Fill byte.
// Avoid skipping a valid marker, resetting the stream position.
stream.skip(-1);
break;
case 0xD9: // EOI
foundEOI = true;
break;
case 0xC0: // SOF0
case 0xC1: // SOF1
case 0xC2: // SOF2
case 0xC3: // SOF3
case 0xC5: // SOF5
case 0xC6: // SOF6
case 0xC7: // SOF7
case 0xC9: // SOF9
case 0xCA: // SOF10
case 0xCB: // SOF11
case 0xCD: // SOF13
case 0xCE: // SOF14
case 0xCF: // SOF15
case 0xC4: // DHT
case 0xCC: // DAC
case 0xDA: // SOS
case 0xDB: // DQT
case 0xDC: // DNL
case 0xDD: // DRI
case 0xDE: // DHP
case 0xDF: // EXP
case 0xE0: // APP0
case 0xE1: // APP1
case 0xE2: // APP2
case 0xE3: // APP3
case 0xE4: // APP4
case 0xE5: // APP5
case 0xE6: // APP6
case 0xE7: // APP7
case 0xE8: // APP8
case 0xE9: // APP9
case 0xEA: // APP10
case 0xEB: // APP11
case 0xEC: // APP12
case 0xED: // APP13
case 0xEE: // APP14
case 0xEF: // APP15
case 0xFE: // COM
// The marker should be followed by the length of the segment.
markerLength = stream.getUint16();
if (markerLength > 2) {
// |markerLength| contains the byte length of the marker segment,
// including its own length (2 bytes) and excluding the marker.
stream.skip(markerLength - 2); // Jump to the next marker.
} else {
// The marker length is invalid, resetting the stream position.
stream.skip(-2);
}
break;
}
if (foundEOI) {
break;
}
}
length = stream.pos - startPos;
if (b === -1) {
warn('Inline DCTDecode image stream: ' +
'EOI marker not found, searching for /EI/ instead.');
stream.skip(-length); // Reset the stream position.
return this.findDefaultInlineStreamEnd(stream);
}
this.inlineStreamSkipEI(stream);
return length;
},
/** /**
* Find the EOD (end-of-data) marker '~>' (i.e. TILDE + GT) of the stream. * Find the EOD (end-of-data) marker '~>' (i.e. TILDE + GT) of the stream.
* @returns {number} The inline stream length. * @returns {number} The inline stream length.
@ -29686,7 +29789,9 @@ var Parser = (function ParserClosure() {
// Parse image stream. // Parse image stream.
var startPos = stream.pos, length, i, ii; var startPos = stream.pos, length, i, ii;
if (filterName === 'ASCII85Decide' || filterName === 'A85') { if (filterName === 'DCTDecode' || filterName === 'DCT') {
length = this.findDCTDecodeInlineStreamEnd(stream);
} else if (filterName === 'ASCII85Decide' || filterName === 'A85') {
length = this.findASCII85DecodeInlineStreamEnd(stream); length = this.findASCII85DecodeInlineStreamEnd(stream);
} else if (filterName === 'ASCIIHexDecode' || filterName === 'AHx') { } else if (filterName === 'ASCIIHexDecode' || filterName === 'AHx') {
length = this.findASCIIHexDecodeInlineStreamEnd(stream); length = this.findASCIIHexDecodeInlineStreamEnd(stream);
@ -30613,6 +30718,9 @@ var Stream = (function StreamClosure() {
getUint16: function Stream_getUint16() { getUint16: function Stream_getUint16() {
var b0 = this.getByte(); var b0 = this.getByte();
var b1 = this.getByte(); var b1 = this.getByte();
if (b0 === -1 || b1 === -1) {
return -1;
}
return (b0 << 8) + b1; return (b0 << 8) + b1;
}, },
getInt32: function Stream_getInt32() { getInt32: function Stream_getInt32() {
@ -30740,6 +30848,9 @@ var DecodeStream = (function DecodeStreamClosure() {
getUint16: function DecodeStream_getUint16() { getUint16: function DecodeStream_getUint16() {
var b0 = this.getByte(); var b0 = this.getByte();
var b1 = this.getByte(); var b1 = this.getByte();
if (b0 === -1 || b1 === -1) {
return -1;
}
return (b0 << 8) + b1; return (b0 << 8) + b1;
}, },
getInt32: function DecodeStream_getInt32() { getInt32: function DecodeStream_getInt32() {
@ -34839,11 +34950,6 @@ var JpxImage = (function JpxImageClosure() {
context.QCC = []; context.QCC = [];
context.COC = []; context.COC = [];
break; break;
case 0xFF55: // Tile-part lengths, main header (TLM)
var Ltlm = readUint16(data, position); // Marker segment length
// Skip tile length markers
position += Ltlm;
break;
case 0xFF5C: // Quantization default (QCD) case 0xFF5C: // Quantization default (QCD)
length = readUint16(data, position); length = readUint16(data, position);
var qcd = {}; var qcd = {};
@ -35033,6 +35139,9 @@ var JpxImage = (function JpxImageClosure() {
length = tile.dataEnd - position; length = tile.dataEnd - position;
parseTilePackets(context, data, position, length); parseTilePackets(context, data, position, length);
break; break;
case 0xFF55: // Tile-part lengths, main header (TLM)
case 0xFF57: // Packet length, main header (PLM)
case 0xFF58: // Packet length, tile-part header (PLT)
case 0xFF64: // Comment (COM) case 0xFF64: // Comment (COM)
length = readUint16(data, position); length = readUint16(data, position);
// skipping content // skipping content
@ -35373,7 +35482,7 @@ var JpxImage = (function JpxImageClosure() {
r = 0; r = 0;
c = 0; c = 0;
p = 0; p = 0;
this.nextPacket = function JpxImage_nextPacket() { this.nextPacket = function JpxImage_nextPacket() {
// Section B.12.1.3 Resolution-position-component-layer // Section B.12.1.3 Resolution-position-component-layer
for (; r <= maxDecompositionLevelsCount; r++) { for (; r <= maxDecompositionLevelsCount; r++) {
@ -35457,7 +35566,7 @@ var JpxImage = (function JpxImageClosure() {
var componentsCount = siz.Csiz; var componentsCount = siz.Csiz;
var precinctsSizes = getPrecinctSizesInImageScale(tile); var precinctsSizes = getPrecinctSizesInImageScale(tile);
var l = 0, r = 0, c = 0, px = 0, py = 0; var l = 0, r = 0, c = 0, px = 0, py = 0;
this.nextPacket = function JpxImage_nextPacket() { this.nextPacket = function JpxImage_nextPacket() {
// Section B.12.1.5 Component-position-resolution-layer // Section B.12.1.5 Component-position-resolution-layer
for (; c < componentsCount; ++c) { for (; c < componentsCount; ++c) {
@ -37030,10 +37139,9 @@ var Jbig2Image = (function Jbig2ImageClosure() {
// At each pixel: Clear contextLabel pixels that are shifted // At each pixel: Clear contextLabel pixels that are shifted
// out of the context, then add new ones. // out of the context, then add new ones.
// If j + n is out of range at the right image border, then
// the undefined value of bitmap[i - 2][j + n] is shifted to 0
contextLabel = ((contextLabel & OLD_PIXEL_MASK) << 1) | contextLabel = ((contextLabel & OLD_PIXEL_MASK) << 1) |
(row2[j + 3] << 11) | (row1[j + 4] << 4) | pixel; (j + 3 < width ? row2[j + 3] << 11 : 0) |
(j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
} }
} }

View File

@ -20,6 +20,7 @@
right: 0; right: 0;
bottom: 0; bottom: 0;
overflow: hidden; overflow: hidden;
opacity: 0.2;
} }
.textLayer > div { .textLayer > div {
@ -55,6 +56,9 @@
background-color: rgb(0, 100, 0); background-color: rgb(0, 100, 0);
} }
.textLayer ::selection { background: rgb(0,0,255); }
.textLayer ::-moz-selection { background: rgb(0,0,255); }
.pdfViewer .canvasWrapper { .pdfViewer .canvasWrapper {
overflow: hidden; overflow: hidden;
} }
@ -1153,9 +1157,13 @@ html[dir='rtl'] .verticalToolbarSeparator {
margin-bottom: 10px; margin-bottom: 10px;
} }
#thumbnailView > a:last-of-type > .thumbnail:not([data-loaded]) {
margin-bottom: 9px;
}
.thumbnail:not([data-loaded]) { .thumbnail:not([data-loaded]) {
border: 1px dashed rgba(255, 255, 255, 0.5); border: 1px dashed rgba(255, 255, 255, 0.5);
margin-bottom: 10px; margin: -1px -1px 4px -1px;
} }
.thumbnailImage { .thumbnailImage {
@ -1164,6 +1172,8 @@ html[dir='rtl'] .verticalToolbarSeparator {
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
opacity: 0.8; opacity: 0.8;
z-index: 99; z-index: 99;
background-color: white;
background-clip: content-box;
} }
.thumbnailSelectionRing { .thumbnailSelectionRing {
@ -1294,19 +1304,12 @@ html[dir='rtl'] .attachmentsItem > button {
cursor: default; cursor: default;
} }
/* TODO: file FF bug to support ::-moz-selection:window-inactive /* TODO: file FF bug to support ::-moz-selection:window-inactive
so we can override the opaque grey background when the window is inactive; so we can override the opaque grey background when the window is inactive;
see https://bugzilla.mozilla.org/show_bug.cgi?id=706209 */ see https://bugzilla.mozilla.org/show_bug.cgi?id=706209 */
::selection { background: rgba(0,0,255,0.3); } ::selection { background: rgba(0,0,255,0.3); }
::-moz-selection { background: rgba(0,0,255,0.3); } ::-moz-selection { background: rgba(0,0,255,0.3); }
.textLayer ::selection { background: rgb(0,0,255); }
.textLayer ::-moz-selection { background: rgb(0,0,255); }
.textLayer {
opacity: 0.2;
}
#errorWrapper { #errorWrapper {
background: none repeat scroll 0 0 #FF5555; background: none repeat scroll 0 0 #FF5555;
color: white; color: white;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
<!-- 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/. -->
<!ENTITY tabCrashed.header "Bad news first: This tab has crashed">
<!ENTITY tabCrashed.message "Now for the good news: You can just close this tab, restore it or restore all your crashed tabs.">
<!ENTITY tabCrashed.sendReport "Submit a crash report to help prevent more bad news">
<!ENTITY tabCrashed.reportSent "Crash report already submitted; thank you for helping make &brandShortName; better!">
<!ENTITY tabCrashed.closeTab "Close This Tab">
<!ENTITY tabCrashed.restoreTab "Restore This Tab">
<!ENTITY tabCrashed.restoreAll "Restore All Crashed Tabs">

View File

@ -795,11 +795,6 @@ just addresses the organization to follow, e.g. "This site is run by " -->
a CSS length value. --> a CSS length value. -->
<!ENTITY pluginNotification.width "28em"> <!ENTITY pluginNotification.width "28em">
<!ENTITY tabCrashed.header "Tab crashed">
<!ENTITY tabCrashed.message "Well, this is embarrassing. We tried to display this Web page, but it's not responding.">
<!ENTITY tabCrashed.checkSendReport "Tell &vendorShortName; about this crash so they can fix it.">
<!ENTITY tabCrashed.tryAgain "Try Again">
<!ENTITY uiTour.infoPanel.close "Close"> <!ENTITY uiTour.infoPanel.close "Close">
<!ENTITY appMenuSidebars.label "Sidebars"> <!ENTITY appMenuSidebars.label "Sidebars">

View File

@ -18,6 +18,7 @@
locale/browser/aboutHealthReport.dtd (%chrome/browser/aboutHealthReport.dtd) locale/browser/aboutHealthReport.dtd (%chrome/browser/aboutHealthReport.dtd)
#endif #endif
locale/browser/aboutSessionRestore.dtd (%chrome/browser/aboutSessionRestore.dtd) locale/browser/aboutSessionRestore.dtd (%chrome/browser/aboutSessionRestore.dtd)
locale/browser/aboutTabCrashed.dtd (%chrome/browser/aboutTabCrashed.dtd)
#ifdef MOZ_SERVICES_SYNC #ifdef MOZ_SERVICES_SYNC
locale/browser/syncProgress.dtd (%chrome/browser/syncProgress.dtd) locale/browser/syncProgress.dtd (%chrome/browser/syncProgress.dtd)
locale/browser/syncCustomize.dtd (%chrome/browser/syncCustomize.dtd) locale/browser/syncCustomize.dtd (%chrome/browser/syncCustomize.dtd)

View File

@ -82,6 +82,7 @@ this.TabCrashReporter = {
if (this.browserMap.get(browser) == childID) { if (this.browserMap.get(browser) == childID) {
this.browserMap.delete(browser); this.browserMap.delete(browser);
browser.contentDocument.documentElement.classList.remove("crashDumpAvailable"); browser.contentDocument.documentElement.classList.remove("crashDumpAvailable");
browser.contentDocument.documentElement.classList.add("crashDumpSubmitted");
} }
} }
} }

View File

@ -1,108 +0,0 @@
body {
background-color: rgb(241, 244, 248);
margin-top: 2em;
font: message-box;
font-size: 100%;
}
p {
font-size: .8em;
}
#error-box {
background: url('chrome://global/skin/icons/information-24.png') no-repeat left 4px;
-moz-padding-start: 30px;
}
#error-box:-moz-locale-dir(rtl) {
background-position: right 4px;
}
#main-error-msg {
color: #4b4b4b;
font-weight: bold;
}
#report-box {
text-align: center;
width: 75%;
margin: 0 auto;
display: none;
}
.crashDumpAvailable #report-box {
display: block
}
#button-box {
text-align: center;
width: 75%;
margin: 0 auto;
}
@media all and (min-width: 300px) {
#error-box {
max-width: 50%;
margin: 0 auto;
background-image: url('chrome://global/skin/icons/information-32.png');
min-height: 36px;
-moz-padding-start: 38px;
}
button {
width: auto !important;
min-width: 150px;
}
}
@media all and (min-width: 780px) {
#error-box {
max-width: 30%;
}
}
button {
font: message-box;
font-size: 0.6875em;
-moz-appearance: none;
-moz-user-select: none;
width: 100%;
margin: 2px 0;
padding: 2px 6px;
line-height: 1.2;
background-color: hsla(210,30%,95%,.1);
background-image: linear-gradient(hsla(0,0%,100%,.6), hsla(0,0%,100%,.1));
background-clip: padding-box;
border: 1px solid hsla(210,15%,25%,.4);
border-color: hsla(210,15%,25%,.3) hsla(210,15%,25%,.35) hsla(210,15%,25%,.4);
border-radius: 3px;
box-shadow: 0 1px 0 hsla(0,0%,100%,.3) inset,
0 0 0 1px hsla(0,0%,100%,.3) inset,
0 1px 0 hsla(0,0%,100%,.1);
transition-property: background-color, border-color, box-shadow;
transition-duration: 150ms;
transition-timing-function: ease;
}
button:hover {
background-color: hsla(210,30%,95%,.8);
border-color: hsla(210,15%,25%,.45) hsla(210,15%,25%,.5) hsla(210,15%,25%,.55);
box-shadow: 0 1px 0 hsla(0,0%,100%,.3) inset,
0 0 0 1px hsla(0,0%,100%,.3) inset,
0 1px 0 hsla(0,0%,100%,.1),
0 0 3px hsla(210,15%,25%,.1);
transition-property: background-color, border-color, box-shadow;
transition-duration: 150ms;
transition-timing-function: ease;
}
button:hover:active {
background-color: hsla(210,15%,25%,.2);
box-shadow: 0 1px 1px hsla(210,15%,25%,.2) inset,
0 0 2px hsla(210,15%,25%,.4) inset;
transition-property: background-color, border-color, box-shadow;
transition-duration: 10ms;
transition-timing-function: linear;
}

View File

@ -191,6 +191,7 @@ browser.jar:
skin/classic/browser/tabbrowser/alltabs.png (tabbrowser/alltabs.png) skin/classic/browser/tabbrowser/alltabs.png (tabbrowser/alltabs.png)
skin/classic/browser/tabbrowser/alltabs-inverted.png (tabbrowser/alltabs-inverted.png) skin/classic/browser/tabbrowser/alltabs-inverted.png (tabbrowser/alltabs-inverted.png)
skin/classic/browser/tabbrowser/connecting.png (tabbrowser/connecting.png) skin/classic/browser/tabbrowser/connecting.png (tabbrowser/connecting.png)
skin/classic/browser/tabbrowser/crashed.svg (../shared/tabbrowser/crashed.svg)
skin/classic/browser/tabbrowser/loading.png (tabbrowser/loading.png) skin/classic/browser/tabbrowser/loading.png (tabbrowser/loading.png)
skin/classic/browser/tabbrowser/tab-active-middle.png (tabbrowser/tab-active-middle.png) skin/classic/browser/tabbrowser/tab-active-middle.png (tabbrowser/tab-active-middle.png)
skin/classic/browser/tabbrowser/tab-arrow-left.png (tabbrowser/tab-arrow-left.png) skin/classic/browser/tabbrowser/tab-arrow-left.png (tabbrowser/tab-arrow-left.png)

View File

@ -3092,6 +3092,14 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
opacity: .9; opacity: .9;
} }
/*
* Force the overlay to create a new stacking context so it always appears on
* top of the icon.
*/
.tab-icon-overlay {
opacity: 0.9999;
}
.tab-label:not([selected="true"]) { .tab-label:not([selected="true"]) {
opacity: .7; opacity: .7;
} }

View File

@ -301,6 +301,7 @@ browser.jar:
skin/classic/browser/tabbrowser/alltabs-box-bkgnd-icon.png (tabbrowser/alltabs-box-bkgnd-icon.png) skin/classic/browser/tabbrowser/alltabs-box-bkgnd-icon.png (tabbrowser/alltabs-box-bkgnd-icon.png)
skin/classic/browser/tabbrowser/alltabs-box-bkgnd-icon-inverted.png (tabbrowser/alltabs-box-bkgnd-icon-inverted.png) skin/classic/browser/tabbrowser/alltabs-box-bkgnd-icon-inverted.png (tabbrowser/alltabs-box-bkgnd-icon-inverted.png)
skin/classic/browser/tabbrowser/alltabs-box-bkgnd-icon-inverted@2x.png (tabbrowser/alltabs-box-bkgnd-icon-inverted@2x.png) skin/classic/browser/tabbrowser/alltabs-box-bkgnd-icon-inverted@2x.png (tabbrowser/alltabs-box-bkgnd-icon-inverted@2x.png)
skin/classic/browser/tabbrowser/crashed.svg (../shared/tabbrowser/crashed.svg)
skin/classic/browser/tabbrowser/newtab.png (tabbrowser/newtab.png) skin/classic/browser/tabbrowser/newtab.png (tabbrowser/newtab.png)
skin/classic/browser/tabbrowser/newtab@2x.png (tabbrowser/newtab@2x.png) skin/classic/browser/tabbrowser/newtab@2x.png (tabbrowser/newtab@2x.png)
skin/classic/browser/tabbrowser/newtab-inverted.png (tabbrowser/newtab-inverted.png) skin/classic/browser/tabbrowser/newtab-inverted.png (tabbrowser/newtab-inverted.png)

View File

@ -1,11 +1,11 @@
/* 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/. */
.title { .title {
background-image: url("chrome://browser/skin/tab-crashed.svg"); background-image: url("chrome://browser/skin/tab-crashed.svg");
} }
#report-box { #reportSent {
display: none; font-weight: bold;
} }
.crashDumpAvailable #report-box {
display: block
}

View File

@ -157,7 +157,8 @@
/* End override @tabCurveHalfWidth@ and @tabCurveWidth@ */ /* End override @tabCurveHalfWidth@ and @tabCurveWidth@ */
#urlbar ::-moz-selection, #urlbar ::-moz-selection,
#navigator-toolbox .searchbar-textbox ::-moz-selection { #navigator-toolbox .searchbar-textbox ::-moz-selection,
.browserContainer > findbar ::-moz-selection {
background-color: var(--chrome-selection-background-color); background-color: var(--chrome-selection-background-color);
color: var(--chrome-selection-color); color: var(--chrome-selection-color);
} }
@ -182,6 +183,16 @@
color: var(--chrome-color); color: var(--chrome-color);
} }
.browserContainer > findbar {
background-image: none;
}
/* Default findbar text color doesn't look good - Bug 1125677 */
.browserContainer > findbar .findbar-find-status,
.browserContainer > findbar .found-matches {
color: inherit;
}
#navigator-toolbox .toolbarbutton-1, #navigator-toolbox .toolbarbutton-1,
.browserContainer > findbar .findbar-button, .browserContainer > findbar .findbar-button,
#PlacesToolbar toolbarbutton.bookmark-item { #PlacesToolbar toolbarbutton.bookmark-item {

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="22 22 16 16" enable-background="new 22 22 16 16" xml:space="preserve">
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="30" y1="23" x2="30" y2="37">
<stop offset="0" style="stop-color:#E63B2E"/>
<stop offset="1" style="stop-color:#C33931"/>
</linearGradient>
<circle fill="url(#SVGID_1_)" cx="30" cy="30" r="7"/>
<g>
<path fill="#FFFFFF" d="M31.03,33.304c0,0.6-0.479,1.092-1.091,1.092c-0.6,0-1.079-0.492-1.079-1.092
c0-0.588,0.479-1.079,1.079-1.079C30.551,32.225,31.03,32.716,31.03,33.304z M29.171,31.133l-0.24-5.253h2.015l-0.24,5.253H29.171z
"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 970 B

View File

@ -65,6 +65,10 @@
-moz-padding-start: 9px; -moz-padding-start: 9px;
} }
.tab-content[pinned] {
-moz-padding-end: 3px;
}
.tab-throbber, .tab-throbber,
.tab-icon-image, .tab-icon-image,
.tab-close-button { .tab-close-button {
@ -75,12 +79,26 @@
.tab-icon-image { .tab-icon-image {
height: 16px; height: 16px;
width: 16px; width: 16px;
-moz-margin-end: 6px;
} }
.tab-icon-image { .tab-icon-image {
list-style-image: url("chrome://mozapps/skin/places/defaultFavicon.png"); list-style-image: url("chrome://mozapps/skin/places/defaultFavicon.png");
} }
.tab-icon-overlay {
width: 16px;
height: 16px;
margin-top: 10px;
-moz-margin-start: -16px;
display: none;
}
.tab-icon-overlay[crashed] {
display: -moz-box;
list-style-image: url("chrome://browser/skin/tabbrowser/crashed.svg");
}
.tab-throbber[busy] { .tab-throbber[busy] {
list-style-image: url("chrome://browser/skin/tabbrowser/connecting.png"); list-style-image: url("chrome://browser/skin/tabbrowser/connecting.png");
} }
@ -89,11 +107,6 @@
list-style-image: url("chrome://browser/skin/tabbrowser/loading.png"); list-style-image: url("chrome://browser/skin/tabbrowser/loading.png");
} }
.tab-throbber:not([pinned]),
.tab-icon-image:not([pinned]) {
-moz-margin-end: 6px;
}
.tab-label { .tab-label {
-moz-margin-end: 0; -moz-margin-end: 0;
-moz-margin-start: 0; -moz-margin-start: 0;

View File

@ -219,6 +219,7 @@ browser.jar:
skin/classic/browser/tabbrowser/newtab.png (tabbrowser/newtab-XPVista7.png) skin/classic/browser/tabbrowser/newtab.png (tabbrowser/newtab-XPVista7.png)
skin/classic/browser/tabbrowser/newtab-inverted.png (tabbrowser/newtab-inverted.png) skin/classic/browser/tabbrowser/newtab-inverted.png (tabbrowser/newtab-inverted.png)
skin/classic/browser/tabbrowser/connecting.png (tabbrowser/connecting.png) skin/classic/browser/tabbrowser/connecting.png (tabbrowser/connecting.png)
skin/classic/browser/tabbrowser/crashed.svg (../shared/tabbrowser/crashed.svg)
skin/classic/browser/tabbrowser/loading.png (tabbrowser/loading.png) skin/classic/browser/tabbrowser/loading.png (tabbrowser/loading.png)
skin/classic/browser/tabbrowser/tab-active-middle.png (tabbrowser/tab-active-middle.png) skin/classic/browser/tabbrowser/tab-active-middle.png (tabbrowser/tab-active-middle.png)
skin/classic/browser/tabbrowser/tab-active-middle@2x.png (tabbrowser/tab-active-middle@2x.png) skin/classic/browser/tabbrowser/tab-active-middle@2x.png (tabbrowser/tab-active-middle@2x.png)
@ -689,6 +690,7 @@ browser.jar:
skin/classic/aero/browser/tabbrowser/newtab-XPVista7.png (tabbrowser/newtab-XPVista7.png) skin/classic/aero/browser/tabbrowser/newtab-XPVista7.png (tabbrowser/newtab-XPVista7.png)
skin/classic/aero/browser/tabbrowser/newtab-inverted.png (tabbrowser/newtab-inverted.png) skin/classic/aero/browser/tabbrowser/newtab-inverted.png (tabbrowser/newtab-inverted.png)
skin/classic/aero/browser/tabbrowser/connecting.png (tabbrowser/connecting.png) skin/classic/aero/browser/tabbrowser/connecting.png (tabbrowser/connecting.png)
skin/classic/aero/browser/tabbrowser/crashed.svg (../shared/tabbrowser/crashed.svg)
skin/classic/aero/browser/tabbrowser/loading.png (tabbrowser/loading.png) skin/classic/aero/browser/tabbrowser/loading.png (tabbrowser/loading.png)
skin/classic/aero/browser/tabbrowser/tab-active-middle.png (tabbrowser/tab-active-middle.png) skin/classic/aero/browser/tabbrowser/tab-active-middle.png (tabbrowser/tab-active-middle.png)
skin/classic/aero/browser/tabbrowser/tab-active-middle@2x.png (tabbrowser/tab-active-middle@2x.png) skin/classic/aero/browser/tabbrowser/tab-active-middle@2x.png (tabbrowser/tab-active-middle@2x.png)

View File

@ -546,7 +546,11 @@ public abstract class BrowserToolbar extends ThemedRelativeLayout
private void updateProgressVisibility() { private void updateProgressVisibility() {
final Tab selectedTab = Tabs.getInstance().getSelectedTab(); final Tab selectedTab = Tabs.getInstance().getSelectedTab();
updateProgressVisibility(selectedTab, selectedTab.getLoadProgress()); // The selected tab may be null if GeckoApp (and thus the
// selected tab) are not yet initialized (bug 1090287).
if (selectedTab != null) {
updateProgressVisibility(selectedTab, selectedTab.getLoadProgress());
}
} }
private void updateProgressVisibility(Tab selectedTab, int progress) { private void updateProgressVisibility(Tab selectedTab, int progress) {

View File

@ -121,7 +121,9 @@ class DebianBootstrapper(BaseBootstrapper):
def suggest_mobile_android_mozconfig(self): def suggest_mobile_android_mozconfig(self):
import android import android
android.suggest_mozconfig(sdk_path=self.sdk_path, # The SDK path that mozconfig wants includes platforms/android-21.
sdk_path = os.path.join(self.sdk_path, 'platforms', android.ANDROID_PLATFORM)
android.suggest_mozconfig(sdk_path=sdk_path,
ndk_path=self.ndk_path) ndk_path=self.ndk_path)
def _update_package_manager(self): def _update_package_manager(self):

View File

@ -287,7 +287,7 @@ AboutProtocolChannel.prototype = {
function AboutProtocolInstance(contractID) function AboutProtocolInstance(contractID)
{ {
this._contractID = contractID; this._contractID = contractID;
this._uriFlags = null; this._uriFlags = undefined;
} }
AboutProtocolInstance.prototype = { AboutProtocolInstance.prototype = {

View File

@ -36,7 +36,7 @@ add_task(function* test_same_date_same_hash() {
converter.charset = "UTF-8"; converter.charset = "UTF-8";
let result = yield OS.File.read(mostRecentBackupFile); let result = yield OS.File.read(mostRecentBackupFile);
let jsonString = converter.convertFromByteArray(result, result.length); let jsonString = converter.convertFromByteArray(result, result.length);
do_log_info("Check is valid JSON"); do_print("Check is valid JSON");
JSON.parse(jsonString); JSON.parse(jsonString);
// Cleanup // Cleanup
@ -66,7 +66,7 @@ add_task(function* test_same_date_diff_hash() {
converter.charset = "UTF-8"; converter.charset = "UTF-8";
let result = yield OS.File.read(mostRecentBackupFile, { compression: "lz4" }); let result = yield OS.File.read(mostRecentBackupFile, { compression: "lz4" });
let jsonString = converter.convertFromByteArray(result, result.length); let jsonString = converter.convertFromByteArray(result, result.length);
do_log_info("Check is valid JSON"); do_print("Check is valid JSON");
JSON.parse(jsonString); JSON.parse(jsonString);
// Cleanup // Cleanup

View File

@ -30,15 +30,15 @@ add_task(function() {
PlacesUtils.bookmarks.removeItem(f1); PlacesUtils.bookmarks.removeItem(f1);
yield BookmarkJSONUtils.importFromFile((yield PlacesBackups.getMostRecentBackup()), true); yield BookmarkJSONUtils.importFromFile((yield PlacesBackups.getMostRecentBackup()), true);
do_log_info("Checking first level"); do_print("Checking first level");
let root = PlacesUtils.getFolderContents(PlacesUtils.unfiledBookmarksFolderId).root; let root = PlacesUtils.getFolderContents(PlacesUtils.unfiledBookmarksFolderId).root;
let level1 = root.getChild(0); let level1 = root.getChild(0);
do_check_eq(level1.title, "f1"); do_check_eq(level1.title, "f1");
do_log_info("Checking second level"); do_print("Checking second level");
PlacesUtils.asContainer(level1).containerOpen = true PlacesUtils.asContainer(level1).containerOpen = true
let level2 = level1.getChild(0); let level2 = level1.getChild(0);
do_check_eq(level2.title, "f2"); do_check_eq(level2.title, "f2");
do_log_info("Checking bookmark"); do_print("Checking bookmark");
PlacesUtils.asContainer(level2).containerOpen = true PlacesUtils.asContainer(level2).containerOpen = true
let bookmark = level2.getChild(0); let bookmark = level2.getChild(0);
do_check_eq(bookmark.title, "bookmark"); do_check_eq(bookmark.title, "bookmark");

View File

@ -27,7 +27,7 @@ add_task(function() {
PlacesUtils.bookmarks.removeItem(bm); PlacesUtils.bookmarks.removeItem(bm);
yield BookmarkHTMLUtils.importFromFile(file, true); yield BookmarkHTMLUtils.importFromFile(file, true);
do_log_info("Checking first level"); do_print("Checking first level");
let root = PlacesUtils.getFolderContents(PlacesUtils.unfiledBookmarksFolderId).root; let root = PlacesUtils.getFolderContents(PlacesUtils.unfiledBookmarksFolderId).root;
let node = root.getChild(0); let node = root.getChild(0);
do_check_eq(node.uri, uri.spec); do_check_eq(node.uri, uri.spec);

View File

@ -33,7 +33,7 @@ let observer = {
onItemChanged: function(aItemId, aProperty, aIsAnnotation, aNewValue, onItemChanged: function(aItemId, aProperty, aIsAnnotation, aNewValue,
aLastModified, aItemType) aLastModified, aItemType)
{ {
do_log_info("Check that we got the correct change information."); do_print("Check that we got the correct change information.");
do_check_neq(this.bookmarks.indexOf(aItemId), -1); do_check_neq(this.bookmarks.indexOf(aItemId), -1);
if (aProperty == "favicon") { if (aProperty == "favicon") {
do_check_false(aIsAnnotation); do_check_false(aIsAnnotation);
@ -57,7 +57,7 @@ let observer = {
}, },
onItemVisited: function(aItemId, aVisitId, aTime) onItemVisited: function(aItemId, aVisitId, aTime)
{ {
do_log_info("Check that we got the correct visit information."); do_print("Check that we got the correct visit information.");
do_check_neq(this.bookmarks.indexOf(aItemId), -1); do_check_neq(this.bookmarks.indexOf(aItemId), -1);
this.observedVisitId = aVisitId; this.observedVisitId = aVisitId;
do_check_eq(aTime, NOW); do_check_eq(aTime, NOW);

View File

@ -11,7 +11,7 @@ let gBookmarksObserver = {
let args = this.expected.shift().args; let args = this.expected.shift().args;
do_check_eq(aArguments.length, args.length); do_check_eq(aArguments.length, args.length);
for (let i = 0; i < aArguments.length; i++) { for (let i = 0; i < aArguments.length; i++) {
do_log_info(aMethodName + "(args[" + i + "]: " + args[i].name + ")"); do_print(aMethodName + "(args[" + i + "]: " + args[i].name + ")");
do_check_true(args[i].check(aArguments[i])); do_check_true(args[i].check(aArguments[i]));
} }

View File

@ -59,7 +59,7 @@ function run_test() {
}; };
add_task(function test_replaceFaviconData_validHistoryURI() { add_task(function test_replaceFaviconData_validHistoryURI() {
do_log_info("test replaceFaviconData for valid history uri"); do_print("test replaceFaviconData for valid history uri");
let pageURI = uri("http://test1.bar/"); let pageURI = uri("http://test1.bar/");
yield promiseAddVisits(pageURI); yield promiseAddVisits(pageURI);
@ -87,7 +87,7 @@ add_task(function test_replaceFaviconData_validHistoryURI() {
}); });
add_task(function test_replaceFaviconData_overrideDefaultFavicon() { add_task(function test_replaceFaviconData_overrideDefaultFavicon() {
do_log_info("test replaceFaviconData to override a later setAndFetchFaviconForPage"); do_print("test replaceFaviconData to override a later setAndFetchFaviconForPage");
let pageURI = uri("http://test2.bar/"); let pageURI = uri("http://test2.bar/");
yield promiseAddVisits(pageURI); yield promiseAddVisits(pageURI);
@ -119,7 +119,7 @@ add_task(function test_replaceFaviconData_overrideDefaultFavicon() {
}); });
add_task(function test_replaceFaviconData_replaceExisting() { add_task(function test_replaceFaviconData_replaceExisting() {
do_log_info("test replaceFaviconData to override a previous setAndFetchFaviconForPage"); do_print("test replaceFaviconData to override a previous setAndFetchFaviconForPage");
let pageURI = uri("http://test3.bar"); let pageURI = uri("http://test3.bar");
yield promiseAddVisits(pageURI); yield promiseAddVisits(pageURI);
@ -156,7 +156,7 @@ add_task(function test_replaceFaviconData_replaceExisting() {
}); });
add_task(function test_replaceFaviconData_unrelatedReplace() { add_task(function test_replaceFaviconData_unrelatedReplace() {
do_log_info("test replaceFaviconData to not make unrelated changes"); do_print("test replaceFaviconData to not make unrelated changes");
let pageURI = uri("http://test4.bar/"); let pageURI = uri("http://test4.bar/");
yield promiseAddVisits(pageURI); yield promiseAddVisits(pageURI);
@ -188,7 +188,7 @@ add_task(function test_replaceFaviconData_unrelatedReplace() {
}); });
add_task(function test_replaceFaviconData_badInputs() { add_task(function test_replaceFaviconData_badInputs() {
do_log_info("test replaceFaviconData to throw on bad inputs"); do_print("test replaceFaviconData to throw on bad inputs");
let favicon = createFavicon("favicon8.png"); let favicon = createFavicon("favicon8.png");
@ -228,7 +228,7 @@ add_task(function test_replaceFaviconData_badInputs() {
}); });
add_task(function test_replaceFaviconData_twiceReplace() { add_task(function test_replaceFaviconData_twiceReplace() {
do_log_info("test replaceFaviconData on multiple replacements"); do_print("test replaceFaviconData on multiple replacements");
let pageURI = uri("http://test5.bar/"); let pageURI = uri("http://test5.bar/");
yield promiseAddVisits(pageURI); yield promiseAddVisits(pageURI);

View File

@ -63,7 +63,7 @@ function run_test() {
}; };
add_task(function test_replaceFaviconDataFromDataURL_validHistoryURI() { add_task(function test_replaceFaviconDataFromDataURL_validHistoryURI() {
do_log_info("test replaceFaviconDataFromDataURL for valid history uri"); do_print("test replaceFaviconDataFromDataURL for valid history uri");
let pageURI = uri("http://test1.bar/"); let pageURI = uri("http://test1.bar/");
yield promiseAddVisits(pageURI); yield promiseAddVisits(pageURI);
@ -89,7 +89,7 @@ add_task(function test_replaceFaviconDataFromDataURL_validHistoryURI() {
}); });
add_task(function test_replaceFaviconDataFromDataURL_overrideDefaultFavicon() { add_task(function test_replaceFaviconDataFromDataURL_overrideDefaultFavicon() {
do_log_info("test replaceFaviconDataFromDataURL to override a later setAndFetchFaviconForPage"); do_print("test replaceFaviconDataFromDataURL to override a later setAndFetchFaviconForPage");
let pageURI = uri("http://test2.bar/"); let pageURI = uri("http://test2.bar/");
yield promiseAddVisits(pageURI); yield promiseAddVisits(pageURI);
@ -119,7 +119,7 @@ add_task(function test_replaceFaviconDataFromDataURL_overrideDefaultFavicon() {
}); });
add_task(function test_replaceFaviconDataFromDataURL_replaceExisting() { add_task(function test_replaceFaviconDataFromDataURL_replaceExisting() {
do_log_info("test replaceFaviconDataFromDataURL to override a previous setAndFetchFaviconForPage"); do_print("test replaceFaviconDataFromDataURL to override a previous setAndFetchFaviconForPage");
let pageURI = uri("http://test3.bar"); let pageURI = uri("http://test3.bar");
yield promiseAddVisits(pageURI); yield promiseAddVisits(pageURI);
@ -152,7 +152,7 @@ add_task(function test_replaceFaviconDataFromDataURL_replaceExisting() {
}); });
add_task(function test_replaceFaviconDataFromDataURL_unrelatedReplace() { add_task(function test_replaceFaviconDataFromDataURL_unrelatedReplace() {
do_log_info("test replaceFaviconDataFromDataURL to not make unrelated changes"); do_print("test replaceFaviconDataFromDataURL to not make unrelated changes");
let pageURI = uri("http://test4.bar/"); let pageURI = uri("http://test4.bar/");
yield promiseAddVisits(pageURI); yield promiseAddVisits(pageURI);
@ -182,7 +182,7 @@ add_task(function test_replaceFaviconDataFromDataURL_unrelatedReplace() {
}); });
add_task(function test_replaceFaviconDataFromDataURL_badInputs() { add_task(function test_replaceFaviconDataFromDataURL_badInputs() {
do_log_info("test replaceFaviconDataFromDataURL to throw on bad inputs"); do_print("test replaceFaviconDataFromDataURL to throw on bad inputs");
let favicon = createFavicon("favicon8.png"); let favicon = createFavicon("favicon8.png");
@ -210,7 +210,7 @@ add_task(function test_replaceFaviconDataFromDataURL_badInputs() {
}); });
add_task(function test_replaceFaviconDataFromDataURL_twiceReplace() { add_task(function test_replaceFaviconDataFromDataURL_twiceReplace() {
do_log_info("test replaceFaviconDataFromDataURL on multiple replacements"); do_print("test replaceFaviconDataFromDataURL on multiple replacements");
let pageURI = uri("http://test5.bar/"); let pageURI = uri("http://test5.bar/");
yield promiseAddVisits(pageURI); yield promiseAddVisits(pageURI);
@ -241,7 +241,7 @@ add_task(function test_replaceFaviconDataFromDataURL_twiceReplace() {
}); });
add_task(function test_replaceFaviconDataFromDataURL_afterRegularAssign() { add_task(function test_replaceFaviconDataFromDataURL_afterRegularAssign() {
do_log_info("test replaceFaviconDataFromDataURL after replaceFaviconData"); do_print("test replaceFaviconDataFromDataURL after replaceFaviconData");
let pageURI = uri("http://test6.bar/"); let pageURI = uri("http://test6.bar/");
yield promiseAddVisits(pageURI); yield promiseAddVisits(pageURI);
@ -274,7 +274,7 @@ add_task(function test_replaceFaviconDataFromDataURL_afterRegularAssign() {
}); });
add_task(function test_replaceFaviconDataFromDataURL_beforeRegularAssign() { add_task(function test_replaceFaviconDataFromDataURL_beforeRegularAssign() {
do_log_info("test replaceFaviconDataFromDataURL before replaceFaviconData"); do_print("test replaceFaviconDataFromDataURL before replaceFaviconData");
let pageURI = uri("http://test7.bar/"); let pageURI = uri("http://test7.bar/");
yield promiseAddVisits(pageURI); yield promiseAddVisits(pageURI);

View File

@ -760,17 +760,6 @@ function do_check_guid_for_bookmark(aId,
} }
} }
/**
* Logs info to the console in the standard way (includes the filename).
*
* @param aMessage
* The message to log to the console.
*/
function do_log_info(aMessage)
{
print("TEST-INFO | " + _TEST_FILE + " | " + aMessage);
}
/** /**
* Compares 2 arrays returning whether they contains the same elements. * Compares 2 arrays returning whether they contains the same elements.
* *

View File

@ -139,7 +139,7 @@ function ensure_results(aSearchString, aExpectedValue) {
waitForCleanup(run_next_test); waitForCleanup(run_next_test);
}; };
do_log_info("Searching for: '" + aSearchString + "'"); do_print("Searching for: '" + aSearchString + "'");
controller.startSearch(aSearchString); controller.startSearch(aSearchString);
} }
@ -153,7 +153,7 @@ function run_test() {
gAutoCompleteTests.forEach(function (testData) { gAutoCompleteTests.forEach(function (testData) {
let [description, searchString, expectedValue, setupFunc] = testData; let [description, searchString, expectedValue, setupFunc] = testData;
add_test(function () { add_test(function () {
do_log_info(description); do_print(description);
Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", true); Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", true);
Services.prefs.setBoolPref("browser.urlbar.autoFill", true); Services.prefs.setBoolPref("browser.urlbar.autoFill", true);
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false); Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);

View File

@ -92,8 +92,8 @@ function continue_test() {
try { try {
while(stmt.executeStep()) { while(stmt.executeStep()) {
let comparator = EXPECTED.shift(); let comparator = EXPECTED.shift();
do_log_info("Checking that '" + comparator.url + do_print("Checking that '" + comparator.url +
"' was entered into the DB correctly"); "' was entered into the DB correctly");
do_check_eq(stmt.row.id, comparator.id); do_check_eq(stmt.row.id, comparator.id);
do_check_eq(stmt.row.url, comparator.url); do_check_eq(stmt.row.url, comparator.url);
do_check_eq(stmt.row.from_visit, comparator.from_visit); do_check_eq(stmt.row.from_visit, comparator.from_visit);
@ -155,7 +155,7 @@ ChannelListener.prototype = {
}, },
onStartRequest: function(request, context) { onStartRequest: function(request, context) {
do_log_info("onStartRequest"); do_print("onStartRequest");
this._got_onstartrequest = true; this._got_onstartrequest = true;
}, },
@ -164,7 +164,7 @@ ChannelListener.prototype = {
}, },
onStopRequest: function(request, context, status) { onStopRequest: function(request, context, status) {
do_log_info("onStopRequest"); do_print("onStopRequest");
this._got_onstoprequest++; this._got_onstoprequest++;
let success = Components.isSuccessCode(status); let success = Components.isSuccessCode(status);
do_check_true(success); do_check_true(success);
@ -177,7 +177,7 @@ ChannelListener.prototype = {
// nsIChannelEventSink // nsIChannelEventSink
asyncOnChannelRedirect: function (aOldChannel, aNewChannel, aFlags, callback) { asyncOnChannelRedirect: function (aOldChannel, aNewChannel, aFlags, callback) {
do_log_info("onChannelRedirect"); do_print("onChannelRedirect");
this._got_onchannelredirect = true; this._got_onchannelredirect = true;
callback.onRedirectVerifyCallback(Components.results.NS_OK); callback.onRedirectVerifyCallback(Components.results.NS_OK);
}, },

View File

@ -13,29 +13,29 @@
function tags_getter_setter() function tags_getter_setter()
{ {
do_log_info("Tags getter/setter should work correctly"); do_print("Tags getter/setter should work correctly");
do_log_info("Without setting tags, tags getter should return empty array"); do_print("Without setting tags, tags getter should return empty array");
var [query, dummy] = makeQuery(); var [query, dummy] = makeQuery();
do_check_eq(query.tags.length, 0); do_check_eq(query.tags.length, 0);
do_log_info("Setting tags to an empty array, tags getter should return "+ do_print("Setting tags to an empty array, tags getter should return "+
"empty array"); "empty array");
[query, dummy] = makeQuery([]); [query, dummy] = makeQuery([]);
do_check_eq(query.tags.length, 0); do_check_eq(query.tags.length, 0);
do_log_info("Setting a few tags, tags getter should return correct array"); do_print("Setting a few tags, tags getter should return correct array");
var tags = ["bar", "baz", "foo"]; var tags = ["bar", "baz", "foo"];
[query, dummy] = makeQuery(tags); [query, dummy] = makeQuery(tags);
setsAreEqual(query.tags, tags, true); setsAreEqual(query.tags, tags, true);
do_log_info("Setting some dupe tags, tags getter return unique tags"); do_print("Setting some dupe tags, tags getter return unique tags");
[query, dummy] = makeQuery(["foo", "foo", "bar", "foo", "baz", "bar"]); [query, dummy] = makeQuery(["foo", "foo", "bar", "foo", "baz", "bar"]);
setsAreEqual(query.tags, ["bar", "baz", "foo"], true); setsAreEqual(query.tags, ["bar", "baz", "foo"], true);
}, },
function invalid_setter_calls() function invalid_setter_calls()
{ {
do_log_info("Invalid calls to tags setter should fail"); do_print("Invalid calls to tags setter should fail");
try { try {
var query = PlacesUtils.history.getNewQuery(); var query = PlacesUtils.history.getNewQuery();
query.tags = null; query.tags = null;
@ -105,19 +105,19 @@
function not_setting_tags() function not_setting_tags()
{ {
do_log_info("Not setting tags at all should not affect query URI"); do_print("Not setting tags at all should not affect query URI");
checkQueryURI(); checkQueryURI();
}, },
function empty_array_tags() function empty_array_tags()
{ {
do_log_info("Setting tags with an empty array should not affect query URI"); do_print("Setting tags with an empty array should not affect query URI");
checkQueryURI([]); checkQueryURI([]);
}, },
function set_tags() function set_tags()
{ {
do_log_info("Setting some tags should result in correct query URI"); do_print("Setting some tags should result in correct query URI");
checkQueryURI([ checkQueryURI([
"foo", "foo",
"七難", "七難",
@ -133,22 +133,22 @@
function no_tags_tagsAreNot() function no_tags_tagsAreNot()
{ {
do_log_info("Not setting tags at all but setting tagsAreNot should " + do_print("Not setting tags at all but setting tagsAreNot should " +
"affect query URI"); "affect query URI");
checkQueryURI(null, true); checkQueryURI(null, true);
}, },
function empty_array_tags_tagsAreNot() function empty_array_tags_tagsAreNot()
{ {
do_log_info("Setting tags with an empty array and setting tagsAreNot " + do_print("Setting tags with an empty array and setting tagsAreNot " +
"should affect query URI"); "should affect query URI");
checkQueryURI([], true); checkQueryURI([], true);
}, },
function () function ()
{ {
do_log_info("Setting some tags and setting tagsAreNot should result in " + do_print("Setting some tags and setting tagsAreNot should result in " +
"correct query URI"); "correct query URI");
checkQueryURI([ checkQueryURI([
"foo", "foo",
"七難", "七難",
@ -164,8 +164,8 @@
function tag_to_uri() function tag_to_uri()
{ {
do_log_info("Querying history on tag associated with a URI should return " + do_print("Querying history on tag associated with a URI should return " +
"that URI"); "that URI");
yield task_doWithVisit(["foo", "bar", "baz"], function (aURI) { yield task_doWithVisit(["foo", "bar", "baz"], function (aURI) {
var [query, opts] = makeQuery(["foo"]); var [query, opts] = makeQuery(["foo"]);
executeAndCheckQueryResults(query, opts, [aURI.spec]); executeAndCheckQueryResults(query, opts, [aURI.spec]);
@ -178,8 +178,8 @@
function tags_to_uri() function tags_to_uri()
{ {
do_log_info("Querying history on many tags associated with a URI should " + do_print("Querying history on many tags associated with a URI should " +
"return that URI"); "return that URI");
yield task_doWithVisit(["foo", "bar", "baz"], function (aURI) { yield task_doWithVisit(["foo", "bar", "baz"], function (aURI) {
var [query, opts] = makeQuery(["foo", "bar"]); var [query, opts] = makeQuery(["foo", "bar"]);
executeAndCheckQueryResults(query, opts, [aURI.spec]); executeAndCheckQueryResults(query, opts, [aURI.spec]);
@ -194,8 +194,8 @@
function repeated_tag() function repeated_tag()
{ {
do_log_info("Specifying the same tag multiple times in a history query " + do_print("Specifying the same tag multiple times in a history query " +
"should not matter"); "should not matter");
yield task_doWithVisit(["foo", "bar", "baz"], function (aURI) { yield task_doWithVisit(["foo", "bar", "baz"], function (aURI) {
var [query, opts] = makeQuery(["foo", "foo"]); var [query, opts] = makeQuery(["foo", "foo"]);
executeAndCheckQueryResults(query, opts, [aURI.spec]); executeAndCheckQueryResults(query, opts, [aURI.spec]);
@ -206,8 +206,8 @@
function many_tags_no_uri() function many_tags_no_uri()
{ {
do_log_info("Querying history on many tags associated with a URI and " + do_print("Querying history on many tags associated with a URI and " +
"tags not associated with that URI should not return that URI"); "tags not associated with that URI should not return that URI");
yield task_doWithVisit(["foo", "bar", "baz"], function (aURI) { yield task_doWithVisit(["foo", "bar", "baz"], function (aURI) {
var [query, opts] = makeQuery(["foo", "bogus"]); var [query, opts] = makeQuery(["foo", "bogus"]);
executeAndCheckQueryResults(query, opts, []); executeAndCheckQueryResults(query, opts, []);
@ -220,7 +220,7 @@
function nonexistent_tags() function nonexistent_tags()
{ {
do_log_info("Querying history on nonexistent tags should return no results"); do_print("Querying history on nonexistent tags should return no results");
yield task_doWithVisit(["foo", "bar", "baz"], function (aURI) { yield task_doWithVisit(["foo", "bar", "baz"], function (aURI) {
var [query, opts] = makeQuery(["bogus"]); var [query, opts] = makeQuery(["bogus"]);
executeAndCheckQueryResults(query, opts, []); executeAndCheckQueryResults(query, opts, []);
@ -231,8 +231,8 @@
function tag_to_bookmark() function tag_to_bookmark()
{ {
do_log_info("Querying bookmarks on tag associated with a URI should " + do_print("Querying bookmarks on tag associated with a URI should " +
"return that URI"); "return that URI");
yield task_doWithBookmark(["foo", "bar", "baz"], function (aURI) { yield task_doWithBookmark(["foo", "bar", "baz"], function (aURI) {
var [query, opts] = makeQuery(["foo"]); var [query, opts] = makeQuery(["foo"]);
opts.queryType = opts.QUERY_TYPE_BOOKMARKS; opts.queryType = opts.QUERY_TYPE_BOOKMARKS;
@ -248,8 +248,8 @@
function many_tags_to_bookmark() function many_tags_to_bookmark()
{ {
do_log_info("Querying bookmarks on many tags associated with a URI " + do_print("Querying bookmarks on many tags associated with a URI " +
"should return that URI"); "should return that URI");
yield task_doWithBookmark(["foo", "bar", "baz"], function (aURI) { yield task_doWithBookmark(["foo", "bar", "baz"], function (aURI) {
var [query, opts] = makeQuery(["foo", "bar"]); var [query, opts] = makeQuery(["foo", "bar"]);
opts.queryType = opts.QUERY_TYPE_BOOKMARKS; opts.queryType = opts.QUERY_TYPE_BOOKMARKS;
@ -268,8 +268,8 @@
function repeated_tag_to_bookmarks() function repeated_tag_to_bookmarks()
{ {
do_log_info("Specifying the same tag multiple times in a bookmark query " + do_print("Specifying the same tag multiple times in a bookmark query " +
"should not matter"); "should not matter");
yield task_doWithBookmark(["foo", "bar", "baz"], function (aURI) { yield task_doWithBookmark(["foo", "bar", "baz"], function (aURI) {
var [query, opts] = makeQuery(["foo", "foo"]); var [query, opts] = makeQuery(["foo", "foo"]);
opts.queryType = opts.QUERY_TYPE_BOOKMARKS; opts.queryType = opts.QUERY_TYPE_BOOKMARKS;
@ -282,8 +282,8 @@
function many_tags_no_bookmark() function many_tags_no_bookmark()
{ {
do_log_info("Querying bookmarks on many tags associated with a URI and " + do_print("Querying bookmarks on many tags associated with a URI and " +
"tags not associated with that URI should not return that URI"); "tags not associated with that URI should not return that URI");
yield task_doWithBookmark(["foo", "bar", "baz"], function (aURI) { yield task_doWithBookmark(["foo", "bar", "baz"], function (aURI) {
var [query, opts] = makeQuery(["foo", "bogus"]); var [query, opts] = makeQuery(["foo", "bogus"]);
opts.queryType = opts.QUERY_TYPE_BOOKMARKS; opts.queryType = opts.QUERY_TYPE_BOOKMARKS;
@ -299,7 +299,7 @@
function nonexistent_tags_bookmark() function nonexistent_tags_bookmark()
{ {
do_log_info("Querying bookmarks on nonexistent tag should return no results"); do_print("Querying bookmarks on nonexistent tag should return no results");
yield task_doWithBookmark(["foo", "bar", "baz"], function (aURI) { yield task_doWithBookmark(["foo", "bar", "baz"], function (aURI) {
var [query, opts] = makeQuery(["bogus"]); var [query, opts] = makeQuery(["bogus"]);
opts.queryType = opts.QUERY_TYPE_BOOKMARKS; opts.queryType = opts.QUERY_TYPE_BOOKMARKS;
@ -312,14 +312,14 @@
function tagsAreNot_history() function tagsAreNot_history()
{ {
do_log_info("Querying history using tagsAreNot should work correctly"); do_print("Querying history using tagsAreNot should work correctly");
var urisAndTags = { var urisAndTags = {
"http://example.com/1": ["foo", "bar"], "http://example.com/1": ["foo", "bar"],
"http://example.com/2": ["baz", "qux"], "http://example.com/2": ["baz", "qux"],
"http://example.com/3": null "http://example.com/3": null
}; };
do_log_info("Add visits and tag the URIs"); do_print("Add visits and tag the URIs");
for (let [pURI, tags] in Iterator(urisAndTags)) { for (let [pURI, tags] in Iterator(urisAndTags)) {
let nsiuri = uri(pURI); let nsiuri = uri(pURI);
yield promiseAddVisits(nsiuri); yield promiseAddVisits(nsiuri);
@ -327,27 +327,27 @@
PlacesUtils.tagging.tagURI(nsiuri, tags); PlacesUtils.tagging.tagURI(nsiuri, tags);
} }
do_log_info(' Querying for "foo" should match only /2 and /3'); do_print(' Querying for "foo" should match only /2 and /3');
var [query, opts] = makeQuery(["foo"], true); var [query, opts] = makeQuery(["foo"], true);
queryResultsAre(PlacesUtils.history.executeQuery(query, opts).root, queryResultsAre(PlacesUtils.history.executeQuery(query, opts).root,
["http://example.com/2", "http://example.com/3"]); ["http://example.com/2", "http://example.com/3"]);
do_log_info(' Querying for "foo" and "bar" should match only /2 and /3'); do_print(' Querying for "foo" and "bar" should match only /2 and /3');
[query, opts] = makeQuery(["foo", "bar"], true); [query, opts] = makeQuery(["foo", "bar"], true);
queryResultsAre(PlacesUtils.history.executeQuery(query, opts).root, queryResultsAre(PlacesUtils.history.executeQuery(query, opts).root,
["http://example.com/2", "http://example.com/3"]); ["http://example.com/2", "http://example.com/3"]);
do_log_info(' Querying for "foo" and "bogus" should match only /2 and /3'); do_print(' Querying for "foo" and "bogus" should match only /2 and /3');
[query, opts] = makeQuery(["foo", "bogus"], true); [query, opts] = makeQuery(["foo", "bogus"], true);
queryResultsAre(PlacesUtils.history.executeQuery(query, opts).root, queryResultsAre(PlacesUtils.history.executeQuery(query, opts).root,
["http://example.com/2", "http://example.com/3"]); ["http://example.com/2", "http://example.com/3"]);
do_log_info(' Querying for "foo" and "baz" should match only /3'); do_print(' Querying for "foo" and "baz" should match only /3');
[query, opts] = makeQuery(["foo", "baz"], true); [query, opts] = makeQuery(["foo", "baz"], true);
queryResultsAre(PlacesUtils.history.executeQuery(query, opts).root, queryResultsAre(PlacesUtils.history.executeQuery(query, opts).root,
["http://example.com/3"]); ["http://example.com/3"]);
do_log_info(' Querying for "bogus" should match all'); do_print(' Querying for "bogus" should match all');
[query, opts] = makeQuery(["bogus"], true); [query, opts] = makeQuery(["bogus"], true);
queryResultsAre(PlacesUtils.history.executeQuery(query, opts).root, queryResultsAre(PlacesUtils.history.executeQuery(query, opts).root,
["http://example.com/1", ["http://example.com/1",
@ -365,14 +365,14 @@
function tagsAreNot_bookmarks() function tagsAreNot_bookmarks()
{ {
do_log_info("Querying bookmarks using tagsAreNot should work correctly"); do_print("Querying bookmarks using tagsAreNot should work correctly");
var urisAndTags = { var urisAndTags = {
"http://example.com/1": ["foo", "bar"], "http://example.com/1": ["foo", "bar"],
"http://example.com/2": ["baz", "qux"], "http://example.com/2": ["baz", "qux"],
"http://example.com/3": null "http://example.com/3": null
}; };
do_log_info("Add bookmarks and tag the URIs"); do_print("Add bookmarks and tag the URIs");
for (let [pURI, tags] in Iterator(urisAndTags)) { for (let [pURI, tags] in Iterator(urisAndTags)) {
let nsiuri = uri(pURI); let nsiuri = uri(pURI);
addBookmark(nsiuri); addBookmark(nsiuri);
@ -380,31 +380,31 @@
PlacesUtils.tagging.tagURI(nsiuri, tags); PlacesUtils.tagging.tagURI(nsiuri, tags);
} }
do_log_info(' Querying for "foo" should match only /2 and /3'); do_print(' Querying for "foo" should match only /2 and /3');
var [query, opts] = makeQuery(["foo"], true); var [query, opts] = makeQuery(["foo"], true);
opts.queryType = opts.QUERY_TYPE_BOOKMARKS; opts.queryType = opts.QUERY_TYPE_BOOKMARKS;
queryResultsAre(PlacesUtils.history.executeQuery(query, opts).root, queryResultsAre(PlacesUtils.history.executeQuery(query, opts).root,
["http://example.com/2", "http://example.com/3"]); ["http://example.com/2", "http://example.com/3"]);
do_log_info(' Querying for "foo" and "bar" should match only /2 and /3'); do_print(' Querying for "foo" and "bar" should match only /2 and /3');
[query, opts] = makeQuery(["foo", "bar"], true); [query, opts] = makeQuery(["foo", "bar"], true);
opts.queryType = opts.QUERY_TYPE_BOOKMARKS; opts.queryType = opts.QUERY_TYPE_BOOKMARKS;
queryResultsAre(PlacesUtils.history.executeQuery(query, opts).root, queryResultsAre(PlacesUtils.history.executeQuery(query, opts).root,
["http://example.com/2", "http://example.com/3"]); ["http://example.com/2", "http://example.com/3"]);
do_log_info(' Querying for "foo" and "bogus" should match only /2 and /3'); do_print(' Querying for "foo" and "bogus" should match only /2 and /3');
[query, opts] = makeQuery(["foo", "bogus"], true); [query, opts] = makeQuery(["foo", "bogus"], true);
opts.queryType = opts.QUERY_TYPE_BOOKMARKS; opts.queryType = opts.QUERY_TYPE_BOOKMARKS;
queryResultsAre(PlacesUtils.history.executeQuery(query, opts).root, queryResultsAre(PlacesUtils.history.executeQuery(query, opts).root,
["http://example.com/2", "http://example.com/3"]); ["http://example.com/2", "http://example.com/3"]);
do_log_info(' Querying for "foo" and "baz" should match only /3'); do_print(' Querying for "foo" and "baz" should match only /3');
[query, opts] = makeQuery(["foo", "baz"], true); [query, opts] = makeQuery(["foo", "baz"], true);
opts.queryType = opts.QUERY_TYPE_BOOKMARKS; opts.queryType = opts.QUERY_TYPE_BOOKMARKS;
queryResultsAre(PlacesUtils.history.executeQuery(query, opts).root, queryResultsAre(PlacesUtils.history.executeQuery(query, opts).root,
["http://example.com/3"]); ["http://example.com/3"]);
do_log_info(' Querying for "bogus" should match all'); do_print(' Querying for "bogus" should match all');
[query, opts] = makeQuery(["bogus"], true); [query, opts] = makeQuery(["bogus"], true);
opts.queryType = opts.QUERY_TYPE_BOOKMARKS; opts.queryType = opts.QUERY_TYPE_BOOKMARKS;
queryResultsAre(PlacesUtils.history.executeQuery(query, opts).root, queryResultsAre(PlacesUtils.history.executeQuery(query, opts).root,
@ -422,16 +422,16 @@
}, },
function duplicate_tags() { function duplicate_tags() {
do_log_info("Duplicate existing tags (i.e., multiple tag folders with " + do_print("Duplicate existing tags (i.e., multiple tag folders with " +
"same name) should not throw off query results"); "same name) should not throw off query results");
var tagName = "foo"; var tagName = "foo";
do_log_info("Add bookmark and tag it normally"); do_print("Add bookmark and tag it normally");
addBookmark(TEST_URI); addBookmark(TEST_URI);
PlacesUtils.tagging.tagURI(TEST_URI, [tagName]); PlacesUtils.tagging.tagURI(TEST_URI, [tagName]);
do_log_info("Manually create tag folder with same name as tag and insert " + do_print("Manually create tag folder with same name as tag and insert " +
"bookmark"); "bookmark");
var dupTagId = PlacesUtils.bookmarks.createFolder(PlacesUtils.tagsFolderId, var dupTagId = PlacesUtils.bookmarks.createFolder(PlacesUtils.tagsFolderId,
tagName, tagName,
Ci.nsINavBookmarksService.DEFAULT_INDEX); Ci.nsINavBookmarksService.DEFAULT_INDEX);
@ -442,7 +442,7 @@
"title"); "title");
do_check_true(bmId > 0); do_check_true(bmId > 0);
do_log_info("Querying for tag should match URI"); do_print("Querying for tag should match URI");
var [query, opts] = makeQuery([tagName]); var [query, opts] = makeQuery([tagName]);
opts.queryType = opts.QUERY_TYPE_BOOKMARKS; opts.queryType = opts.QUERY_TYPE_BOOKMARKS;
queryResultsAre(PlacesUtils.history.executeQuery(query, opts).root, [TEST_URI.spec]); queryResultsAre(PlacesUtils.history.executeQuery(query, opts).root, [TEST_URI.spec]);
@ -453,21 +453,21 @@
function folder_named_as_tag() function folder_named_as_tag()
{ {
do_log_info("Regular folders with the same name as tag should not throw " + do_print("Regular folders with the same name as tag should not throw " +
"off query results"); "off query results");
var tagName = "foo"; var tagName = "foo";
do_log_info("Add bookmark and tag it"); do_print("Add bookmark and tag it");
addBookmark(TEST_URI); addBookmark(TEST_URI);
PlacesUtils.tagging.tagURI(TEST_URI, [tagName]); PlacesUtils.tagging.tagURI(TEST_URI, [tagName]);
do_log_info("Create folder with same name as tag"); do_print("Create folder with same name as tag");
var folderId = PlacesUtils.bookmarks.createFolder(PlacesUtils.unfiledBookmarksFolderId, var folderId = PlacesUtils.bookmarks.createFolder(PlacesUtils.unfiledBookmarksFolderId,
tagName, tagName,
Ci.nsINavBookmarksService.DEFAULT_INDEX); Ci.nsINavBookmarksService.DEFAULT_INDEX);
do_check_true(folderId > 0); do_check_true(folderId > 0);
do_log_info("Querying for tag should match URI"); do_print("Querying for tag should match URI");
var [query, opts] = makeQuery([tagName]); var [query, opts] = makeQuery([tagName]);
opts.queryType = opts.QUERY_TYPE_BOOKMARKS; opts.queryType = opts.QUERY_TYPE_BOOKMARKS;
queryResultsAre(PlacesUtils.history.executeQuery(query, opts).root, [TEST_URI.spec]); queryResultsAre(PlacesUtils.history.executeQuery(query, opts).root, [TEST_URI.spec]);
@ -477,7 +477,7 @@
}, },
function ORed_queries() { function ORed_queries() {
do_log_info("Multiple queries ORed together should work"); do_print("Multiple queries ORed together should work");
var urisAndTags = { var urisAndTags = {
"http://example.com/1": [], "http://example.com/1": [],
"http://example.com/2": [] "http://example.com/2": []
@ -490,7 +490,7 @@
urisAndTags["http://example.com/2"].push("/2 tag " + i); urisAndTags["http://example.com/2"].push("/2 tag " + i);
} }
do_log_info("Add visits and tag the URIs"); do_print("Add visits and tag the URIs");
for (let [pURI, tags] in Iterator(urisAndTags)) { for (let [pURI, tags] in Iterator(urisAndTags)) {
let nsiuri = uri(pURI); let nsiuri = uri(pURI);
yield promiseAddVisits(nsiuri); yield promiseAddVisits(nsiuri);
@ -498,40 +498,40 @@
PlacesUtils.tagging.tagURI(nsiuri, tags); PlacesUtils.tagging.tagURI(nsiuri, tags);
} }
do_log_info("Query for /1 OR query for /2 should match both /1 and /2"); do_print("Query for /1 OR query for /2 should match both /1 and /2");
var [query1, opts] = makeQuery(urisAndTags["http://example.com/1"]); var [query1, opts] = makeQuery(urisAndTags["http://example.com/1"]);
var [query2, dummy] = makeQuery(urisAndTags["http://example.com/2"]); var [query2, dummy] = makeQuery(urisAndTags["http://example.com/2"]);
var root = PlacesUtils.history.executeQueries([query1, query2], 2, opts).root; var root = PlacesUtils.history.executeQueries([query1, query2], 2, opts).root;
queryResultsAre(root, ["http://example.com/1", "http://example.com/2"]); queryResultsAre(root, ["http://example.com/1", "http://example.com/2"]);
do_log_info("Query for /1 OR query on bogus tag should match only /1"); do_print("Query for /1 OR query on bogus tag should match only /1");
[query1, opts] = makeQuery(urisAndTags["http://example.com/1"]); [query1, opts] = makeQuery(urisAndTags["http://example.com/1"]);
[query2, dummy] = makeQuery(["bogus"]); [query2, dummy] = makeQuery(["bogus"]);
root = PlacesUtils.history.executeQueries([query1, query2], 2, opts).root; root = PlacesUtils.history.executeQueries([query1, query2], 2, opts).root;
queryResultsAre(root, ["http://example.com/1"]); queryResultsAre(root, ["http://example.com/1"]);
do_log_info("Query for /1 OR query for /1 should match only /1"); do_print("Query for /1 OR query for /1 should match only /1");
[query1, opts] = makeQuery(urisAndTags["http://example.com/1"]); [query1, opts] = makeQuery(urisAndTags["http://example.com/1"]);
[query2, dummy] = makeQuery(urisAndTags["http://example.com/1"]); [query2, dummy] = makeQuery(urisAndTags["http://example.com/1"]);
root = PlacesUtils.history.executeQueries([query1, query2], 2, opts).root; root = PlacesUtils.history.executeQueries([query1, query2], 2, opts).root;
queryResultsAre(root, ["http://example.com/1"]); queryResultsAre(root, ["http://example.com/1"]);
do_log_info("Query for /1 with tagsAreNot OR query for /2 with tagsAreNot " + do_print("Query for /1 with tagsAreNot OR query for /2 with tagsAreNot " +
"should match both /1 and /2"); "should match both /1 and /2");
[query1, opts] = makeQuery(urisAndTags["http://example.com/1"], true); [query1, opts] = makeQuery(urisAndTags["http://example.com/1"], true);
[query2, dummy] = makeQuery(urisAndTags["http://example.com/2"], true); [query2, dummy] = makeQuery(urisAndTags["http://example.com/2"], true);
root = PlacesUtils.history.executeQueries([query1, query2], 2, opts).root; root = PlacesUtils.history.executeQueries([query1, query2], 2, opts).root;
queryResultsAre(root, ["http://example.com/1", "http://example.com/2"]); queryResultsAre(root, ["http://example.com/1", "http://example.com/2"]);
do_log_info("Query for /1 OR query for /2 with tagsAreNot should match " + do_print("Query for /1 OR query for /2 with tagsAreNot should match " +
"only /1"); "only /1");
[query1, opts] = makeQuery(urisAndTags["http://example.com/1"]); [query1, opts] = makeQuery(urisAndTags["http://example.com/1"]);
[query2, dummy] = makeQuery(urisAndTags["http://example.com/2"], true); [query2, dummy] = makeQuery(urisAndTags["http://example.com/2"], true);
root = PlacesUtils.history.executeQueries([query1, query2], 2, opts).root; root = PlacesUtils.history.executeQueries([query1, query2], 2, opts).root;
queryResultsAre(root, ["http://example.com/1"]); queryResultsAre(root, ["http://example.com/1"]);
do_log_info("Query for /1 OR query for /1 with tagsAreNot should match " + do_print("Query for /1 OR query for /1 with tagsAreNot should match " +
"both URIs"); "both URIs");
[query1, opts] = makeQuery(urisAndTags["http://example.com/1"]); [query1, opts] = makeQuery(urisAndTags["http://example.com/1"]);
[query2, dummy] = makeQuery(urisAndTags["http://example.com/1"], true); [query2, dummy] = makeQuery(urisAndTags["http://example.com/1"], true);
root = PlacesUtils.history.executeQueries([query1, query2], 2, opts).root; root = PlacesUtils.history.executeQueries([query1, query2], 2, opts).root;
@ -568,7 +568,7 @@ function addBookmark(aURI) {
aURI, aURI,
Ci.nsINavBookmarksService.DEFAULT_INDEX, Ci.nsINavBookmarksService.DEFAULT_INDEX,
aURI.spec); aURI.spec);
do_log_info("Sanity check: insertBookmark should not fail"); do_print("Sanity check: insertBookmark should not fail");
do_check_true(bmId > 0); do_check_true(bmId > 0);
} }
@ -596,7 +596,7 @@ function checkQueryURI(aTags, aTagsAreNot) {
var expURI = "place:" + pairs.join("&"); var expURI = "place:" + pairs.join("&");
var [query, opts] = makeQuery(aTags, aTagsAreNot); var [query, opts] = makeQuery(aTags, aTagsAreNot);
var actualURI = queryURI(query, opts); var actualURI = queryURI(query, opts);
do_log_info("Query URI should be what we expect for the given tags"); do_print("Query URI should be what we expect for the given tags");
do_check_eq(actualURI, expURI); do_check_eq(actualURI, expURI);
} }
@ -683,7 +683,7 @@ function executeAndCheckQueryResults(aQuery, aQueryOpts, aExpectedURIs) {
*/ */
function makeQuery(aTags, aTagsAreNot) { function makeQuery(aTags, aTagsAreNot) {
aTagsAreNot = !!aTagsAreNot; aTagsAreNot = !!aTagsAreNot;
do_log_info("Making a query " + do_print("Making a query " +
(aTags ? (aTags ?
"with tags " + aTags.toSource() : "with tags " + aTags.toSource() :
"without calling setTags() at all") + "without calling setTags() at all") +
@ -701,7 +701,7 @@ function makeQuery(aTags, aTagsAreNot) {
uniqueTags.sort(); uniqueTags.sort();
} }
do_log_info("Made query should be correct for tags and tagsAreNot"); do_print("Made query should be correct for tags and tagsAreNot");
if (uniqueTags) if (uniqueTags)
setsAreEqual(query.tags, uniqueTags, true); setsAreEqual(query.tags, uniqueTags, true);
var expCount = uniqueTags ? uniqueTags.length : 0; var expCount = uniqueTags ? uniqueTags.length : 0;

View File

@ -122,12 +122,12 @@ function* check_autocomplete(test) {
let numSearchesStarted = 0; let numSearchesStarted = 0;
input.onSearchBegin = () => { input.onSearchBegin = () => {
do_log_info("onSearchBegin received"); do_print("onSearchBegin received");
numSearchesStarted++; numSearchesStarted++;
}; };
let deferred = Promise.defer(); let deferred = Promise.defer();
input.onSearchComplete = () => { input.onSearchComplete = () => {
do_log_info("onSearchComplete received"); do_print("onSearchComplete received");
deferred.resolve(); deferred.resolve();
} }
@ -136,7 +136,7 @@ function* check_autocomplete(test) {
controller.startSearch(test.incompleteSearch); controller.startSearch(test.incompleteSearch);
expectedSearches++; expectedSearches++;
} }
do_log_info("Searching for: '" + test.search + "'"); do_print("Searching for: '" + test.search + "'");
controller.startSearch(test.search); controller.startSearch(test.search);
yield deferred.promise; yield deferred.promise;
@ -150,7 +150,7 @@ function* check_autocomplete(test) {
for (let i = 0; i < controller.matchCount; i++) { for (let i = 0; i < controller.matchCount; i++) {
let value = controller.getValueAt(i); let value = controller.getValueAt(i);
let comment = controller.getCommentAt(i); let comment = controller.getCommentAt(i);
do_log_info("Looking for '" + value + "', '" + comment + "' in expected results..."); do_print("Looking for '" + value + "', '" + comment + "' in expected results...");
let j; let j;
for (j = 0; j < matches.length; j++) { for (j = 0; j < matches.length; j++) {
// Skip processed expected results // Skip processed expected results
@ -167,10 +167,10 @@ function* check_autocomplete(test) {
else else
style = ["favicon"]; style = ["favicon"];
do_log_info("Checking against expected '" + uri.spec + "', '" + title + "'..."); do_print("Checking against expected '" + uri.spec + "', '" + title + "'...");
// Got a match on both uri and title? // Got a match on both uri and title?
if (stripPrefix(uri.spec) == stripPrefix(value) && title == comment) { if (stripPrefix(uri.spec) == stripPrefix(value) && title == comment) {
do_log_info("Got a match at index " + j + "!"); do_print("Got a match at index " + j + "!");
let actualStyle = controller.getStyleAt(i).split(/\s+/).sort(); let actualStyle = controller.getStyleAt(i).split(/\s+/).sort();
if (style) if (style)
Assert.equal(actualStyle.toString(), style.toString(), "Match should have expected style"); Assert.equal(actualStyle.toString(), style.toString(), "Match should have expected style");
@ -254,7 +254,7 @@ function changeRestrict(aType, aChar) {
else else
branch += "restrict."; branch += "restrict.";
do_log_info("changing restrict for " + aType + " to '" + aChar + "'"); do_print("changing restrict for " + aType + " to '" + aChar + "'");
Services.prefs.setCharPref(branch + aType, aChar); Services.prefs.setCharPref(branch + aType, aChar);
} }

View File

@ -8,7 +8,7 @@
*/ */
add_task(function* test_tag_match_has_bookmark_title() { add_task(function* test_tag_match_has_bookmark_title() {
do_log_info("Make sure the tag match gives the bookmark title"); do_print("Make sure the tag match gives the bookmark title");
let uri = NetUtil.newURI("http://theuri/"); let uri = NetUtil.newURI("http://theuri/");
yield promiseAddVisits({ uri: uri, title: "Page title" }); yield promiseAddVisits({ uri: uri, title: "Page title" });
addBookmark({ uri: uri, addBookmark({ uri: uri,

View File

@ -15,7 +15,7 @@
*/ */
add_task(function* test_tag_match_url() { add_task(function* test_tag_match_url() {
do_log_info("Make sure tag matches return the right url as well as '+' remain escaped"); do_print("Make sure tag matches return the right url as well as '+' remain escaped");
let uri1 = NetUtil.newURI("http://escaped/ユニコード"); let uri1 = NetUtil.newURI("http://escaped/ユニコード");
let uri2 = NetUtil.newURI("http://asciiescaped/blocking-firefox3%2B"); let uri2 = NetUtil.newURI("http://asciiescaped/blocking-firefox3%2B");
yield promiseAddVisits([ { uri: uri1, title: "title" }, yield promiseAddVisits([ { uri: uri1, title: "title" },

View File

@ -16,32 +16,32 @@ add_task(function* test_javascript_match() {
addBookmark({ uri: uri2, addBookmark({ uri: uri2,
title: "Title with javascript:" }); title: "Title with javascript:" });
do_log_info("Match non-javascript: with plain search"); do_print("Match non-javascript: with plain search");
yield check_autocomplete({ yield check_autocomplete({
search: "a", search: "a",
matches: [ { uri: uri1, title: "Title with javascript:" } ] matches: [ { uri: uri1, title: "Title with javascript:" } ]
}); });
do_log_info("Match non-javascript: with almost javascript:"); do_print("Match non-javascript: with almost javascript:");
yield check_autocomplete({ yield check_autocomplete({
search: "javascript", search: "javascript",
matches: [ { uri: uri1, title: "Title with javascript:" } ] matches: [ { uri: uri1, title: "Title with javascript:" } ]
}); });
do_log_info("Match javascript:"); do_print("Match javascript:");
yield check_autocomplete({ yield check_autocomplete({
search: "javascript:", search: "javascript:",
matches: [ { uri: uri1, title: "Title with javascript:" }, matches: [ { uri: uri1, title: "Title with javascript:" },
{ uri: uri2, title: "Title with javascript:", style: [ "bookmark" ]} ] { uri: uri2, title: "Title with javascript:", style: [ "bookmark" ]} ]
}); });
do_log_info("Match nothing with non-first javascript:"); do_print("Match nothing with non-first javascript:");
yield check_autocomplete({ yield check_autocomplete({
search: "5 javascript:", search: "5 javascript:",
matches: [ ] matches: [ ]
}); });
do_log_info("Match javascript: with multi-word search"); do_print("Match javascript: with multi-word search");
yield check_autocomplete({ yield check_autocomplete({
search: "javascript: 5", search: "javascript: 5",
matches: [ { uri: uri2, title: "Title with javascript:", style: [ "bookmark" ]} ] matches: [ { uri: uri2, title: "Title with javascript:", style: [ "bookmark" ]} ]

View File

@ -30,31 +30,31 @@ add_task(function* test_javascript_match() {
title: "tagged", title: "tagged",
tags: [ "tag1", "tag2", "tag3" ] }); tags: [ "tag1", "tag2", "tag3" ] });
do_log_info("Make sure tags come back in the title when matching tags"); do_print("Make sure tags come back in the title when matching tags");
yield check_autocomplete({ yield check_autocomplete({
search: "page1 tag", search: "page1 tag",
matches: [ { uri: uri1, title: "tagged", tags: [ "tag1" ], style: [ "bookmark-tag" ] } ] matches: [ { uri: uri1, title: "tagged", tags: [ "tag1" ], style: [ "bookmark-tag" ] } ]
}); });
do_log_info("Check tags in title for page2"); do_print("Check tags in title for page2");
yield check_autocomplete({ yield check_autocomplete({
search: "page2 tag", search: "page2 tag",
matches: [ { uri: uri2, title: "tagged", tags: [ "tag1", "tag2" ], style: [ "bookmark-tag" ] } ] matches: [ { uri: uri2, title: "tagged", tags: [ "tag1", "tag2" ], style: [ "bookmark-tag" ] } ]
}); });
do_log_info("Make sure tags appear even when not matching the tag"); do_print("Make sure tags appear even when not matching the tag");
yield check_autocomplete({ yield check_autocomplete({
search: "page3", search: "page3",
matches: [ { uri: uri3, title: "tagged", tags: [ "tag1", "tag3" ], style: [ "bookmark-tag" ] } ] matches: [ { uri: uri3, title: "tagged", tags: [ "tag1", "tag3" ], style: [ "bookmark-tag" ] } ]
}); });
do_log_info("Multiple tags come in commas for page4"); do_print("Multiple tags come in commas for page4");
yield check_autocomplete({ yield check_autocomplete({
search: "page4", search: "page4",
matches: [ { uri: uri4, title: "tagged", tags: [ "tag1", "tag2", "tag3" ], style: [ "bookmark-tag" ] } ] matches: [ { uri: uri4, title: "tagged", tags: [ "tag1", "tag2", "tag3" ], style: [ "bookmark-tag" ] } ]
}); });
do_log_info("Extra test just to make sure we match the title"); do_print("Extra test just to make sure we match the title");
yield check_autocomplete({ yield check_autocomplete({
search: "tag2", search: "tag2",
matches: [ { uri: uri2, title: "tagged", tags: [ "tag1", "tag2" ], style: [ "bookmark-tag" ] }, matches: [ { uri: uri2, title: "tagged", tags: [ "tag1", "tag2" ], style: [ "bookmark-tag" ] },

View File

@ -8,7 +8,7 @@
*/ */
add_task(function* test_javascript_match() { add_task(function* test_javascript_match() {
do_log_info("Bad escaped uri stays escaped"); do_print("Bad escaped uri stays escaped");
let uri1 = NetUtil.newURI("http://site/%EAid"); let uri1 = NetUtil.newURI("http://site/%EAid");
yield promiseAddVisits([ { uri: uri1, title: "title" } ]); yield promiseAddVisits([ { uri: uri1, title: "title" } ]);
yield check_autocomplete({ yield check_autocomplete({

View File

@ -27,7 +27,7 @@ add_task(function* test_default_behavior_host() {
Services.prefs.setBoolPref("browser.urlbar.suggest.history.onlyTyped", false); Services.prefs.setBoolPref("browser.urlbar.suggest.history.onlyTyped", false);
Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", false); Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", false);
do_log_info("Restrict history, common visit, should not autoFill"); do_print("Restrict history, common visit, should not autoFill");
yield check_autocomplete({ yield check_autocomplete({
search: "vi", search: "vi",
matches: [ { uri: uri2, title: "visited" } ], matches: [ { uri: uri2, title: "visited" } ],
@ -35,7 +35,7 @@ add_task(function* test_default_behavior_host() {
completed: "vi" completed: "vi"
}); });
do_log_info("Restrict history, typed visit, should autoFill"); do_print("Restrict history, typed visit, should autoFill");
yield check_autocomplete({ yield check_autocomplete({
search: "ty", search: "ty",
matches: [ { uri: uri1, title: "typed", style: [ "autofill" ] } ], matches: [ { uri: uri1, title: "typed", style: [ "autofill" ] } ],
@ -44,7 +44,7 @@ add_task(function* test_default_behavior_host() {
}); });
// Don't autoFill this one cause it's not typed. // Don't autoFill this one cause it's not typed.
do_log_info("Restrict history, bookmark, should not autoFill"); do_print("Restrict history, bookmark, should not autoFill");
yield check_autocomplete({ yield check_autocomplete({
search: "bo", search: "bo",
matches: [ ], matches: [ ],
@ -53,7 +53,7 @@ add_task(function* test_default_behavior_host() {
}); });
// Note we don't show this one cause it's not typed. // Note we don't show this one cause it's not typed.
do_log_info("Restrict history, typed bookmark, should autoFill"); do_print("Restrict history, typed bookmark, should autoFill");
yield check_autocomplete({ yield check_autocomplete({
search: "tp", search: "tp",
matches: [ { uri: uri4, title: "tpbk", style: [ "autofill" ] } ], matches: [ { uri: uri4, title: "tpbk", style: [ "autofill" ] } ],
@ -66,7 +66,7 @@ add_task(function* test_default_behavior_host() {
// We are not restricting on typed, so we autoFill the bookmark even if we // We are not restricting on typed, so we autoFill the bookmark even if we
// are restricted to history. We accept that cause not doing that // are restricted to history. We accept that cause not doing that
// would be a perf hit and the privacy implications are very weak. // would be a perf hit and the privacy implications are very weak.
do_log_info("Restrict history, bookmark, autoFill.typed = false, should autoFill"); do_print("Restrict history, bookmark, autoFill.typed = false, should autoFill");
yield check_autocomplete({ yield check_autocomplete({
search: "bo", search: "bo",
matches: [ { uri: uri3, title: "bookmarked", style: [ "bookmark" ], style: [ "autofill" ] } ], matches: [ { uri: uri3, title: "bookmarked", style: [ "bookmark" ], style: [ "autofill" ] } ],
@ -74,7 +74,7 @@ add_task(function* test_default_behavior_host() {
completed: "bookmarked/" completed: "bookmarked/"
}); });
do_log_info("Restrict history, common visit, autoFill.typed = false, should autoFill"); do_print("Restrict history, common visit, autoFill.typed = false, should autoFill");
yield check_autocomplete({ yield check_autocomplete({
search: "vi", search: "vi",
matches: [ { uri: uri2, title: "visited", style: [ "autofill" ] } ], matches: [ { uri: uri2, title: "visited", style: [ "autofill" ] } ],
@ -87,7 +87,7 @@ add_task(function* test_default_behavior_host() {
Services.prefs.setBoolPref("browser.urlbar.suggest.history.onlyTyped", true); Services.prefs.setBoolPref("browser.urlbar.suggest.history.onlyTyped", true);
// Typed behavior basically acts like history, but filters on typed. // Typed behavior basically acts like history, but filters on typed.
do_log_info("Restrict typed, common visit, autoFill.typed = false, should not autoFill"); do_print("Restrict typed, common visit, autoFill.typed = false, should not autoFill");
yield check_autocomplete({ yield check_autocomplete({
search: "vi", search: "vi",
matches: [ ], matches: [ ],
@ -95,7 +95,7 @@ add_task(function* test_default_behavior_host() {
completed: "vi" completed: "vi"
}); });
do_log_info("Restrict typed, typed visit, autofill.typed = false, should autoFill"); do_print("Restrict typed, typed visit, autofill.typed = false, should autoFill");
yield check_autocomplete({ yield check_autocomplete({
search: "ty", search: "ty",
matches: [ { uri: uri1, title: "typed", style: [ "autofill" ] } ], matches: [ { uri: uri1, title: "typed", style: [ "autofill" ] } ],
@ -103,7 +103,7 @@ add_task(function* test_default_behavior_host() {
completed: "typed/" completed: "typed/"
}); });
do_log_info("Restrict typed, bookmark, autofill.typed = false, should not autoFill"); do_print("Restrict typed, bookmark, autofill.typed = false, should not autoFill");
yield check_autocomplete({ yield check_autocomplete({
search: "bo", search: "bo",
matches: [ ], matches: [ ],
@ -111,7 +111,7 @@ add_task(function* test_default_behavior_host() {
completed: "bo" completed: "bo"
}); });
do_log_info("Restrict typed, typed bookmark, autofill.typed = false, should autoFill"); do_print("Restrict typed, typed bookmark, autofill.typed = false, should autoFill");
yield check_autocomplete({ yield check_autocomplete({
search: "tp", search: "tp",
matches: [ { uri: uri4, title: "tpbk", style: [ "autofill" ] } ], matches: [ { uri: uri4, title: "tpbk", style: [ "autofill" ] } ],
@ -124,7 +124,7 @@ add_task(function* test_default_behavior_host() {
Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", true); Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", true);
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", true); Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", true);
do_log_info("Restrict bookmarks, common visit, should not autoFill"); do_print("Restrict bookmarks, common visit, should not autoFill");
yield check_autocomplete({ yield check_autocomplete({
search: "vi", search: "vi",
matches: [ ], matches: [ ],
@ -132,7 +132,7 @@ add_task(function* test_default_behavior_host() {
completed: "vi" completed: "vi"
}); });
do_log_info("Restrict bookmarks, typed visit, should not autoFill"); do_print("Restrict bookmarks, typed visit, should not autoFill");
yield check_autocomplete({ yield check_autocomplete({
search: "ty", search: "ty",
matches: [ ], matches: [ ],
@ -141,7 +141,7 @@ add_task(function* test_default_behavior_host() {
}); });
// Don't autoFill this one cause it's not typed. // Don't autoFill this one cause it's not typed.
do_log_info("Restrict bookmarks, bookmark, should not autoFill"); do_print("Restrict bookmarks, bookmark, should not autoFill");
yield check_autocomplete({ yield check_autocomplete({
search: "bo", search: "bo",
matches: [ { uri: uri3, title: "bookmarked", style: [ "bookmark" ] } ], matches: [ { uri: uri3, title: "bookmarked", style: [ "bookmark" ] } ],
@ -150,7 +150,7 @@ add_task(function* test_default_behavior_host() {
}); });
// Note we don't show this one cause it's not typed. // Note we don't show this one cause it's not typed.
do_log_info("Restrict bookmarks, typed bookmark, should autoFill"); do_print("Restrict bookmarks, typed bookmark, should autoFill");
yield check_autocomplete({ yield check_autocomplete({
search: "tp", search: "tp",
matches: [ { uri: uri4, title: "tpbk", style: [ "autofill" ] } ], matches: [ { uri: uri4, title: "tpbk", style: [ "autofill" ] } ],
@ -160,7 +160,7 @@ add_task(function* test_default_behavior_host() {
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false); Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
do_log_info("Restrict bookmarks, bookmark, autofill.typed = false, should autoFill"); do_print("Restrict bookmarks, bookmark, autofill.typed = false, should autoFill");
yield check_autocomplete({ yield check_autocomplete({
search: "bo", search: "bo",
matches: [ { uri: uri3, title: "bookmarked", style: [ "autofill" ] } ], matches: [ { uri: uri3, title: "bookmarked", style: [ "autofill" ] } ],
@ -169,7 +169,7 @@ add_task(function* test_default_behavior_host() {
}); });
// Don't autofill because it's a title. // Don't autofill because it's a title.
do_log_info("Restrict bookmarks, title, autofill.typed = false, should not autoFill"); do_print("Restrict bookmarks, title, autofill.typed = false, should not autoFill");
yield check_autocomplete({ yield check_autocomplete({
search: "# ta", search: "# ta",
matches: [ ], matches: [ ],
@ -178,7 +178,7 @@ add_task(function* test_default_behavior_host() {
}); });
// Don't autofill because it's a tag. // Don't autofill because it's a tag.
do_log_info("Restrict bookmarks, tag, autofill.typed = false, should not autoFill"); do_print("Restrict bookmarks, tag, autofill.typed = false, should not autoFill");
yield check_autocomplete({ yield check_autocomplete({
search: "+ ta", search: "+ ta",
matches: [ { uri: uri5, title: "title", tags: [ "foo" ], style: [ "tag" ] } ], matches: [ { uri: uri5, title: "title", tags: [ "foo" ], style: [ "tag" ] } ],
@ -210,7 +210,7 @@ add_task(function* test_default_behavior_url() {
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", true); Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", true);
Services.prefs.setBoolPref("browser.urlbar.autoFill.searchEngines", false); Services.prefs.setBoolPref("browser.urlbar.autoFill.searchEngines", false);
do_log_info("URL: Restrict history, common visit, should not autoFill"); do_print("URL: Restrict history, common visit, should not autoFill");
yield check_autocomplete({ yield check_autocomplete({
search: "visited/v", search: "visited/v",
matches: [ { uri: uri2, title: "visited" } ], matches: [ { uri: uri2, title: "visited" } ],
@ -218,7 +218,7 @@ add_task(function* test_default_behavior_url() {
completed: "visited/v" completed: "visited/v"
}); });
do_log_info("URL: Restrict history, typed visit, should autoFill"); do_print("URL: Restrict history, typed visit, should autoFill");
yield check_autocomplete({ yield check_autocomplete({
search: "typed/t", search: "typed/t",
matches: [ { uri: uri1, title: "typed/ty/", style: [ "autofill" ] } ], matches: [ { uri: uri1, title: "typed/ty/", style: [ "autofill" ] } ],
@ -227,7 +227,7 @@ add_task(function* test_default_behavior_url() {
}); });
// Don't autoFill this one cause it's not typed. // Don't autoFill this one cause it's not typed.
do_log_info("URL: Restrict history, bookmark, should not autoFill"); do_print("URL: Restrict history, bookmark, should not autoFill");
yield check_autocomplete({ yield check_autocomplete({
search: "bookmarked/b", search: "bookmarked/b",
matches: [ ], matches: [ ],
@ -236,7 +236,7 @@ add_task(function* test_default_behavior_url() {
}); });
// Note we don't show this one cause it's not typed. // Note we don't show this one cause it's not typed.
do_log_info("URL: Restrict history, typed bookmark, should autoFill"); do_print("URL: Restrict history, typed bookmark, should autoFill");
yield check_autocomplete({ yield check_autocomplete({
search: "tpbk/t", search: "tpbk/t",
matches: [ { uri: uri4, title: "tpbk/tp/", style: [ "autofill" ] } ], matches: [ { uri: uri4, title: "tpbk/tp/", style: [ "autofill" ] } ],
@ -248,7 +248,7 @@ add_task(function* test_default_behavior_url() {
Services.prefs.setBoolPref("browser.urlbar.suggest.history", false); Services.prefs.setBoolPref("browser.urlbar.suggest.history", false);
Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", true); Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", true);
do_log_info("URL: Restrict bookmarks, common visit, should not autoFill"); do_print("URL: Restrict bookmarks, common visit, should not autoFill");
yield check_autocomplete({ yield check_autocomplete({
search: "visited/v", search: "visited/v",
matches: [ ], matches: [ ],
@ -256,7 +256,7 @@ add_task(function* test_default_behavior_url() {
completed: "visited/v" completed: "visited/v"
}); });
do_log_info("URL: Restrict bookmarks, typed visit, should not autoFill"); do_print("URL: Restrict bookmarks, typed visit, should not autoFill");
yield check_autocomplete({ yield check_autocomplete({
search: "typed/t", search: "typed/t",
matches: [ ], matches: [ ],
@ -265,7 +265,7 @@ add_task(function* test_default_behavior_url() {
}); });
// Don't autoFill this one cause it's not typed. // Don't autoFill this one cause it's not typed.
do_log_info("URL: Restrict bookmarks, bookmark, should not autoFill"); do_print("URL: Restrict bookmarks, bookmark, should not autoFill");
yield check_autocomplete({ yield check_autocomplete({
search: "bookmarked/b", search: "bookmarked/b",
matches: [ { uri: uri3, title: "bookmarked", style: [ "bookmark" ] } ], matches: [ { uri: uri3, title: "bookmarked", style: [ "bookmark" ] } ],
@ -274,7 +274,7 @@ add_task(function* test_default_behavior_url() {
}); });
// Note we don't show this one cause it's not typed. // Note we don't show this one cause it's not typed.
do_log_info("URL: Restrict bookmarks, typed bookmark, should autoFill"); do_print("URL: Restrict bookmarks, typed bookmark, should autoFill");
yield check_autocomplete({ yield check_autocomplete({
search: "tpbk/t", search: "tpbk/t",
matches: [ { uri: uri4, title: "tpbk/tp/", style: [ "autofill" ] } ], matches: [ { uri: uri4, title: "tpbk/tp/", style: [ "autofill" ] } ],
@ -284,7 +284,7 @@ add_task(function* test_default_behavior_url() {
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false); Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
do_log_info("URL: Restrict bookmarks, bookmark, autofill.typed = false, should autoFill"); do_print("URL: Restrict bookmarks, bookmark, autofill.typed = false, should autoFill");
yield check_autocomplete({ yield check_autocomplete({
search: "bookmarked/b", search: "bookmarked/b",
matches: [ { uri: uri3, title: "bookmarked/bo/", style: [ "autofill" ] } ], matches: [ { uri: uri3, title: "bookmarked/bo/", style: [ "autofill" ] } ],

View File

@ -7,7 +7,7 @@
const PREF_AUTOCOMPLETE_ENABLED = "browser.urlbar.autocomplete.enabled"; const PREF_AUTOCOMPLETE_ENABLED = "browser.urlbar.autocomplete.enabled";
add_task(function* test_disabling_autocomplete() { add_task(function* test_disabling_autocomplete() {
do_log_info("Check disabling autocomplete disables autofill"); do_print("Check disabling autocomplete disables autofill");
Services.prefs.setBoolPref(PREF_AUTOCOMPLETE_ENABLED, false); Services.prefs.setBoolPref(PREF_AUTOCOMPLETE_ENABLED, false);
yield promiseAddVisits({ uri: NetUtil.newURI("http://visit.mozilla.org"), yield promiseAddVisits({ uri: NetUtil.newURI("http://visit.mozilla.org"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
@ -20,7 +20,7 @@ add_task(function* test_disabling_autocomplete() {
}); });
add_task(function* test_urls_order() { add_task(function* test_urls_order() {
do_log_info("Add urls, check for correct order"); do_print("Add urls, check for correct order");
let places = [{ uri: NetUtil.newURI("http://visit1.mozilla.org") }, let places = [{ uri: NetUtil.newURI("http://visit1.mozilla.org") },
{ uri: NetUtil.newURI("http://visit2.mozilla.org"), { uri: NetUtil.newURI("http://visit2.mozilla.org"),
transition: TRANSITION_TYPED }]; transition: TRANSITION_TYPED }];
@ -34,7 +34,7 @@ add_task(function* test_urls_order() {
}); });
add_task(function* test_ignore_prefix() { add_task(function* test_ignore_prefix() {
do_log_info("Add urls, make sure www and http are ignored"); do_print("Add urls, make sure www and http are ignored");
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false); Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
yield promiseAddVisits(NetUtil.newURI("http://www.visit1.mozilla.org")); yield promiseAddVisits(NetUtil.newURI("http://www.visit1.mozilla.org"));
yield check_autocomplete({ yield check_autocomplete({
@ -46,7 +46,7 @@ add_task(function* test_ignore_prefix() {
}); });
add_task(function* test_after_host() { add_task(function* test_after_host() {
do_log_info("Autocompleting after an existing host completes to the url"); do_print("Autocompleting after an existing host completes to the url");
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false); Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
yield promiseAddVisits(NetUtil.newURI("http://www.visit3.mozilla.org")); yield promiseAddVisits(NetUtil.newURI("http://www.visit3.mozilla.org"));
yield check_autocomplete({ yield check_autocomplete({
@ -58,7 +58,7 @@ add_task(function* test_after_host() {
}); });
add_task(function* test_respect_www() { add_task(function* test_respect_www() {
do_log_info("Searching for www.me should yield www.me.mozilla.org/"); do_print("Searching for www.me should yield www.me.mozilla.org/");
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false); Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
yield promiseAddVisits(NetUtil.newURI("http://www.me.mozilla.org")); yield promiseAddVisits(NetUtil.newURI("http://www.me.mozilla.org"));
yield check_autocomplete({ yield check_autocomplete({
@ -70,7 +70,7 @@ add_task(function* test_respect_www() {
}); });
add_task(function* test_bookmark_first() { add_task(function* test_bookmark_first() {
do_log_info("With a bookmark and history, the query result should be the bookmark"); do_print("With a bookmark and history, the query result should be the bookmark");
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false); Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
addBookmark({ uri: NetUtil.newURI("http://bookmark1.mozilla.org/") }); addBookmark({ uri: NetUtil.newURI("http://bookmark1.mozilla.org/") });
yield promiseAddVisits(NetUtil.newURI("http://bookmark1.mozilla.org/foo")); yield promiseAddVisits(NetUtil.newURI("http://bookmark1.mozilla.org/foo"));
@ -83,7 +83,7 @@ add_task(function* test_bookmark_first() {
}); });
add_task(function* test_full_path() { add_task(function* test_full_path() {
do_log_info("Check to make sure we get the proper results with full paths"); do_print("Check to make sure we get the proper results with full paths");
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false); Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
let places = [{ uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=delicious") }, let places = [{ uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=delicious") },
{ uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=smokey") }]; { uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=smokey") }];
@ -97,7 +97,7 @@ add_task(function* test_full_path() {
}); });
add_task(function* test_complete_to_slash() { add_task(function* test_complete_to_slash() {
do_log_info("Check to make sure we autocomplete to the following '/'"); do_print("Check to make sure we autocomplete to the following '/'");
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false); Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
let places = [{ uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=delicious") }, let places = [{ uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=delicious") },
{ uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=smokey") }]; { uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=smokey") }];
@ -111,7 +111,7 @@ add_task(function* test_complete_to_slash() {
}); });
add_task(function* test_complete_to_slash_with_www() { add_task(function* test_complete_to_slash_with_www() {
do_log_info("Check to make sure we autocomplete to the following '/'"); do_print("Check to make sure we autocomplete to the following '/'");
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false); Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
let places = [{ uri: NetUtil.newURI("http://www.smokey.mozilla.org/foo/bar/baz?bacon=delicious") }, let places = [{ uri: NetUtil.newURI("http://www.smokey.mozilla.org/foo/bar/baz?bacon=delicious") },
{ uri: NetUtil.newURI("http://www.smokey.mozilla.org/foo/bar/baz?bacon=smokey") }]; { uri: NetUtil.newURI("http://www.smokey.mozilla.org/foo/bar/baz?bacon=smokey") }];
@ -125,7 +125,7 @@ add_task(function* test_complete_to_slash_with_www() {
}); });
add_task(function* test_complete_querystring() { add_task(function* test_complete_querystring() {
do_log_info("Check to make sure we autocomplete after ?"); do_print("Check to make sure we autocomplete after ?");
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false); Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
yield promiseAddVisits(NetUtil.newURI("http://smokey.mozilla.org/foo?bacon=delicious")); yield promiseAddVisits(NetUtil.newURI("http://smokey.mozilla.org/foo?bacon=delicious"));
yield check_autocomplete({ yield check_autocomplete({
@ -137,7 +137,7 @@ add_task(function* test_complete_querystring() {
}); });
add_task(function* test_complete_fragment() { add_task(function* test_complete_fragment() {
do_log_info("Check to make sure we autocomplete after #"); do_print("Check to make sure we autocomplete after #");
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false); Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
yield promiseAddVisits(NetUtil.newURI("http://smokey.mozilla.org/foo?bacon=delicious#bar")); yield promiseAddVisits(NetUtil.newURI("http://smokey.mozilla.org/foo?bacon=delicious#bar"));
yield check_autocomplete({ yield check_autocomplete({

View File

@ -6,7 +6,7 @@ add_task(function* test_prefix_space_noautofill() {
yield promiseAddVisits({ uri: NetUtil.newURI("http://moz.org/test/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://moz.org/test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
do_log_info("Should not try to autoFill if search string contains a space"); do_print("Should not try to autoFill if search string contains a space");
yield check_autocomplete({ yield check_autocomplete({
search: " mo", search: " mo",
autofilled: " mo", autofilled: " mo",
@ -20,7 +20,7 @@ add_task(function* test_trailing_space_noautofill() {
yield promiseAddVisits({ uri: NetUtil.newURI("http://moz.org/test/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://moz.org/test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
do_log_info("Should not try to autoFill if search string contains a space"); do_print("Should not try to autoFill if search string contains a space");
yield check_autocomplete({ yield check_autocomplete({
search: "mo ", search: "mo ",
autofilled: "mo ", autofilled: "mo ",
@ -38,7 +38,7 @@ add_task(function* test_searchEngine_autofill() {
engine.addParam("q", "{searchTerms}", null); engine.addParam("q", "{searchTerms}", null);
do_register_cleanup(() => Services.search.removeEngine(engine)); do_register_cleanup(() => Services.search.removeEngine(engine));
do_log_info("Should autoFill search engine if search string does not contains a space"); do_print("Should autoFill search engine if search string does not contains a space");
yield check_autocomplete({ yield check_autocomplete({
search: "ca", search: "ca",
autofilled: "cake.search", autofilled: "cake.search",
@ -56,7 +56,7 @@ add_task(function* test_searchEngine_prefix_space_noautofill() {
engine.addParam("q", "{searchTerms}", null); engine.addParam("q", "{searchTerms}", null);
do_register_cleanup(() => Services.search.removeEngine(engine)); do_register_cleanup(() => Services.search.removeEngine(engine));
do_log_info("Should not try to autoFill search engine if search string contains a space"); do_print("Should not try to autoFill search engine if search string contains a space");
yield check_autocomplete({ yield check_autocomplete({
search: " cu", search: " cu",
autofilled: " cu", autofilled: " cu",
@ -74,7 +74,7 @@ add_task(function* test_searchEngine_trailing_space_noautofill() {
engine.addParam("q", "{searchTerms}", null); engine.addParam("q", "{searchTerms}", null);
do_register_cleanup(() => Services.search.removeEngine(engine)); do_register_cleanup(() => Services.search.removeEngine(engine));
do_log_info("Should not try to autoFill search engine if search string contains a space"); do_print("Should not try to autoFill search engine if search string contains a space");
yield check_autocomplete({ yield check_autocomplete({
search: "ba ", search: "ba ",
autofilled: "ba ", autofilled: "ba ",
@ -92,7 +92,7 @@ add_task(function* test_searchEngine_www_noautofill() {
engine.addParam("q", "{searchTerms}", null); engine.addParam("q", "{searchTerms}", null);
do_register_cleanup(() => Services.search.removeEngine(engine)); do_register_cleanup(() => Services.search.removeEngine(engine));
do_log_info("Should not autoFill search engine if search string contains www. but engine doesn't"); do_print("Should not autoFill search engine if search string contains www. but engine doesn't");
yield check_autocomplete({ yield check_autocomplete({
search: "www.ham", search: "www.ham",
autofilled: "www.ham", autofilled: "www.ham",
@ -110,7 +110,7 @@ add_task(function* test_searchEngine_different_scheme_noautofill() {
engine.addParam("q", "{searchTerms}", null); engine.addParam("q", "{searchTerms}", null);
do_register_cleanup(() => Services.search.removeEngine(engine)); do_register_cleanup(() => Services.search.removeEngine(engine));
do_log_info("Should not autoFill search engine if search string has a different scheme."); do_print("Should not autoFill search engine if search string has a different scheme.");
yield check_autocomplete({ yield check_autocomplete({
search: "http://pie", search: "http://pie",
autofilled: "http://pie", autofilled: "http://pie",
@ -129,21 +129,21 @@ add_task(function* test_searchEngine_matching_prefix_autofill() {
do_register_cleanup(() => Services.search.removeEngine(engine)); do_register_cleanup(() => Services.search.removeEngine(engine));
do_log_info("Should autoFill search engine if search string has matching prefix."); do_print("Should autoFill search engine if search string has matching prefix.");
yield check_autocomplete({ yield check_autocomplete({
search: "http://www.be", search: "http://www.be",
autofilled: "http://www.bean.search", autofilled: "http://www.bean.search",
completed: "http://www.bean.search" completed: "http://www.bean.search"
}) })
do_log_info("Should autoFill search engine if search string has www prefix."); do_print("Should autoFill search engine if search string has www prefix.");
yield check_autocomplete({ yield check_autocomplete({
search: "www.be", search: "www.be",
autofilled: "www.bean.search", autofilled: "www.bean.search",
completed: "http://www.bean.search" completed: "http://www.bean.search"
}); });
do_log_info("Should autoFill search engine if search string has matching scheme."); do_print("Should autoFill search engine if search string has matching scheme.");
yield check_autocomplete({ yield check_autocomplete({
search: "http://be", search: "http://be",
autofilled: "http://bean.search", autofilled: "http://bean.search",
@ -159,7 +159,7 @@ add_task(function* test_prefix_autofill() {
yield promiseAddVisits({ uri: NetUtil.newURI("http://moz.org/test/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://moz.org/test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
do_log_info("Should not try to autoFill in-the-middle if a search is canceled immediately"); do_print("Should not try to autoFill in-the-middle if a search is canceled immediately");
yield check_autocomplete({ yield check_autocomplete({
incompleteSearch: "moz", incompleteSearch: "moz",
search: "mozi", search: "mozi",

View File

@ -28,7 +28,7 @@ add_task(function* test_protocol_trimming() {
"www.mo te" "www.mo te"
]; ];
for (let input of inputs) { for (let input of inputs) {
do_log_info("Searching for: " + input); do_print("Searching for: " + input);
yield check_autocomplete({ yield check_autocomplete({
search: input, search: input,
matches: matches matches: matches

View File

@ -3,7 +3,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
add_task(function* test_casing_1() { add_task(function* test_casing_1() {
do_log_info("Searching for cased entry 1"); do_print("Searching for cased entry 1");
yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({
@ -15,7 +15,7 @@ add_task(function* test_casing_1() {
}); });
add_task(function* test_casing_2() { add_task(function* test_casing_2() {
do_log_info("Searching for cased entry 2"); do_print("Searching for cased entry 2");
yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({
@ -27,7 +27,7 @@ add_task(function* test_casing_2() {
}); });
add_task(function* test_casing_3() { add_task(function* test_casing_3() {
do_log_info("Searching for cased entry 3"); do_print("Searching for cased entry 3");
yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({
@ -39,7 +39,7 @@ add_task(function* test_casing_3() {
}); });
add_task(function* test_casing_4() { add_task(function* test_casing_4() {
do_log_info("Searching for cased entry 4"); do_print("Searching for cased entry 4");
yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({
@ -51,7 +51,7 @@ add_task(function* test_casing_4() {
}); });
add_task(function* test_casing_5() { add_task(function* test_casing_5() {
do_log_info("Searching for cased entry 5"); do_print("Searching for cased entry 5");
yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({
@ -63,7 +63,7 @@ add_task(function* test_casing_5() {
}); });
add_task(function* test_untrimmed_casing() { add_task(function* test_untrimmed_casing() {
do_log_info("Searching for untrimmed cased entry"); do_print("Searching for untrimmed cased entry");
yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({
@ -75,7 +75,7 @@ add_task(function* test_untrimmed_casing() {
}); });
add_task(function* test_untrimmed_www_casing() { add_task(function* test_untrimmed_www_casing() {
do_log_info("Searching for untrimmed cased entry with www"); do_print("Searching for untrimmed cased entry with www");
yield promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/Test/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/Test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({
@ -87,7 +87,7 @@ add_task(function* test_untrimmed_www_casing() {
}); });
add_task(function* test_untrimmed_path_casing() { add_task(function* test_untrimmed_path_casing() {
do_log_info("Searching for untrimmed cased entry with path"); do_print("Searching for untrimmed cased entry with path");
yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({
@ -99,7 +99,7 @@ add_task(function* test_untrimmed_path_casing() {
}); });
add_task(function* test_untrimmed_path_casing_2() { add_task(function* test_untrimmed_path_casing_2() {
do_log_info("Searching for untrimmed cased entry with path 2"); do_print("Searching for untrimmed cased entry with path 2");
yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({
@ -111,7 +111,7 @@ add_task(function* test_untrimmed_path_casing_2() {
}); });
add_task(function* test_untrimmed_path_www_casing() { add_task(function* test_untrimmed_path_www_casing() {
do_log_info("Searching for untrimmed cased entry with www and path"); do_print("Searching for untrimmed cased entry with www and path");
yield promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/Test/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/Test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({
@ -123,7 +123,7 @@ add_task(function* test_untrimmed_path_www_casing() {
}); });
add_task(function* test_untrimmed_path_www_casing_2() { add_task(function* test_untrimmed_path_www_casing_2() {
do_log_info("Searching for untrimmed cased entry with www and path 2"); do_print("Searching for untrimmed cased entry with www and path 2");
yield promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/Test/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/Test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({

View File

@ -6,7 +6,7 @@
// that largely confuses completeDefaultIndex // that largely confuses completeDefaultIndex
add_task(function* test_not_autofill_ws_1() { add_task(function* test_not_autofill_ws_1() {
do_log_info("Do not autofill whitespaced entry 1"); do_print("Do not autofill whitespaced entry 1");
yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({
@ -18,7 +18,7 @@ add_task(function* test_not_autofill_ws_1() {
}); });
add_task(function* test_not_autofill_ws_2() { add_task(function* test_not_autofill_ws_2() {
do_log_info("Do not autofill whitespaced entry 2"); do_print("Do not autofill whitespaced entry 2");
yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({
@ -30,7 +30,7 @@ add_task(function* test_not_autofill_ws_2() {
}); });
add_task(function* test_not_autofill_ws_3() { add_task(function* test_not_autofill_ws_3() {
do_log_info("Do not autofill whitespaced entry 3"); do_print("Do not autofill whitespaced entry 3");
yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({
@ -42,7 +42,7 @@ add_task(function* test_not_autofill_ws_3() {
}); });
add_task(function* test_not_autofill_ws_4() { add_task(function* test_not_autofill_ws_4() {
do_log_info("Do not autofill whitespaced entry 4"); do_print("Do not autofill whitespaced entry 4");
yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({
@ -55,7 +55,7 @@ add_task(function* test_not_autofill_ws_4() {
add_task(function* test_not_autofill_ws_5() { add_task(function* test_not_autofill_ws_5() {
do_log_info("Do not autofill whitespaced entry 5"); do_print("Do not autofill whitespaced entry 5");
yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({
@ -67,7 +67,7 @@ add_task(function* test_not_autofill_ws_5() {
}); });
add_task(function* test_not_autofill_ws_6() { add_task(function* test_not_autofill_ws_6() {
do_log_info("Do not autofill whitespaced entry 6"); do_print("Do not autofill whitespaced entry 6");
yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({

View File

@ -35,37 +35,37 @@ add_task(function* test_download_embed_bookmarks() {
addBookmark({ uri: uri3, addBookmark({ uri: uri3,
title: "framed-bookmark" }); title: "framed-bookmark" });
do_log_info("Searching for bookmarked download uri matches"); do_print("Searching for bookmarked download uri matches");
yield check_autocomplete({ yield check_autocomplete({
search: "download-bookmark", search: "download-bookmark",
matches: [ { uri: uri1, title: "download-bookmark", style: [ "bookmark" ] } ] matches: [ { uri: uri1, title: "download-bookmark", style: [ "bookmark" ] } ]
}); });
do_log_info("Searching for bookmarked embed uri matches"); do_print("Searching for bookmarked embed uri matches");
yield check_autocomplete({ yield check_autocomplete({
search: "embed-bookmark", search: "embed-bookmark",
matches: [ { uri: uri2, title: "embed-bookmark", style: [ "bookmark" ] } ] matches: [ { uri: uri2, title: "embed-bookmark", style: [ "bookmark" ] } ]
}); });
do_log_info("Searching for bookmarked framed uri matches"); do_print("Searching for bookmarked framed uri matches");
yield check_autocomplete({ yield check_autocomplete({
search: "framed-bookmark", search: "framed-bookmark",
matches: [ { uri: uri3, title: "framed-bookmark", style: [ "bookmark" ] } ] matches: [ { uri: uri3, title: "framed-bookmark", style: [ "bookmark" ] } ]
}); });
do_log_info("Searching for download uri does not match"); do_print("Searching for download uri does not match");
yield check_autocomplete({ yield check_autocomplete({
search: "download2", search: "download2",
matches: [ ] matches: [ ]
}); });
do_log_info("Searching for embed uri does not match"); do_print("Searching for embed uri does not match");
yield check_autocomplete({ yield check_autocomplete({
search: "embed2", search: "embed2",
matches: [ ] matches: [ ]
}); });
do_log_info("Searching for framed uri does not match"); do_print("Searching for framed uri does not match");
yield check_autocomplete({ yield check_autocomplete({
search: "framed2", search: "framed2",
matches: [ ] matches: [ ]

View File

@ -4,7 +4,7 @@
// Ensure inline autocomplete doesn't return zero frecency pages. // Ensure inline autocomplete doesn't return zero frecency pages.
add_task(function* test_dupe_urls() { add_task(function* test_dupe_urls() {
do_log_info("Searching for urls with dupes should only show one"); do_print("Searching for urls with dupes should only show one");
yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/"),
transition: TRANSITION_TYPED }, transition: TRANSITION_TYPED },
{ uri: NetUtil.newURI("http://mozilla.org/?") }); { uri: NetUtil.newURI("http://mozilla.org/?") });

View File

@ -40,7 +40,7 @@ add_task(function* test_javascript_match() {
// Now remove page 6 from history, so it is an unvisited bookmark. // Now remove page 6 from history, so it is an unvisited bookmark.
PlacesUtils.history.removePage(uri6); PlacesUtils.history.removePage(uri6);
do_log_info("Match everything"); do_print("Match everything");
yield check_autocomplete({ yield check_autocomplete({
search: "foo", search: "foo",
searchParam: "enable-actions", searchParam: "enable-actions",
@ -53,21 +53,21 @@ add_task(function* test_javascript_match() {
{ uri: makeActionURI("switchtab", {url: "http://t.foo/6"}), title: "title", style: [ "action,switchtab" ] }, ] { uri: makeActionURI("switchtab", {url: "http://t.foo/6"}), title: "title", style: [ "action,switchtab" ] }, ]
}); });
do_log_info("Match only typed history"); do_print("Match only typed history");
yield check_autocomplete({ yield check_autocomplete({
search: "foo ^ ~", search: "foo ^ ~",
matches: [ { uri: uri3, title: "title" }, matches: [ { uri: uri3, title: "title" },
{ uri: uri4, title: "title" } ] { uri: uri4, title: "title" } ]
}); });
do_log_info("Drop-down empty search matches only typed history"); do_print("Drop-down empty search matches only typed history");
yield check_autocomplete({ yield check_autocomplete({
search: "", search: "",
matches: [ { uri: uri3, title: "title" }, matches: [ { uri: uri3, title: "title" },
{ uri: uri4, title: "title" } ] { uri: uri4, title: "title" } ]
}); });
do_log_info("Drop-down empty search matches only bookmarks"); do_print("Drop-down empty search matches only bookmarks");
Services.prefs.setBoolPref("browser.urlbar.suggest.history", false); Services.prefs.setBoolPref("browser.urlbar.suggest.history", false);
Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", true); Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", true);
yield check_autocomplete({ yield check_autocomplete({
@ -78,7 +78,7 @@ add_task(function* test_javascript_match() {
{ uri: uri6, title: "title", style: ["bookmark"] } ] { uri: uri6, title: "title", style: ["bookmark"] } ]
}); });
do_log_info("Drop-down empty search matches only open tabs"); do_print("Drop-down empty search matches only open tabs");
Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", false); Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", false);
yield check_autocomplete({ yield check_autocomplete({
search: "", search: "",

View File

@ -11,20 +11,20 @@ add_task(function* test_enabled() {
let uri = NetUtil.newURI("http://url/0"); let uri = NetUtil.newURI("http://url/0");
yield promiseAddVisits([ { uri: uri, title: "title" } ]); yield promiseAddVisits([ { uri: uri, title: "title" } ]);
do_log_info("plain search"); do_print("plain search");
yield check_autocomplete({ yield check_autocomplete({
search: "url", search: "url",
matches: [ { uri: uri, title: "title" } ] matches: [ { uri: uri, title: "title" } ]
}); });
do_log_info("search disabled"); do_print("search disabled");
Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", false); Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", false);
yield check_autocomplete({ yield check_autocomplete({
search: "url", search: "url",
matches: [ ] matches: [ ]
}); });
do_log_info("resume normal search"); do_print("resume normal search");
Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", true); Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", true);
yield check_autocomplete({ yield check_autocomplete({
search: "url", search: "url",

View File

@ -13,13 +13,13 @@ add_task(function* test_escape() {
yield promiseAddVisits([ { uri: uri1, title: "title" }, yield promiseAddVisits([ { uri: uri1, title: "title" },
{ uri: uri2, title: "title" } ]); { uri: uri2, title: "title" } ]);
do_log_info("Unescaped location matches itself"); do_print("Unescaped location matches itself");
yield check_autocomplete({ yield check_autocomplete({
search: "http://unescapeduri/", search: "http://unescapeduri/",
matches: [ { uri: uri1, title: "title" } ] matches: [ { uri: uri1, title: "title" } ]
}); });
do_log_info("Escaped location matches itself"); do_print("Escaped location matches itself");
yield check_autocomplete({ yield check_autocomplete({
search: "http://escapeduri/%40/", search: "http://escapeduri/%40/",
matches: [ { uri: uri2, title: "title" } ] matches: [ { uri: uri2, title: "title" } ]

View File

@ -12,7 +12,7 @@ add_task(function* test_escape() {
yield promiseAddVisits([ { uri: uri1, title: "title" }, yield promiseAddVisits([ { uri: uri1, title: "title" },
{ uri: uri2, title: "title" } ]); { uri: uri2, title: "title" } ]);
do_log_info("Searching for h matches site and not http://"); do_print("Searching for h matches site and not http://");
yield check_autocomplete({ yield check_autocomplete({
search: "h", search: "h",
matches: [ { uri: uri2, title: "title" } ] matches: [ { uri: uri2, title: "title" } ]

View File

@ -19,43 +19,43 @@ add_task(function* test_keyword_searc() {
{ uri: uri2, title: "Generic page title" } ]); { uri: uri2, title: "Generic page title" } ]);
addBookmark({ uri: uri1, title: "Keyword title", keyword: "key"}); addBookmark({ uri: uri1, title: "Keyword title", keyword: "key"});
do_log_info("Plain keyword query"); do_print("Plain keyword query");
yield check_autocomplete({ yield check_autocomplete({
search: "key term", search: "key term",
matches: [ { uri: NetUtil.newURI("http://abc/?search=term"), title: "Keyword title", style: ["keyword"] } ] matches: [ { uri: NetUtil.newURI("http://abc/?search=term"), title: "Keyword title", style: ["keyword"] } ]
}); });
do_log_info("Multi-word keyword query"); do_print("Multi-word keyword query");
yield check_autocomplete({ yield check_autocomplete({
search: "key multi word", search: "key multi word",
matches: [ { uri: NetUtil.newURI("http://abc/?search=multi+word"), title: "Keyword title", style: ["keyword"] } ] matches: [ { uri: NetUtil.newURI("http://abc/?search=multi+word"), title: "Keyword title", style: ["keyword"] } ]
}); });
do_log_info("Keyword query with +"); do_print("Keyword query with +");
yield check_autocomplete({ yield check_autocomplete({
search: "key blocking+", search: "key blocking+",
matches: [ { uri: NetUtil.newURI("http://abc/?search=blocking%2B"), title: "Keyword title", style: ["keyword"] } ] matches: [ { uri: NetUtil.newURI("http://abc/?search=blocking%2B"), title: "Keyword title", style: ["keyword"] } ]
}); });
do_log_info("Unescaped term in query"); do_print("Unescaped term in query");
yield check_autocomplete({ yield check_autocomplete({
search: "key ユニコード", search: "key ユニコード",
matches: [ { uri: NetUtil.newURI("http://abc/?search=ユニコード"), title: "Keyword title", style: ["keyword"] } ] matches: [ { uri: NetUtil.newURI("http://abc/?search=ユニコード"), title: "Keyword title", style: ["keyword"] } ]
}); });
do_log_info("Keyword that happens to match a page"); do_print("Keyword that happens to match a page");
yield check_autocomplete({ yield check_autocomplete({
search: "key ThisPageIsInHistory", search: "key ThisPageIsInHistory",
matches: [ { uri: NetUtil.newURI("http://abc/?search=ThisPageIsInHistory"), title: "Generic page title", style: ["bookmark"] } ] matches: [ { uri: NetUtil.newURI("http://abc/?search=ThisPageIsInHistory"), title: "Generic page title", style: ["bookmark"] } ]
}); });
do_log_info("Keyword without query (without space)"); do_print("Keyword without query (without space)");
yield check_autocomplete({ yield check_autocomplete({
search: "key", search: "key",
matches: [ { uri: NetUtil.newURI("http://abc/?search="), title: "Keyword title", style: ["keyword"] } ] matches: [ { uri: NetUtil.newURI("http://abc/?search="), title: "Keyword title", style: ["keyword"] } ]
}); });
do_log_info("Keyword without query (with space)"); do_print("Keyword without query (with space)");
yield check_autocomplete({ yield check_autocomplete({
search: "key ", search: "key ",
matches: [ { uri: NetUtil.newURI("http://abc/?search="), title: "Keyword title", style: ["keyword"] } ] matches: [ { uri: NetUtil.newURI("http://abc/?search="), title: "Keyword title", style: ["keyword"] } ]
@ -66,7 +66,7 @@ add_task(function* test_keyword_searc() {
yield promiseAddVisits([ { uri: uri3, title: "Generic page title" } ]); yield promiseAddVisits([ { uri: uri3, title: "Generic page title" } ]);
addBookmark({ uri: uri3, title: "Keyword title", keyword: "key", style: ["keyword"] }); addBookmark({ uri: uri3, title: "Keyword title", keyword: "key", style: ["keyword"] });
do_log_info("Two keywords matched"); do_print("Two keywords matched");
yield check_autocomplete({ yield check_autocomplete({
search: "key twoKey", search: "key twoKey",
matches: [ { uri: NetUtil.newURI("http://abc/?search=twoKey"), title: "Keyword title", style: ["keyword"] }, matches: [ { uri: NetUtil.newURI("http://abc/?search=twoKey"), title: "Keyword title", style: ["keyword"] },

View File

@ -19,49 +19,49 @@ add_task(function* test_keyword_search() {
{ uri: uri2, title: "Generic page title" } ]); { uri: uri2, title: "Generic page title" } ]);
addBookmark({ uri: uri1, title: "Keyword title", keyword: "key"}); addBookmark({ uri: uri1, title: "Keyword title", keyword: "key"});
do_log_info("Plain keyword query"); do_print("Plain keyword query");
yield check_autocomplete({ yield check_autocomplete({
search: "key term", search: "key term",
searchParam: "enable-actions", searchParam: "enable-actions",
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=term", input: "key term"}), title: "Keyword title", style: [ "action", "keyword" ] } ] matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=term", input: "key term"}), title: "Keyword title", style: [ "action", "keyword" ] } ]
}); });
do_log_info("Multi-word keyword query"); do_print("Multi-word keyword query");
yield check_autocomplete({ yield check_autocomplete({
search: "key multi word", search: "key multi word",
searchParam: "enable-actions", searchParam: "enable-actions",
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=multi+word", input: "key multi word"}), title: "Keyword title", style: [ "action", "keyword" ] } ] matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=multi+word", input: "key multi word"}), title: "Keyword title", style: [ "action", "keyword" ] } ]
}); });
do_log_info("Keyword query with +"); do_print("Keyword query with +");
yield check_autocomplete({ yield check_autocomplete({
search: "key blocking+", search: "key blocking+",
searchParam: "enable-actions", searchParam: "enable-actions",
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=blocking%2B", input: "key blocking+"}), title: "Keyword title", style: [ "action", "keyword" ] } ] matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=blocking%2B", input: "key blocking+"}), title: "Keyword title", style: [ "action", "keyword" ] } ]
}); });
do_log_info("Unescaped term in query"); do_print("Unescaped term in query");
yield check_autocomplete({ yield check_autocomplete({
search: "key ユニコード", search: "key ユニコード",
searchParam: "enable-actions", searchParam: "enable-actions",
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=ユニコード", input: "key ユニコード"}), title: "Keyword title", style: [ "action", "keyword" ] } ] matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=ユニコード", input: "key ユニコード"}), title: "Keyword title", style: [ "action", "keyword" ] } ]
}); });
do_log_info("Keyword that happens to match a page"); do_print("Keyword that happens to match a page");
yield check_autocomplete({ yield check_autocomplete({
search: "key ThisPageIsInHistory", search: "key ThisPageIsInHistory",
searchParam: "enable-actions", searchParam: "enable-actions",
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=ThisPageIsInHistory", input: "key ThisPageIsInHistory"}), title: "Keyword title", style: [ "action", "keyword" ] } ] matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=ThisPageIsInHistory", input: "key ThisPageIsInHistory"}), title: "Keyword title", style: [ "action", "keyword" ] } ]
}); });
do_log_info("Keyword without query (without space)"); do_print("Keyword without query (without space)");
yield check_autocomplete({ yield check_autocomplete({
search: "key", search: "key",
searchParam: "enable-actions", searchParam: "enable-actions",
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=", input: "key"}), title: "Keyword title", style: [ "action", "keyword" ] } ] matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=", input: "key"}), title: "Keyword title", style: [ "action", "keyword" ] } ]
}); });
do_log_info("Keyword without query (with space)"); do_print("Keyword without query (with space)");
yield check_autocomplete({ yield check_autocomplete({
search: "key ", search: "key ",
searchParam: "enable-actions", searchParam: "enable-actions",
@ -73,7 +73,7 @@ add_task(function* test_keyword_search() {
yield promiseAddVisits([ { uri: uri3, title: "Generic page title" } ]); yield promiseAddVisits([ { uri: uri3, title: "Generic page title" } ]);
addBookmark({ uri: uri3, title: "Keyword title", keyword: "key"}); addBookmark({ uri: uri3, title: "Keyword title", keyword: "key"});
do_log_info("Two keywords matched"); do_print("Two keywords matched");
yield check_autocomplete({ yield check_autocomplete({
search: "key twoKey", search: "key twoKey",
searchParam: "enable-actions", searchParam: "enable-actions",

View File

@ -3,7 +3,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
add_task(function* test_non_keyword() { add_task(function* test_non_keyword() {
do_log_info("Searching for non-keyworded entry should autoFill it"); do_print("Searching for non-keyworded entry should autoFill it");
yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
addBookmark({ uri: NetUtil.newURI("http://mozilla.org/test/") }); addBookmark({ uri: NetUtil.newURI("http://mozilla.org/test/") });
@ -16,7 +16,7 @@ add_task(function* test_non_keyword() {
}); });
add_task(function* test_keyword() { add_task(function* test_keyword() {
do_log_info("Searching for keyworded entry should not autoFill it"); do_print("Searching for keyworded entry should not autoFill it");
yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
addBookmark({ uri: NetUtil.newURI("http://mozilla.org/test/"), keyword: "moz" }); addBookmark({ uri: NetUtil.newURI("http://mozilla.org/test/"), keyword: "moz" });
@ -29,7 +29,7 @@ add_task(function* test_keyword() {
}); });
add_task(function* test_more_than_keyword() { add_task(function* test_more_than_keyword() {
do_log_info("Searching for more than keyworded entry should autoFill it"); do_print("Searching for more than keyworded entry should autoFill it");
yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
addBookmark({ uri: NetUtil.newURI("http://mozilla.org/test/"), keyword: "moz" }); addBookmark({ uri: NetUtil.newURI("http://mozilla.org/test/"), keyword: "moz" });
@ -42,7 +42,7 @@ add_task(function* test_more_than_keyword() {
}); });
add_task(function* test_less_than_keyword() { add_task(function* test_less_than_keyword() {
do_log_info("Searching for less than keyworded entry should autoFill it"); do_print("Searching for less than keyworded entry should autoFill it");
yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
addBookmark({ uri: NetUtil.newURI("http://mozilla.org/test/"), keyword: "moz" }); addBookmark({ uri: NetUtil.newURI("http://mozilla.org/test/"), keyword: "moz" });
@ -55,7 +55,7 @@ add_task(function* test_less_than_keyword() {
}); });
add_task(function* test_keyword_casing() { add_task(function* test_keyword_casing() {
do_log_info("Searching for keyworded entry is case-insensitive"); do_print("Searching for keyworded entry is case-insensitive");
yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
addBookmark({ uri: NetUtil.newURI("http://mozilla.org/test/"), keyword: "moz" }); addBookmark({ uri: NetUtil.newURI("http://mozilla.org/test/"), keyword: "moz" });

View File

@ -15,32 +15,32 @@ add_task(function* test_match_beginning() {
yield promiseAddVisits([ { uri: uri1, title: "a b" }, yield promiseAddVisits([ { uri: uri1, title: "a b" },
{ uri: uri2, title: "b a" } ]); { uri: uri2, title: "b a" } ]);
do_log_info("Match at the beginning of titles"); do_print("Match at the beginning of titles");
Services.prefs.setIntPref("browser.urlbar.matchBehavior", 3); Services.prefs.setIntPref("browser.urlbar.matchBehavior", 3);
yield check_autocomplete({ yield check_autocomplete({
search: "a", search: "a",
matches: [ { uri: uri1, title: "a b" } ] matches: [ { uri: uri1, title: "a b" } ]
}); });
do_log_info("Match at the beginning of titles"); do_print("Match at the beginning of titles");
yield check_autocomplete({ yield check_autocomplete({
search: "b", search: "b",
matches: [ { uri: uri2, title: "b a" } ] matches: [ { uri: uri2, title: "b a" } ]
}); });
do_log_info("Match at the beginning of urls"); do_print("Match at the beginning of urls");
yield check_autocomplete({ yield check_autocomplete({
search: "x", search: "x",
matches: [ { uri: uri1, title: "a b" } ] matches: [ { uri: uri1, title: "a b" } ]
}); });
do_log_info("Match at the beginning of urls"); do_print("Match at the beginning of urls");
yield check_autocomplete({ yield check_autocomplete({
search: "y", search: "y",
matches: [ { uri: uri2, title: "b a" } ] matches: [ { uri: uri2, title: "b a" } ]
}); });
do_log_info("Sanity check that matching anywhere finds more"); do_print("Sanity check that matching anywhere finds more");
Services.prefs.setIntPref("browser.urlbar.matchBehavior", 1); Services.prefs.setIntPref("browser.urlbar.matchBehavior", 1);
yield check_autocomplete({ yield check_autocomplete({
search: "a", search: "a",

View File

@ -24,39 +24,39 @@ add_task(function* test_match_beginning() {
addBookmark({ uri: uri3, title: "f(o)o b<a>r" }); addBookmark({ uri: uri3, title: "f(o)o b<a>r" });
addBookmark({ uri: uri4, title: "b(a)r b<a>z" }); addBookmark({ uri: uri4, title: "b(a)r b<a>z" });
do_log_info("Match 2 terms all in url"); do_print("Match 2 terms all in url");
yield check_autocomplete({ yield check_autocomplete({
search: "c d", search: "c d",
matches: [ { uri: uri1, title: "f(o)o b<a>r" } ] matches: [ { uri: uri1, title: "f(o)o b<a>r" } ]
}); });
do_log_info("Match 1 term in url and 1 term in title"); do_print("Match 1 term in url and 1 term in title");
yield check_autocomplete({ yield check_autocomplete({
search: "b e", search: "b e",
matches: [ { uri: uri1, title: "f(o)o b<a>r" }, matches: [ { uri: uri1, title: "f(o)o b<a>r" },
{ uri: uri2, title: "b(a)r b<a>z" } ] { uri: uri2, title: "b(a)r b<a>z" } ]
}); });
do_log_info("Match 3 terms all in title; display bookmark title if matched"); do_print("Match 3 terms all in title; display bookmark title if matched");
yield check_autocomplete({ yield check_autocomplete({
search: "b a z", search: "b a z",
matches: [ { uri: uri2, title: "b(a)r b<a>z" }, matches: [ { uri: uri2, title: "b(a)r b<a>z" },
{ uri: uri4, title: "b(a)r b<a>z", style: [ "bookmark" ] } ] { uri: uri4, title: "b(a)r b<a>z", style: [ "bookmark" ] } ]
}); });
do_log_info("Match 2 terms in url and 1 in title; make sure bookmark title is used for search"); do_print("Match 2 terms in url and 1 in title; make sure bookmark title is used for search");
yield check_autocomplete({ yield check_autocomplete({
search: "k f t", search: "k f t",
matches: [ { uri: uri3, title: "f(o)o b<a>r", style: [ "bookmark" ] } ] matches: [ { uri: uri3, title: "f(o)o b<a>r", style: [ "bookmark" ] } ]
}); });
do_log_info("Match 3 terms in url and 1 in title"); do_print("Match 3 terms in url and 1 in title");
yield check_autocomplete({ yield check_autocomplete({
search: "d i g z", search: "d i g z",
matches: [ { uri: uri2, title: "b(a)r b<a>z" } ] matches: [ { uri: uri2, title: "b(a)r b<a>z" } ]
}); });
do_log_info("Match nothing"); do_print("Match nothing");
yield check_autocomplete({ yield check_autocomplete({
search: "m o z i", search: "m o z i",
matches: [ ] matches: [ ]

View File

@ -3,7 +3,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
add_task(function* test_no_slash() { add_task(function* test_no_slash() {
do_log_info("Searching for host match without slash should match host"); do_print("Searching for host match without slash should match host");
yield promiseAddVisits({ uri: NetUtil.newURI("http://file.org/test/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://file.org/test/"),
transition: TRANSITION_TYPED }, transition: TRANSITION_TYPED },
{ uri: NetUtil.newURI("file:///c:/test.html"), { uri: NetUtil.newURI("file:///c:/test.html"),
@ -17,7 +17,7 @@ add_task(function* test_no_slash() {
}); });
add_task(function* test_w_slash() { add_task(function* test_w_slash() {
do_log_info("Searching match with slash at the end should do nothing"); do_print("Searching match with slash at the end should do nothing");
yield promiseAddVisits({ uri: NetUtil.newURI("http://file.org/test/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://file.org/test/"),
transition: TRANSITION_TYPED }, transition: TRANSITION_TYPED },
{ uri: NetUtil.newURI("file:///c:/test.html"), { uri: NetUtil.newURI("file:///c:/test.html"),
@ -31,7 +31,7 @@ add_task(function* test_w_slash() {
}); });
add_task(function* test_middle() { add_task(function* test_middle() {
do_log_info("Searching match with slash in the middle should match url"); do_print("Searching match with slash in the middle should match url");
yield promiseAddVisits({ uri: NetUtil.newURI("http://file.org/test/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://file.org/test/"),
transition: TRANSITION_TYPED }, transition: TRANSITION_TYPED },
{ uri: NetUtil.newURI("file:///c:/test.html"), { uri: NetUtil.newURI("file:///c:/test.html"),
@ -45,7 +45,7 @@ add_task(function* test_middle() {
}); });
add_task(function* test_nonhost() { add_task(function* test_nonhost() {
do_log_info("Searching for non-host match without slash should not match url"); do_print("Searching for non-host match without slash should not match url");
yield promiseAddVisits({ uri: NetUtil.newURI("file:///c:/test.html"), yield promiseAddVisits({ uri: NetUtil.newURI("file:///c:/test.html"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({

View File

@ -10,28 +10,28 @@ add_task(function*() {
Services.search.addEngineWithDetails("AliasedMozSearch", "", "doit", "", Services.search.addEngineWithDetails("AliasedMozSearch", "", "doit", "",
"GET", "http://s.example.com/search"); "GET", "http://s.example.com/search");
do_log_info("search engine"); do_print("search engine");
yield check_autocomplete({ yield check_autocomplete({
search: "mozilla", search: "mozilla",
searchParam: "enable-actions", searchParam: "enable-actions",
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: "mozilla", searchQuery: "mozilla"}), title: "MozSearch", style: [ "action", "searchengine" ] }, ] matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: "mozilla", searchQuery: "mozilla"}), title: "MozSearch", style: [ "action", "searchengine" ] }, ]
}); });
do_log_info("search engine, uri-like input"); do_print("search engine, uri-like input");
yield check_autocomplete({ yield check_autocomplete({
search: "http:///", search: "http:///",
searchParam: "enable-actions", searchParam: "enable-actions",
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: "http:///", searchQuery: "http:///"}), title: "MozSearch", style: [ "action", "searchengine" ] }, ] matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: "http:///", searchQuery: "http:///"}), title: "MozSearch", style: [ "action", "searchengine" ] }, ]
}); });
do_log_info("search engine, multiple words"); do_print("search engine, multiple words");
yield check_autocomplete({ yield check_autocomplete({
search: "mozzarella cheese", search: "mozzarella cheese",
searchParam: "enable-actions", searchParam: "enable-actions",
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: "mozzarella cheese", searchQuery: "mozzarella cheese"}), title: "MozSearch", style: [ "action", "searchengine" ] }, ] matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: "mozzarella cheese", searchQuery: "mozzarella cheese"}), title: "MozSearch", style: [ "action", "searchengine" ] }, ]
}); });
do_log_info("search engine, after current engine has changed"); do_print("search engine, after current engine has changed");
Services.search.addEngineWithDetails("MozSearch2", "", "", "", "GET", Services.search.addEngineWithDetails("MozSearch2", "", "", "", "GET",
"http://s.example.com/search2"); "http://s.example.com/search2");
engine = Services.search.getEngineByName("MozSearch2"); engine = Services.search.getEngineByName("MozSearch2");

View File

@ -55,7 +55,7 @@ add_task(function* test_searchEngine_autoFill() {
yield promiseAsyncUpdates(); yield promiseAsyncUpdates();
ok(frecencyForUrl(uri) > 10000, "Added URI should have expected high frecency"); ok(frecencyForUrl(uri) > 10000, "Added URI should have expected high frecency");
do_log_info("Check search domain is autoFilled even if there's an higher frecency match"); do_print("Check search domain is autoFilled even if there's an higher frecency match");
yield check_autocomplete({ yield check_autocomplete({
search: "my", search: "my",
autofilled: "my.search.com", autofilled: "my.search.com",

View File

@ -14,7 +14,7 @@ add_task(function* test_searchEngine() {
yield promiseAddVisits({ uri: uri1, title: "Terms - SearchEngine Search" }); yield promiseAddVisits({ uri: uri1, title: "Terms - SearchEngine Search" });
addBookmark({ uri: uri2, title: "Terms - SearchEngine Search" }); addBookmark({ uri: uri2, title: "Terms - SearchEngine Search" });
do_log_info("Past search terms should be styled, unless bookmarked"); do_print("Past search terms should be styled, unless bookmarked");
Services.prefs.setBoolPref("browser.urlbar.restyleSearches", true); Services.prefs.setBoolPref("browser.urlbar.restyleSearches", true);
yield check_autocomplete({ yield check_autocomplete({
search: "term", search: "term",
@ -22,7 +22,7 @@ add_task(function* test_searchEngine() {
{ uri: uri2, title: "Terms - SearchEngine Search", style: ["bookmark"] } ] { uri: uri2, title: "Terms - SearchEngine Search", style: ["bookmark"] } ]
}); });
do_log_info("Past search terms should not be styled if restyling is disabled"); do_print("Past search terms should not be styled if restyling is disabled");
Services.prefs.setBoolPref("browser.urlbar.restyleSearches", false); Services.prefs.setBoolPref("browser.urlbar.restyleSearches", false);
yield check_autocomplete({ yield check_autocomplete({
search: "term", search: "term",

View File

@ -45,7 +45,7 @@ add_task(function* test_special_searches() {
addBookmark( { uri: uri12, title: "foo.bar", tags: [ "foo.bar" ] } ); addBookmark( { uri: uri12, title: "foo.bar", tags: [ "foo.bar" ] } );
// Test restricting searches // Test restricting searches
do_log_info("History restrict"); do_print("History restrict");
yield check_autocomplete({ yield check_autocomplete({
search: "^", search: "^",
matches: [ { uri: uri1, title: "title" }, matches: [ { uri: uri1, title: "title" },
@ -56,7 +56,7 @@ add_task(function* test_special_searches() {
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ] { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ]
}); });
do_log_info("Star restrict"); do_print("Star restrict");
yield check_autocomplete({ yield check_autocomplete({
search: "*", search: "*",
matches: [ { uri: uri5, title: "title", style: [ "bookmark" ] }, matches: [ { uri: uri5, title: "title", style: [ "bookmark" ] },
@ -69,7 +69,7 @@ add_task(function* test_special_searches() {
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ] { uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ]
}); });
do_log_info("Tag restrict"); do_print("Tag restrict");
yield check_autocomplete({ yield check_autocomplete({
search: "+", search: "+",
matches: [ { uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] }, matches: [ { uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
@ -79,7 +79,7 @@ add_task(function* test_special_searches() {
}); });
// Test specials as any word position // Test specials as any word position
do_log_info("Special as first word"); do_print("Special as first word");
yield check_autocomplete({ yield check_autocomplete({
search: "^ foo bar", search: "^ foo bar",
matches: [ { uri: uri2, title: "foo.bar" }, matches: [ { uri: uri2, title: "foo.bar" },
@ -89,7 +89,7 @@ add_task(function* test_special_searches() {
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ] { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ]
}); });
do_log_info("Special as middle word"); do_print("Special as middle word");
yield check_autocomplete({ yield check_autocomplete({
search: "foo ^ bar", search: "foo ^ bar",
matches: [ { uri: uri2, title: "foo.bar" }, matches: [ { uri: uri2, title: "foo.bar" },
@ -99,7 +99,7 @@ add_task(function* test_special_searches() {
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ] { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ]
}); });
do_log_info("Special as last word"); do_print("Special as last word");
yield check_autocomplete({ yield check_autocomplete({
search: "foo bar ^", search: "foo bar ^",
matches: [ { uri: uri2, title: "foo.bar" }, matches: [ { uri: uri2, title: "foo.bar" },
@ -110,7 +110,7 @@ add_task(function* test_special_searches() {
}); });
// Test restricting and matching searches with a term // Test restricting and matching searches with a term
do_log_info("foo ^ -> history"); do_print("foo ^ -> history");
yield check_autocomplete({ yield check_autocomplete({
search: "foo ^", search: "foo ^",
matches: [ { uri: uri2, title: "foo.bar" }, matches: [ { uri: uri2, title: "foo.bar" },
@ -120,7 +120,7 @@ add_task(function* test_special_searches() {
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ] { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ]
}); });
do_log_info("foo | -> history (change pref)"); do_print("foo | -> history (change pref)");
changeRestrict("history", "|"); changeRestrict("history", "|");
yield check_autocomplete({ yield check_autocomplete({
search: "foo |", search: "foo |",
@ -131,7 +131,7 @@ add_task(function* test_special_searches() {
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ] { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ]
}); });
do_log_info("foo * -> is star"); do_print("foo * -> is star");
resetRestrict("history"); resetRestrict("history");
yield check_autocomplete({ yield check_autocomplete({
search: "foo *", search: "foo *",
@ -144,7 +144,7 @@ add_task(function* test_special_searches() {
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ] { uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ]
}); });
do_log_info("foo | -> is star (change pref)"); do_print("foo | -> is star (change pref)");
changeRestrict("bookmark", "|"); changeRestrict("bookmark", "|");
yield check_autocomplete({ yield check_autocomplete({
search: "foo |", search: "foo |",
@ -157,7 +157,7 @@ add_task(function* test_special_searches() {
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ] { uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ]
}); });
do_log_info("foo # -> in title"); do_print("foo # -> in title");
resetRestrict("bookmark"); resetRestrict("bookmark");
yield check_autocomplete({ yield check_autocomplete({
search: "foo #", search: "foo #",
@ -171,7 +171,7 @@ add_task(function* test_special_searches() {
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ] { uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
}); });
do_log_info("foo | -> in title (change pref)"); do_print("foo | -> in title (change pref)");
changeRestrict("title", "|"); changeRestrict("title", "|");
yield check_autocomplete({ yield check_autocomplete({
search: "foo |", search: "foo |",
@ -185,7 +185,7 @@ add_task(function* test_special_searches() {
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ] { uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
}); });
do_log_info("foo @ -> in url"); do_print("foo @ -> in url");
resetRestrict("title"); resetRestrict("title");
yield check_autocomplete({ yield check_autocomplete({
search: "foo @", search: "foo @",
@ -197,7 +197,7 @@ add_task(function* test_special_searches() {
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ] { uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
}); });
do_log_info("foo | -> in url (change pref)"); do_print("foo | -> in url (change pref)");
changeRestrict("url", "|"); changeRestrict("url", "|");
yield check_autocomplete({ yield check_autocomplete({
search: "foo |", search: "foo |",
@ -209,7 +209,7 @@ add_task(function* test_special_searches() {
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ] { uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
}); });
do_log_info("foo + -> is tag"); do_print("foo + -> is tag");
resetRestrict("url"); resetRestrict("url");
yield check_autocomplete({ yield check_autocomplete({
search: "foo +", search: "foo +",
@ -219,7 +219,7 @@ add_task(function* test_special_searches() {
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ] { uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
}); });
do_log_info("foo | -> is tag (change pref)"); do_print("foo | -> is tag (change pref)");
changeRestrict("tag", "|"); changeRestrict("tag", "|");
yield check_autocomplete({ yield check_autocomplete({
search: "foo |", search: "foo |",
@ -229,7 +229,7 @@ add_task(function* test_special_searches() {
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ] { uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
}); });
do_log_info("foo ~ -> is typed"); do_print("foo ~ -> is typed");
resetRestrict("tag"); resetRestrict("tag");
yield check_autocomplete({ yield check_autocomplete({
search: "foo ~", search: "foo ~",
@ -237,7 +237,7 @@ add_task(function* test_special_searches() {
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ] { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ]
}); });
do_log_info("foo | -> is typed (change pref)"); do_print("foo | -> is typed (change pref)");
changeRestrict("typed", "|"); changeRestrict("typed", "|");
yield check_autocomplete({ yield check_autocomplete({
search: "foo |", search: "foo |",
@ -246,7 +246,7 @@ add_task(function* test_special_searches() {
}); });
// Test various pairs of special searches // Test various pairs of special searches
do_log_info("foo ^ * -> history, is star"); do_print("foo ^ * -> history, is star");
resetRestrict("typed"); resetRestrict("typed");
yield check_autocomplete({ yield check_autocomplete({
search: "foo ^ *", search: "foo ^ *",
@ -254,7 +254,7 @@ add_task(function* test_special_searches() {
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ] { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ]
}); });
do_log_info("foo ^ # -> history, in title"); do_print("foo ^ # -> history, in title");
yield check_autocomplete({ yield check_autocomplete({
search: "foo ^ #", search: "foo ^ #",
matches: [ { uri: uri2, title: "foo.bar" }, matches: [ { uri: uri2, title: "foo.bar" },
@ -263,7 +263,7 @@ add_task(function* test_special_searches() {
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ] { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ]
}); });
do_log_info("foo ^ @ -> history, in url"); do_print("foo ^ @ -> history, in url");
yield check_autocomplete({ yield check_autocomplete({
search: "foo ^ @", search: "foo ^ @",
matches: [ { uri: uri3, title: "title" }, matches: [ { uri: uri3, title: "title" },
@ -271,20 +271,20 @@ add_task(function* test_special_searches() {
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ] { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ]
}); });
do_log_info("foo ^ + -> history, is tag"); do_print("foo ^ + -> history, is tag");
yield check_autocomplete({ yield check_autocomplete({
search: "foo ^ +", search: "foo ^ +",
matches: [ { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ] matches: [ { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ]
}); });
do_log_info("foo ^ ~ -> history, is typed"); do_print("foo ^ ~ -> history, is typed");
yield check_autocomplete({ yield check_autocomplete({
search: "foo ^ ~", search: "foo ^ ~",
matches: [ { uri: uri4, title: "foo.bar" }, matches: [ { uri: uri4, title: "foo.bar" },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ] { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ]
}); });
do_log_info("foo * # -> is star, in title"); do_print("foo * # -> is star, in title");
yield check_autocomplete({ yield check_autocomplete({
search: "foo * #", search: "foo * #",
matches: [ { uri: uri6, title: "foo.bar", style: [ "bookmark" ] }, matches: [ { uri: uri6, title: "foo.bar", style: [ "bookmark" ] },
@ -295,7 +295,7 @@ add_task(function* test_special_searches() {
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ] { uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ]
}); });
do_log_info("foo * @ -> is star, in url"); do_print("foo * @ -> is star, in url");
yield check_autocomplete({ yield check_autocomplete({
search: "foo * @", search: "foo * @",
matches: [ { uri: uri7, title: "title", style: [ "bookmark" ] }, matches: [ { uri: uri7, title: "title", style: [ "bookmark" ] },
@ -304,7 +304,7 @@ add_task(function* test_special_searches() {
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ] { uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ]
}); });
do_log_info("foo * + -> same as +"); do_print("foo * + -> same as +");
yield check_autocomplete({ yield check_autocomplete({
search: "foo * +", search: "foo * +",
matches: [ { uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] }, matches: [ { uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] },
@ -313,13 +313,13 @@ add_task(function* test_special_searches() {
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ] { uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ]
}); });
do_log_info("foo * ~ -> is star, is typed"); do_print("foo * ~ -> is star, is typed");
yield check_autocomplete({ yield check_autocomplete({
search: "foo * ~", search: "foo * ~",
matches: [ { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ] matches: [ { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ]
}); });
do_log_info("foo # @ -> in title, in url"); do_print("foo # @ -> in title, in url");
yield check_autocomplete({ yield check_autocomplete({
search: "foo # @", search: "foo # @",
matches: [ { uri: uri4, title: "foo.bar" }, matches: [ { uri: uri4, title: "foo.bar" },
@ -328,7 +328,7 @@ add_task(function* test_special_searches() {
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ] { uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
}); });
do_log_info("foo # + -> in title, is tag"); do_print("foo # + -> in title, is tag");
yield check_autocomplete({ yield check_autocomplete({
search: "foo # +", search: "foo # +",
matches: [ { uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] }, matches: [ { uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
@ -337,28 +337,28 @@ add_task(function* test_special_searches() {
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ] { uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
}); });
do_log_info("foo # ~ -> in title, is typed"); do_print("foo # ~ -> in title, is typed");
yield check_autocomplete({ yield check_autocomplete({
search: "foo # ~", search: "foo # ~",
matches: [ { uri: uri4, title: "foo.bar" }, matches: [ { uri: uri4, title: "foo.bar" },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ] { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ]
}); });
do_log_info("foo @ + -> in url, is tag"); do_print("foo @ + -> in url, is tag");
yield check_autocomplete({ yield check_autocomplete({
search: "foo @ +", search: "foo @ +",
matches: [ { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] }, matches: [ { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ] { uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
}); });
do_log_info("foo @ ~ -> in url, is typed"); do_print("foo @ ~ -> in url, is typed");
yield check_autocomplete({ yield check_autocomplete({
search: "foo @ ~", search: "foo @ ~",
matches: [ { uri: uri4, title: "foo.bar" }, matches: [ { uri: uri4, title: "foo.bar" },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ] { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ]
}); });
do_log_info("foo + ~ -> is tag, is typed"); do_print("foo + ~ -> is tag, is typed");
yield check_autocomplete({ yield check_autocomplete({
search: "foo + ~", search: "foo + ~",
matches: [ { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ] matches: [ { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ]
@ -369,7 +369,7 @@ add_task(function* test_special_searches() {
Services.prefs.setBoolPref("browser.urlbar.autoFill", false); Services.prefs.setBoolPref("browser.urlbar.autoFill", false);
// Test default usage by setting certain browser.urlbar.suggest.* prefs // Test default usage by setting certain browser.urlbar.suggest.* prefs
do_log_info("foo -> default history"); do_print("foo -> default history");
setSuggestPrefsToFalse(); setSuggestPrefsToFalse();
Services.prefs.setBoolPref("browser.urlbar.suggest.history", true); Services.prefs.setBoolPref("browser.urlbar.suggest.history", true);
yield check_autocomplete({ yield check_autocomplete({
@ -381,7 +381,7 @@ add_task(function* test_special_searches() {
{ uri: uri11, title: "title", tags: ["foo.bar"], style: [ "tag" ] } ] { uri: uri11, title: "title", tags: ["foo.bar"], style: [ "tag" ] } ]
}); });
do_log_info("foo -> default history, is star"); do_print("foo -> default history, is star");
setSuggestPrefsToFalse(); setSuggestPrefsToFalse();
Services.prefs.setBoolPref("browser.urlbar.suggest.history", true); Services.prefs.setBoolPref("browser.urlbar.suggest.history", true);
Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", true); Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", true);
@ -399,7 +399,7 @@ add_task(function* test_special_searches() {
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ] { uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ]
}); });
do_log_info("foo -> default history, is star, is typed"); do_print("foo -> default history, is star, is typed");
setSuggestPrefsToFalse(); setSuggestPrefsToFalse();
Services.prefs.setBoolPref("browser.urlbar.suggest.history", true); Services.prefs.setBoolPref("browser.urlbar.suggest.history", true);
Services.prefs.setBoolPref("browser.urlbar.suggest.history.onlyTyped", true); Services.prefs.setBoolPref("browser.urlbar.suggest.history.onlyTyped", true);
@ -410,7 +410,7 @@ add_task(function* test_special_searches() {
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ] { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ]
}); });
do_log_info("foo -> is star"); do_print("foo -> is star");
setSuggestPrefsToFalse(); setSuggestPrefsToFalse();
Services.prefs.setBoolPref("browser.urlbar.suggest.history", false); Services.prefs.setBoolPref("browser.urlbar.suggest.history", false);
Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", true); Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", true);
@ -425,7 +425,7 @@ add_task(function* test_special_searches() {
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ] { uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ]
}); });
do_log_info("foo -> is star, is typed"); do_print("foo -> is star, is typed");
setSuggestPrefsToFalse(); setSuggestPrefsToFalse();
// only typed should be ignored // only typed should be ignored
Services.prefs.setBoolPref("browser.urlbar.suggest.history.onlyTyped", true); Services.prefs.setBoolPref("browser.urlbar.suggest.history.onlyTyped", true);

View File

@ -42,106 +42,106 @@ add_task(function* test_swap_protocol() {
Services.prefs.setBoolPref("browser.urlbar.autoFill", "false"); Services.prefs.setBoolPref("browser.urlbar.autoFill", "false");
Services.prefs.setBoolPref("browser.urlbar.autoFill.searchEngines", false); Services.prefs.setBoolPref("browser.urlbar.autoFill.searchEngines", false);
do_log_info("http://www.site matches all site"); do_print("http://www.site matches all site");
yield check_autocomplete({ yield check_autocomplete({
search: "http://www.site", search: "http://www.site",
matches: allMatches matches: allMatches
}); });
do_log_info("http://site matches all site"); do_print("http://site matches all site");
yield check_autocomplete({ yield check_autocomplete({
search: "http://site", search: "http://site",
matches: allMatches matches: allMatches
}); });
do_log_info("ftp://ftp.site matches itself"); do_print("ftp://ftp.site matches itself");
yield check_autocomplete({ yield check_autocomplete({
search: "ftp://ftp.site", search: "ftp://ftp.site",
matches: [ { uri: uri3, title: "title" } ] matches: [ { uri: uri3, title: "title" } ]
}); });
do_log_info("ftp://site matches all site"); do_print("ftp://site matches all site");
yield check_autocomplete({ yield check_autocomplete({
search: "ftp://site", search: "ftp://site",
matches: allMatches matches: allMatches
}); });
do_log_info("https://www.site matches all site"); do_print("https://www.site matches all site");
yield check_autocomplete({ yield check_autocomplete({
search: "https://www.site", search: "https://www.site",
matches: allMatches matches: allMatches
}); });
do_log_info("https://site matches all site"); do_print("https://site matches all site");
yield check_autocomplete({ yield check_autocomplete({
search: "https://site", search: "https://site",
matches: allMatches matches: allMatches
}); });
do_log_info("www.site matches all site"); do_print("www.site matches all site");
yield check_autocomplete({ yield check_autocomplete({
search: "www.site", search: "www.site",
matches: allMatches matches: allMatches
}); });
do_log_info("w matches none of www."); do_print("w matches none of www.");
yield check_autocomplete({ yield check_autocomplete({
search: "w", search: "w",
matches: [ { uri: uri7, title: "title" }, matches: [ { uri: uri7, title: "title" },
{ uri: uri8, title: "title" } ] { uri: uri8, title: "title" } ]
}); });
do_log_info("http://w matches none of www."); do_print("http://w matches none of www.");
yield check_autocomplete({ yield check_autocomplete({
search: "http://w", search: "http://w",
matches: [ { uri: uri7, title: "title" }, matches: [ { uri: uri7, title: "title" },
{ uri: uri8, title: "title" } ] { uri: uri8, title: "title" } ]
}); });
do_log_info("http://w matches none of www."); do_print("http://w matches none of www.");
yield check_autocomplete({ yield check_autocomplete({
search: "http://www.w", search: "http://www.w",
matches: [ { uri: uri7, title: "title" }, matches: [ { uri: uri7, title: "title" },
{ uri: uri8, title: "title" } ] { uri: uri8, title: "title" } ]
}); });
do_log_info("ww matches none of www."); do_print("ww matches none of www.");
yield check_autocomplete({ yield check_autocomplete({
search: "ww", search: "ww",
matches: [ { uri: uri8, title: "title" } ] matches: [ { uri: uri8, title: "title" } ]
}); });
do_log_info("ww matches none of www."); do_print("ww matches none of www.");
yield check_autocomplete({ yield check_autocomplete({
search: "ww", search: "ww",
matches: [ { uri: uri8, title: "title" } ] matches: [ { uri: uri8, title: "title" } ]
}); });
do_log_info("http://ww matches none of www."); do_print("http://ww matches none of www.");
yield check_autocomplete({ yield check_autocomplete({
search: "http://ww", search: "http://ww",
matches: [ { uri: uri8, title: "title" } ] matches: [ { uri: uri8, title: "title" } ]
}); });
do_log_info("http://www.ww matches none of www."); do_print("http://www.ww matches none of www.");
yield check_autocomplete({ yield check_autocomplete({
search: "http://www.ww", search: "http://www.ww",
matches: [ { uri: uri8, title: "title" } ] matches: [ { uri: uri8, title: "title" } ]
}); });
do_log_info("www matches none of www."); do_print("www matches none of www.");
yield check_autocomplete({ yield check_autocomplete({
search: "www", search: "www",
matches: [ { uri: uri8, title: "title" } ] matches: [ { uri: uri8, title: "title" } ]
}); });
do_log_info("http://www matches none of www."); do_print("http://www matches none of www.");
yield check_autocomplete({ yield check_autocomplete({
search: "http://www", search: "http://www",
matches: [ { uri: uri8, title: "title" } ] matches: [ { uri: uri8, title: "title" } ]
}); });
do_log_info("http://www.www matches none of www."); do_print("http://www.www matches none of www.");
yield check_autocomplete({ yield check_autocomplete({
search: "http://www.www", search: "http://www.www",
matches: [ { uri: uri8, title: "title" } ] matches: [ { uri: uri8, title: "title" } ]

View File

@ -23,7 +23,7 @@ add_task(function* test_tab_matches() {
addOpenPages(uri3, 1); addOpenPages(uri3, 1);
addOpenPages(uri4, 1); addOpenPages(uri4, 1);
do_log_info("two results, normal result is a tab match"); do_print("two results, normal result is a tab match");
yield check_autocomplete({ yield check_autocomplete({
search: "abc.com", search: "abc.com",
searchParam: "enable-actions", searchParam: "enable-actions",
@ -31,7 +31,7 @@ add_task(function* test_tab_matches() {
{ uri: makeActionURI("switchtab", {url: "http://abc.com/"}), title: "ABC rocks", style: [ "action", "switchtab" ] } ] { uri: makeActionURI("switchtab", {url: "http://abc.com/"}), title: "ABC rocks", style: [ "action", "switchtab" ] } ]
}); });
do_log_info("three results, one tab match"); do_print("three results, one tab match");
yield check_autocomplete({ yield check_autocomplete({
search: "abc", search: "abc",
searchParam: "enable-actions", searchParam: "enable-actions",
@ -40,7 +40,7 @@ add_task(function* test_tab_matches() {
{ uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] } ] { uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] } ]
}); });
do_log_info("three results, both normal results are tab matches"); do_print("three results, both normal results are tab matches");
addOpenPages(uri2, 1); addOpenPages(uri2, 1);
yield check_autocomplete({ yield check_autocomplete({
search: "abc", search: "abc",
@ -50,7 +50,7 @@ add_task(function* test_tab_matches() {
{ uri: makeActionURI("switchtab", {url: "http://xyz.net/"}), title: "xyz.net - we're better than ABC", style: [ "action", "switchtab" ] } ] { uri: makeActionURI("switchtab", {url: "http://xyz.net/"}), title: "xyz.net - we're better than ABC", style: [ "action", "switchtab" ] } ]
}); });
do_log_info("three results, both normal results are tab matches, one has multiple tabs"); do_print("three results, both normal results are tab matches, one has multiple tabs");
addOpenPages(uri2, 5); addOpenPages(uri2, 5);
yield check_autocomplete({ yield check_autocomplete({
search: "abc", search: "abc",
@ -60,7 +60,7 @@ add_task(function* test_tab_matches() {
{ uri: makeActionURI("switchtab", {url: "http://xyz.net/"}), title: "xyz.net - we're better than ABC", style: [ "action", "switchtab" ] } ] { uri: makeActionURI("switchtab", {url: "http://xyz.net/"}), title: "xyz.net - we're better than ABC", style: [ "action", "switchtab" ] } ]
}); });
do_log_info("three results, no tab matches (disable-private-actions)"); do_print("three results, no tab matches (disable-private-actions)");
yield check_autocomplete({ yield check_autocomplete({
search: "abc", search: "abc",
searchParam: "enable-actions disable-private-actions", searchParam: "enable-actions disable-private-actions",
@ -69,7 +69,7 @@ add_task(function* test_tab_matches() {
{ uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] } ] { uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] } ]
}); });
do_log_info("two results (actions disabled)"); do_print("two results (actions disabled)");
yield check_autocomplete({ yield check_autocomplete({
search: "abc", search: "abc",
searchParam: "", searchParam: "",
@ -77,7 +77,7 @@ add_task(function* test_tab_matches() {
{ uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] } ] { uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] } ]
}); });
do_log_info("three results, no tab matches"); do_print("three results, no tab matches");
removeOpenPages(uri1, 1); removeOpenPages(uri1, 1);
removeOpenPages(uri2, 6); removeOpenPages(uri2, 6);
yield check_autocomplete({ yield check_autocomplete({
@ -88,7 +88,7 @@ add_task(function* test_tab_matches() {
{ uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] } ] { uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] } ]
}); });
do_log_info("tab match search with restriction character"); do_print("tab match search with restriction character");
addOpenPages(uri1, 1); addOpenPages(uri1, 1);
yield check_autocomplete({ yield check_autocomplete({
search: gTabRestrictChar + " abc", search: gTabRestrictChar + " abc",
@ -97,7 +97,7 @@ add_task(function* test_tab_matches() {
{ uri: makeActionURI("switchtab", {url: "http://abc.com/"}), title: "ABC rocks", style: [ "action", "switchtab" ] } ] { uri: makeActionURI("switchtab", {url: "http://abc.com/"}), title: "ABC rocks", style: [ "action", "switchtab" ] } ]
}); });
do_log_info("tab match with not-addable pages"); do_print("tab match with not-addable pages");
yield check_autocomplete({ yield check_autocomplete({
search: "mozilla", search: "mozilla",
searchParam: "enable-actions", searchParam: "enable-actions",
@ -105,7 +105,7 @@ add_task(function* test_tab_matches() {
{ uri: makeActionURI("switchtab", {url: "about:mozilla"}), title: "about:mozilla", style: [ "action", "switchtab" ] } ] { uri: makeActionURI("switchtab", {url: "about:mozilla"}), title: "about:mozilla", style: [ "action", "switchtab" ] } ]
}); });
do_log_info("tab match with not-addable pages and restriction character"); do_print("tab match with not-addable pages and restriction character");
yield check_autocomplete({ yield check_autocomplete({
search: gTabRestrictChar + " mozilla", search: gTabRestrictChar + " mozilla",
searchParam: "enable-actions", searchParam: "enable-actions",
@ -113,7 +113,7 @@ add_task(function* test_tab_matches() {
{ uri: makeActionURI("switchtab", {url: "about:mozilla"}), title: "about:mozilla", style: [ "action", "switchtab" ] } ] { uri: makeActionURI("switchtab", {url: "about:mozilla"}), title: "about:mozilla", style: [ "action", "switchtab" ] } ]
}); });
do_log_info("tab match with not-addable pages and only restriction character"); do_print("tab match with not-addable pages and only restriction character");
yield check_autocomplete({ yield check_autocomplete({
search: gTabRestrictChar, search: gTabRestrictChar,
searchParam: "enable-actions", searchParam: "enable-actions",

View File

@ -3,7 +3,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
add_task(function* test_untrimmed_secure_www() { add_task(function* test_untrimmed_secure_www() {
do_log_info("Searching for untrimmed https://www entry"); do_print("Searching for untrimmed https://www entry");
yield promiseAddVisits({ uri: NetUtil.newURI("https://www.mozilla.org/test/"), yield promiseAddVisits({ uri: NetUtil.newURI("https://www.mozilla.org/test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({
@ -15,7 +15,7 @@ add_task(function* test_untrimmed_secure_www() {
}); });
add_task(function* test_untrimmed_secure_www_path() { add_task(function* test_untrimmed_secure_www_path() {
do_log_info("Searching for untrimmed https://www entry with path"); do_print("Searching for untrimmed https://www entry with path");
yield promiseAddVisits({ uri: NetUtil.newURI("https://www.mozilla.org/test/"), yield promiseAddVisits({ uri: NetUtil.newURI("https://www.mozilla.org/test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({
@ -27,7 +27,7 @@ add_task(function* test_untrimmed_secure_www_path() {
}); });
add_task(function* test_untrimmed_secure() { add_task(function* test_untrimmed_secure() {
do_log_info("Searching for untrimmed https:// entry"); do_print("Searching for untrimmed https:// entry");
yield promiseAddVisits({ uri: NetUtil.newURI("https://mozilla.org/test/"), yield promiseAddVisits({ uri: NetUtil.newURI("https://mozilla.org/test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({
@ -39,7 +39,7 @@ add_task(function* test_untrimmed_secure() {
}); });
add_task(function* test_untrimmed_secure_path() { add_task(function* test_untrimmed_secure_path() {
do_log_info("Searching for untrimmed https:// entry with path"); do_print("Searching for untrimmed https:// entry with path");
yield promiseAddVisits({ uri: NetUtil.newURI("https://mozilla.org/test/"), yield promiseAddVisits({ uri: NetUtil.newURI("https://mozilla.org/test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({
@ -51,7 +51,7 @@ add_task(function* test_untrimmed_secure_path() {
}); });
add_task(function* test_untrimmed_www() { add_task(function* test_untrimmed_www() {
do_log_info("Searching for untrimmed http://www entry"); do_print("Searching for untrimmed http://www entry");
yield promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({
@ -63,7 +63,7 @@ add_task(function* test_untrimmed_www() {
}); });
add_task(function* test_untrimmed_www_path() { add_task(function* test_untrimmed_www_path() {
do_log_info("Searching for untrimmed http://www entry with path"); do_print("Searching for untrimmed http://www entry with path");
yield promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({
@ -75,7 +75,7 @@ add_task(function* test_untrimmed_www_path() {
}); });
add_task(function* test_untrimmed_ftp() { add_task(function* test_untrimmed_ftp() {
do_log_info("Searching for untrimmed ftp:// entry"); do_print("Searching for untrimmed ftp:// entry");
yield promiseAddVisits({ uri: NetUtil.newURI("ftp://mozilla.org/test/"), yield promiseAddVisits({ uri: NetUtil.newURI("ftp://mozilla.org/test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({
@ -87,7 +87,7 @@ add_task(function* test_untrimmed_ftp() {
}); });
add_task(function* test_untrimmed_ftp_path() { add_task(function* test_untrimmed_ftp_path() {
do_log_info("Searching for untrimmed ftp:// entry with path"); do_print("Searching for untrimmed ftp:// entry with path");
yield promiseAddVisits({ uri: NetUtil.newURI("ftp://mozilla.org/test/"), yield promiseAddVisits({ uri: NetUtil.newURI("ftp://mozilla.org/test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({
@ -99,7 +99,7 @@ add_task(function* test_untrimmed_ftp_path() {
}); });
add_task(function* test_priority_1() { add_task(function* test_priority_1() {
do_log_info("Ensuring correct priority 1"); do_print("Ensuring correct priority 1");
yield promiseAddVisits([{ uri: NetUtil.newURI("https://www.mozilla.org/test/"), yield promiseAddVisits([{ uri: NetUtil.newURI("https://www.mozilla.org/test/"),
transition: TRANSITION_TYPED }, transition: TRANSITION_TYPED },
{ uri: NetUtil.newURI("https://mozilla.org/test/"), { uri: NetUtil.newURI("https://mozilla.org/test/"),
@ -119,7 +119,7 @@ add_task(function* test_priority_1() {
}); });
add_task(function* test_periority_2() { add_task(function* test_periority_2() {
do_log_info( "Ensuring correct priority 2"); do_print( "Ensuring correct priority 2");
yield promiseAddVisits([{ uri: NetUtil.newURI("https://mozilla.org/test/"), yield promiseAddVisits([{ uri: NetUtil.newURI("https://mozilla.org/test/"),
transition: TRANSITION_TYPED }, transition: TRANSITION_TYPED },
{ uri: NetUtil.newURI("ftp://mozilla.org/test/"), { uri: NetUtil.newURI("ftp://mozilla.org/test/"),
@ -137,7 +137,7 @@ add_task(function* test_periority_2() {
}); });
add_task(function* test_periority_3() { add_task(function* test_periority_3() {
do_log_info("Ensuring correct priority 3"); do_print("Ensuring correct priority 3");
yield promiseAddVisits([{ uri: NetUtil.newURI("ftp://mozilla.org/test/"), yield promiseAddVisits([{ uri: NetUtil.newURI("ftp://mozilla.org/test/"),
transition: TRANSITION_TYPED }, transition: TRANSITION_TYPED },
{ uri: NetUtil.newURI("http://www.mozilla.org/test/"), { uri: NetUtil.newURI("http://www.mozilla.org/test/"),
@ -153,7 +153,7 @@ add_task(function* test_periority_3() {
}); });
add_task(function* test_periority_4() { add_task(function* test_periority_4() {
do_log_info("Ensuring correct priority 4"); do_print("Ensuring correct priority 4");
yield promiseAddVisits([{ uri: NetUtil.newURI("http://www.mozilla.org/test/"), yield promiseAddVisits([{ uri: NetUtil.newURI("http://www.mozilla.org/test/"),
transition: TRANSITION_TYPED }, transition: TRANSITION_TYPED },
{ uri: NetUtil.newURI("http://mozilla.org/test/"), { uri: NetUtil.newURI("http://mozilla.org/test/"),
@ -167,7 +167,7 @@ add_task(function* test_periority_4() {
}); });
add_task(function* test_priority_5() { add_task(function* test_priority_5() {
do_log_info("Ensuring correct priority 5"); do_print("Ensuring correct priority 5");
yield promiseAddVisits([{ uri: NetUtil.newURI("ftp://mozilla.org/test/"), yield promiseAddVisits([{ uri: NetUtil.newURI("ftp://mozilla.org/test/"),
transition: TRANSITION_TYPED }, transition: TRANSITION_TYPED },
{ uri: NetUtil.newURI("ftp://www.mozilla.org/test/"), { uri: NetUtil.newURI("ftp://www.mozilla.org/test/"),
@ -181,7 +181,7 @@ add_task(function* test_priority_5() {
}); });
add_task(function* test_priority_6() { add_task(function* test_priority_6() {
do_log_info("Ensuring correct priority 6"); do_print("Ensuring correct priority 6");
yield promiseAddVisits([{ uri: NetUtil.newURI("http://www.mozilla.org/test1/"), yield promiseAddVisits([{ uri: NetUtil.newURI("http://www.mozilla.org/test1/"),
transition: TRANSITION_TYPED }, transition: TRANSITION_TYPED },
{ uri: NetUtil.newURI("http://www.mozilla.org/test2/"), { uri: NetUtil.newURI("http://www.mozilla.org/test2/"),
@ -195,7 +195,7 @@ add_task(function* test_priority_6() {
}); });
add_task(function* test_longer_domain() { add_task(function* test_longer_domain() {
do_log_info("Ensuring longer domain can't match"); do_print("Ensuring longer domain can't match");
// The .co should be preferred, but should not get the https from the .com. // The .co should be preferred, but should not get the https from the .com.
// The .co domain must be added later to activate the trigger bug. // The .co domain must be added later to activate the trigger bug.
yield promiseAddVisits([{ uri: NetUtil.newURI("https://mozilla.com/"), yield promiseAddVisits([{ uri: NetUtil.newURI("https://mozilla.com/"),
@ -214,7 +214,7 @@ add_task(function* test_longer_domain() {
}); });
add_task(function* test_escaped_chars() { add_task(function* test_escaped_chars() {
do_log_info("Searching for URL with characters that are normally escaped"); do_print("Searching for URL with characters that are normally escaped");
yield promiseAddVisits({ uri: NetUtil.newURI("https://www.mozilla.org/啊-test"), yield promiseAddVisits({ uri: NetUtil.newURI("https://www.mozilla.org/啊-test"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({
@ -226,7 +226,7 @@ add_task(function* test_escaped_chars() {
}); });
add_task(function* test_unsecure_secure() { add_task(function* test_unsecure_secure() {
do_log_info("Don't return unsecure URL when searching for secure ones"); do_print("Don't return unsecure URL when searching for secure ones");
yield promiseAddVisits({ uri: NetUtil.newURI("http://test.moz.org/test/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://test.moz.org/test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({
@ -238,7 +238,7 @@ add_task(function* test_unsecure_secure() {
}); });
add_task(function* test_unsecure_secure_domain() { add_task(function* test_unsecure_secure_domain() {
do_log_info("Don't return unsecure domain when searching for secure ones"); do_print("Don't return unsecure domain when searching for secure ones");
yield promiseAddVisits({ uri: NetUtil.newURI("http://test.moz.org/test/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://test.moz.org/test/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({
@ -250,7 +250,7 @@ add_task(function* test_unsecure_secure_domain() {
}); });
add_task(function* test_untyped_www() { add_task(function* test_untyped_www() {
do_log_info("Untyped is not accounted for www"); do_print("Untyped is not accounted for www");
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false); Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
yield promiseAddVisits({ uri: NetUtil.newURI("http://www.moz.org/test/") }); yield promiseAddVisits({ uri: NetUtil.newURI("http://www.moz.org/test/") });
yield check_autocomplete({ yield check_autocomplete({
@ -262,7 +262,7 @@ add_task(function* test_untyped_www() {
}); });
add_task(function* test_untyped_ftp() { add_task(function* test_untyped_ftp() {
do_log_info("Untyped is not accounted for ftp"); do_print("Untyped is not accounted for ftp");
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false); Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
yield promiseAddVisits({ uri: NetUtil.newURI("ftp://moz.org/test/") }); yield promiseAddVisits({ uri: NetUtil.newURI("ftp://moz.org/test/") });
yield check_autocomplete({ yield check_autocomplete({
@ -274,7 +274,7 @@ add_task(function* test_untyped_ftp() {
}); });
add_task(function* test_untyped_secure() { add_task(function* test_untyped_secure() {
do_log_info("Untyped is not accounted for https"); do_print("Untyped is not accounted for https");
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false); Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
yield promiseAddVisits({ uri: NetUtil.newURI("https://moz.org/test/") }); yield promiseAddVisits({ uri: NetUtil.newURI("https://moz.org/test/") });
yield check_autocomplete({ yield check_autocomplete({
@ -286,7 +286,7 @@ add_task(function* test_untyped_secure() {
}); });
add_task(function* test_untyped_secure_www() { add_task(function* test_untyped_secure_www() {
do_log_info("Untyped is not accounted for https://www"); do_print("Untyped is not accounted for https://www");
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false); Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
yield promiseAddVisits({ uri: NetUtil.newURI("https://www.moz.org/test/") }); yield promiseAddVisits({ uri: NetUtil.newURI("https://www.moz.org/test/") });
yield check_autocomplete({ yield check_autocomplete({

View File

@ -6,7 +6,7 @@
// ensure autocomplete is able to dinamically switch behavior. // ensure autocomplete is able to dinamically switch behavior.
add_task(function* test_domain() { add_task(function* test_domain() {
do_log_info("Searching for domain should autoFill it"); do_print("Searching for domain should autoFill it");
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false); Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
yield promiseAddVisits(NetUtil.newURI("http://mozilla.org/link/")); yield promiseAddVisits(NetUtil.newURI("http://mozilla.org/link/"));
yield check_autocomplete({ yield check_autocomplete({
@ -18,7 +18,7 @@ add_task(function* test_domain() {
}); });
add_task(function* test_url() { add_task(function* test_url() {
do_log_info("Searching for url should autoFill it"); do_print("Searching for url should autoFill it");
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false); Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
yield promiseAddVisits(NetUtil.newURI("http://mozilla.org/link/")); yield promiseAddVisits(NetUtil.newURI("http://mozilla.org/link/"));
yield check_autocomplete({ yield check_autocomplete({
@ -32,7 +32,7 @@ add_task(function* test_url() {
// Now do searches with typed behavior forced to true. // Now do searches with typed behavior forced to true.
add_task(function* test_untyped_domain() { add_task(function* test_untyped_domain() {
do_log_info("Searching for non-typed domain should not autoFill it"); do_print("Searching for non-typed domain should not autoFill it");
yield promiseAddVisits(NetUtil.newURI("http://mozilla.org/link/")); yield promiseAddVisits(NetUtil.newURI("http://mozilla.org/link/"));
yield check_autocomplete({ yield check_autocomplete({
search: "moz", search: "moz",
@ -43,7 +43,7 @@ add_task(function* test_untyped_domain() {
}); });
add_task(function* test_typed_domain() { add_task(function* test_typed_domain() {
do_log_info("Searching for typed domain should autoFill it"); do_print("Searching for typed domain should autoFill it");
yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/typed/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/typed/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({
@ -55,7 +55,7 @@ add_task(function* test_typed_domain() {
}); });
add_task(function* test_untyped_url() { add_task(function* test_untyped_url() {
do_log_info("Searching for non-typed url should not autoFill it"); do_print("Searching for non-typed url should not autoFill it");
yield promiseAddVisits(NetUtil.newURI("http://mozilla.org/link/")); yield promiseAddVisits(NetUtil.newURI("http://mozilla.org/link/"));
yield check_autocomplete({ yield check_autocomplete({
search: "mozilla.org/li", search: "mozilla.org/li",
@ -66,7 +66,7 @@ add_task(function* test_untyped_url() {
}); });
add_task(function* test_typed_url() { add_task(function* test_typed_url() {
do_log_info("Searching for typed url should autoFill it"); do_print("Searching for typed url should autoFill it");
yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
transition: TRANSITION_TYPED }); transition: TRANSITION_TYPED });
yield check_autocomplete({ yield check_autocomplete({

View File

@ -3,21 +3,21 @@
add_task(function*() { add_task(function*() {
do_log_info("visit url, no protocol"); do_print("visit url, no protocol");
yield check_autocomplete({ yield check_autocomplete({
search: "mozilla.org", search: "mozilla.org",
searchParam: "enable-actions", searchParam: "enable-actions",
matches: [ { uri: makeActionURI("visiturl", {url: "http://mozilla.org/", input: "mozilla.org"}), title: "http://mozilla.org/", style: [ "action", "visiturl" ] } ] matches: [ { uri: makeActionURI("visiturl", {url: "http://mozilla.org/", input: "mozilla.org"}), title: "http://mozilla.org/", style: [ "action", "visiturl" ] } ]
}); });
do_log_info("visit url, with protocol"); do_print("visit url, with protocol");
yield check_autocomplete({ yield check_autocomplete({
search: "https://mozilla.org", search: "https://mozilla.org",
searchParam: "enable-actions", searchParam: "enable-actions",
matches: [ { uri: makeActionURI("visiturl", {url: "https://mozilla.org/", input: "https://mozilla.org"}), title: "https://mozilla.org/", style: [ "action", "visiturl" ] } ] matches: [ { uri: makeActionURI("visiturl", {url: "https://mozilla.org/", input: "https://mozilla.org"}), title: "https://mozilla.org/", style: [ "action", "visiturl" ] } ]
}); });
do_log_info("visit url, about: protocol (no host)"); do_print("visit url, about: protocol (no host)");
yield check_autocomplete({ yield check_autocomplete({
search: "about:config", search: "about:config",
searchParam: "enable-actions", searchParam: "enable-actions",
@ -26,7 +26,7 @@ add_task(function*() {
// This is distinct because of how we predict being able to url autofill via // This is distinct because of how we predict being able to url autofill via
// host lookups. // host lookups.
do_log_info("visit url, host matching visited host but not visited url"); do_print("visit url, host matching visited host but not visited url");
yield promiseAddVisits([ yield promiseAddVisits([
{ uri: NetUtil.newURI("http://mozilla.org/wine/"), title: "Mozilla Wine", transition: TRANSITION_TYPED }, { uri: NetUtil.newURI("http://mozilla.org/wine/"), title: "Mozilla Wine", transition: TRANSITION_TYPED },
]); ]);
@ -37,7 +37,7 @@ add_task(function*() {
}); });
// And hosts with no dot in them are special, due to requiring whitelisting. // And hosts with no dot in them are special, due to requiring whitelisting.
do_log_info("visit url, host matching visited host but not visited url, non-whitelisted host"); do_print("visit url, host matching visited host but not visited url, non-whitelisted host");
Services.search.addEngineWithDetails("MozSearch", "", "", "", "GET", Services.search.addEngineWithDetails("MozSearch", "", "", "", "GET",
"http://s.example.com/search"); "http://s.example.com/search");
let engine = Services.search.getEngineByName("MozSearch"); let engine = Services.search.getEngineByName("MozSearch");

View File

@ -47,7 +47,7 @@ add_task(function* test_escape() {
// match only on word boundaries // match only on word boundaries
Services.prefs.setIntPref("browser.urlbar.matchBehavior", 2); Services.prefs.setIntPref("browser.urlbar.matchBehavior", 2);
do_log_info("Match 'match' at the beginning or after / or on a CamelCase"); do_print("Match 'match' at the beginning or after / or on a CamelCase");
yield check_autocomplete({ yield check_autocomplete({
search: "match", search: "match",
matches: [ { uri: uri1, title: "title1" }, matches: [ { uri: uri1, title: "title1" },
@ -56,7 +56,7 @@ add_task(function* test_escape() {
{ uri: uri10, title: "title1" } ] { uri: uri10, title: "title1" } ]
}); });
do_log_info("Match 'dont' at the beginning or after /"); do_print("Match 'dont' at the beginning or after /");
yield check_autocomplete({ yield check_autocomplete({
search: "dont", search: "dont",
matches: [ { uri: uri2, title: "title1" }, matches: [ { uri: uri2, title: "title1" },
@ -64,7 +64,7 @@ add_task(function* test_escape() {
{ uri: uri6, title: "title1", tags: [ "dontmatchme3" ], style: [ "bookmark-tag" ] } ] { uri: uri6, title: "title1", tags: [ "dontmatchme3" ], style: [ "bookmark-tag" ] } ]
}); });
do_log_info("Match 'match' at the beginning or after / or on a CamelCase"); do_print("Match 'match' at the beginning or after / or on a CamelCase");
yield check_autocomplete({ yield check_autocomplete({
search: "2", search: "2",
matches: [ { uri: uri3, title: "matchme2" }, matches: [ { uri: uri3, title: "matchme2" },
@ -73,7 +73,7 @@ add_task(function* test_escape() {
{ uri: uri6, title: "title1", tags: [ "dontmatchme3" ], style: [ "bookmark-tag" ] } ] { uri: uri6, title: "title1", tags: [ "dontmatchme3" ], style: [ "bookmark-tag" ] } ]
}); });
do_log_info("Match 't' at the beginning or after /"); do_print("Match 't' at the beginning or after /");
yield check_autocomplete({ yield check_autocomplete({
search: "t", search: "t",
matches: [ { uri: uri1, title: "title1" }, matches: [ { uri: uri1, title: "title1" },
@ -85,13 +85,13 @@ add_task(function* test_escape() {
{ uri: uri10, title: "title1" } ] { uri: uri10, title: "title1" } ]
}); });
do_log_info("Match 'word' after many consecutive word boundaries"); do_print("Match 'word' after many consecutive word boundaries");
yield check_autocomplete({ yield check_autocomplete({
search: "word", search: "word",
matches: [ { uri: uri7, title: "!@#$%^&*()_+{}|:<>?word" } ] matches: [ { uri: uri7, title: "!@#$%^&*()_+{}|:<>?word" } ]
}); });
do_log_info("Match a word boundary '/' for everything"); do_print("Match a word boundary '/' for everything");
yield check_autocomplete({ yield check_autocomplete({
search: "/", search: "/",
matches: [ { uri: uri1, title: "title1" }, matches: [ { uri: uri1, title: "title1" },
@ -106,50 +106,50 @@ add_task(function* test_escape() {
{ uri: uri10, title: "title1" } ] { uri: uri10, title: "title1" } ]
}); });
do_log_info("Match word boundaries '()_+' that are among word boundaries"); do_print("Match word boundaries '()_+' that are among word boundaries");
yield check_autocomplete({ yield check_autocomplete({
search: "()_+", search: "()_+",
matches: [ { uri: uri7, title: "!@#$%^&*()_+{}|:<>?word" } ] matches: [ { uri: uri7, title: "!@#$%^&*()_+{}|:<>?word" } ]
}); });
do_log_info("Katakana characters form a string, so match the beginning"); do_print("Katakana characters form a string, so match the beginning");
yield check_autocomplete({ yield check_autocomplete({
search: katakana[0], search: katakana[0],
matches: [ { uri: uri8, title: katakana.join("") } ] matches: [ { uri: uri8, title: katakana.join("") } ]
}); });
/* /*
do_log_info("Middle of a katakana word shouldn't be matched"); do_print("Middle of a katakana word shouldn't be matched");
yield check_autocomplete({ yield check_autocomplete({
search: katakana[1], search: katakana[1],
matches: [ ] matches: [ ]
}); });
*/ */
do_log_info("Ideographs are treated as words so 'nin' is one word"); do_print("Ideographs are treated as words so 'nin' is one word");
yield check_autocomplete({ yield check_autocomplete({
search: ideograph[0], search: ideograph[0],
matches: [ { uri: uri9, title: ideograph.join("") } ] matches: [ { uri: uri9, title: ideograph.join("") } ]
}); });
do_log_info("Ideographs are treated as words so 'ten' is another word"); do_print("Ideographs are treated as words so 'ten' is another word");
yield check_autocomplete({ yield check_autocomplete({
search: ideograph[1], search: ideograph[1],
matches: [ { uri: uri9, title: ideograph.join("") } ] matches: [ { uri: uri9, title: ideograph.join("") } ]
}); });
do_log_info("Ideographs are treated as words so 'do' is yet another word"); do_print("Ideographs are treated as words so 'do' is yet another word");
yield check_autocomplete({ yield check_autocomplete({
search: ideograph[2], search: ideograph[2],
matches: [ { uri: uri9, title: ideograph.join("") } ] matches: [ { uri: uri9, title: ideograph.join("") } ]
}); });
do_log_info("Extra negative assert that we don't match in the middle"); do_print("Extra negative assert that we don't match in the middle");
yield check_autocomplete({ yield check_autocomplete({
search: "ch", search: "ch",
matches: [ ] matches: [ ]
}); });
do_log_info("Don't match one character after a camel-case word boundary (bug 429498)"); do_print("Don't match one character after a camel-case word boundary (bug 429498)");
yield check_autocomplete({ yield check_autocomplete({
search: "atch", search: "atch",
matches: [ ] matches: [ ]

View File

@ -5,7 +5,7 @@
// Ensure inline autocomplete doesn't return zero frecency pages. // Ensure inline autocomplete doesn't return zero frecency pages.
add_task(function* test_zzero_frec_domain() { add_task(function* test_zzero_frec_domain() {
do_log_info("Searching for zero frecency domain should not autoFill it"); do_print("Searching for zero frecency domain should not autoFill it");
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false); Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/framed_link/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/framed_link/"),
transition: TRANSITION_FRAMED_LINK }); transition: TRANSITION_FRAMED_LINK });
@ -18,7 +18,7 @@ add_task(function* test_zzero_frec_domain() {
}); });
add_task(function* test_zzero_frec_url() { add_task(function* test_zzero_frec_url() {
do_log_info("Searching for zero frecency url should not autoFill it"); do_print("Searching for zero frecency url should not autoFill it");
Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false); Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/framed_link/"), yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/framed_link/"),
transition: TRANSITION_FRAMED_LINK }); transition: TRANSITION_FRAMED_LINK });

View File

@ -13,9 +13,9 @@
add_task(function changeuri_unvisited_bookmark() add_task(function changeuri_unvisited_bookmark()
{ {
do_log_info("After changing URI of bookmark, frecency of bookmark's " + do_print("After changing URI of bookmark, frecency of bookmark's " +
"original URI should be zero if original URI is unvisited and " + "original URI should be zero if original URI is unvisited and " +
"no longer bookmarked."); "no longer bookmarked.");
const TEST_URI = NetUtil.newURI("http://example.com/1"); const TEST_URI = NetUtil.newURI("http://example.com/1");
let id = PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId, let id = PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
TEST_URI, TEST_URI,
@ -23,14 +23,14 @@ add_task(function changeuri_unvisited_bookmark()
"bookmark title"); "bookmark title");
yield promiseAsyncUpdates(); yield promiseAsyncUpdates();
do_log_info("Bookmarked => frecency of URI should be != 0"); do_print("Bookmarked => frecency of URI should be != 0");
do_check_neq(frecencyForUrl(TEST_URI), 0); do_check_neq(frecencyForUrl(TEST_URI), 0);
PlacesUtils.bookmarks.changeBookmarkURI(id, uri("http://example.com/2")); PlacesUtils.bookmarks.changeBookmarkURI(id, uri("http://example.com/2"));
yield promiseAsyncUpdates(); yield promiseAsyncUpdates();
do_log_info("Unvisited URI no longer bookmarked => frecency should = 0"); do_print("Unvisited URI no longer bookmarked => frecency should = 0");
do_check_eq(frecencyForUrl(TEST_URI), 0); do_check_eq(frecencyForUrl(TEST_URI), 0);
remove_all_bookmarks(); remove_all_bookmarks();
@ -39,8 +39,8 @@ add_task(function changeuri_unvisited_bookmark()
add_task(function changeuri_visited_bookmark() add_task(function changeuri_visited_bookmark()
{ {
do_log_info("After changing URI of bookmark, frecency of bookmark's " + do_print("After changing URI of bookmark, frecency of bookmark's " +
"original URI should not be zero if original URI is visited."); "original URI should not be zero if original URI is visited.");
const TEST_URI = NetUtil.newURI("http://example.com/1"); const TEST_URI = NetUtil.newURI("http://example.com/1");
let id = PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId, let id = PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
TEST_URI, TEST_URI,
@ -49,7 +49,7 @@ add_task(function changeuri_visited_bookmark()
yield promiseAsyncUpdates(); yield promiseAsyncUpdates();
do_log_info("Bookmarked => frecency of URI should be != 0"); do_print("Bookmarked => frecency of URI should be != 0");
do_check_neq(frecencyForUrl(TEST_URI), 0); do_check_neq(frecencyForUrl(TEST_URI), 0);
yield promiseAddVisits(TEST_URI); yield promiseAddVisits(TEST_URI);
@ -60,7 +60,7 @@ add_task(function changeuri_visited_bookmark()
yield promiseAsyncUpdates(); yield promiseAsyncUpdates();
do_log_info("*Visited* URI no longer bookmarked => frecency should != 0"); do_print("*Visited* URI no longer bookmarked => frecency should != 0");
do_check_neq(frecencyForUrl(TEST_URI), 0); do_check_neq(frecencyForUrl(TEST_URI), 0);
remove_all_bookmarks(); remove_all_bookmarks();
@ -69,9 +69,9 @@ add_task(function changeuri_visited_bookmark()
add_task(function changeuri_bookmark_still_bookmarked() add_task(function changeuri_bookmark_still_bookmarked()
{ {
do_log_info("After changing URI of bookmark, frecency of bookmark's " + do_print("After changing URI of bookmark, frecency of bookmark's " +
"original URI should not be zero if original URI is still " + "original URI should not be zero if original URI is still " +
"bookmarked."); "bookmarked.");
const TEST_URI = NetUtil.newURI("http://example.com/1"); const TEST_URI = NetUtil.newURI("http://example.com/1");
let id1 = PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId, let id1 = PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
TEST_URI, TEST_URI,
@ -84,14 +84,14 @@ add_task(function changeuri_bookmark_still_bookmarked()
yield promiseAsyncUpdates(); yield promiseAsyncUpdates();
do_log_info("Bookmarked => frecency of URI should be != 0"); do_print("Bookmarked => frecency of URI should be != 0");
do_check_neq(frecencyForUrl(TEST_URI), 0); do_check_neq(frecencyForUrl(TEST_URI), 0);
PlacesUtils.bookmarks.changeBookmarkURI(id1, uri("http://example.com/2")); PlacesUtils.bookmarks.changeBookmarkURI(id1, uri("http://example.com/2"));
yield promiseAsyncUpdates(); yield promiseAsyncUpdates();
do_log_info("URI still bookmarked => frecency should != 0"); do_print("URI still bookmarked => frecency should != 0");
do_check_neq(frecencyForUrl(TEST_URI), 0); do_check_neq(frecencyForUrl(TEST_URI), 0);
remove_all_bookmarks(); remove_all_bookmarks();
@ -100,7 +100,7 @@ add_task(function changeuri_bookmark_still_bookmarked()
add_task(function changeuri_nonexistent_bookmark() add_task(function changeuri_nonexistent_bookmark()
{ {
do_log_info("Changing the URI of a nonexistent bookmark should fail."); do_print("Changing the URI of a nonexistent bookmark should fail.");
function tryChange(itemId) function tryChange(itemId)
{ {
try { try {

View File

@ -89,7 +89,7 @@ function promiseDefaultSearchEngine() {
function promiseSearchTopic(expectedVerb) { function promiseSearchTopic(expectedVerb) {
let deferred = Promise.defer(); let deferred = Promise.defer();
Services.obs.addObserver( function observe(subject, topic, verb) { Services.obs.addObserver( function observe(subject, topic, verb) {
do_log_info("browser-search-engine-modified: " + verb); do_print("browser-search-engine-modified: " + verb);
if (verb == expectedVerb) { if (verb == expectedVerb) {
Services.obs.removeObserver(observe, "browser-search-engine-modified"); Services.obs.removeObserver(observe, "browser-search-engine-modified");
deferred.resolve(); deferred.resolve();

View File

@ -69,7 +69,7 @@ function TitleChangedObserver(aURI,
TitleChangedObserver.prototype = { TitleChangedObserver.prototype = {
__proto__: NavHistoryObserver.prototype, __proto__: NavHistoryObserver.prototype,
onTitleChanged(aURI, aTitle, aGUID) { onTitleChanged(aURI, aTitle, aGUID) {
do_log_info("onTitleChanged(" + aURI.spec + ", " + aTitle + ", " + aGUID + ")"); do_print("onTitleChanged(" + aURI.spec + ", " + aTitle + ", " + aGUID + ")");
if (!this.uri.equals(aURI)) { if (!this.uri.equals(aURI)) {
return; return;
} }
@ -106,9 +106,9 @@ VisitObserver.prototype = {
aTransitionType, aTransitionType,
aGUID) aGUID)
{ {
do_log_info("onVisit(" + aURI.spec + ", " + aVisitId + ", " + aTime + do_print("onVisit(" + aURI.spec + ", " + aVisitId + ", " + aTime +
", " + aSessionId + ", " + aReferringId + ", " + ", " + aSessionId + ", " + aReferringId + ", " +
aTransitionType + ", " + aGUID + ")"); aTransitionType + ", " + aGUID + ")");
if (!this.uri.equals(aURI) || this.guid != aGUID) { if (!this.uri.equals(aURI) || this.guid != aGUID) {
return; return;
} }
@ -252,7 +252,7 @@ add_task(function* test_no_visits_throws() {
(aPlace.uri ? "uri" : "no uri") + ", " + (aPlace.uri ? "uri" : "no uri") + ", " +
(aPlace.guid ? "guid" : "no guid") + ", " + (aPlace.guid ? "guid" : "no guid") + ", " +
(aPlace.visits ? "visits array" : "no visits array"); (aPlace.visits ? "visits array" : "no visits array");
do_log_info(str); do_print(str);
}; };
// Loop through every possible case. Note that we don't actually care about // Loop through every possible case. Note that we don't actually care about
@ -375,7 +375,7 @@ add_task(function* test_non_addable_uri_errors() {
// NetUtil.newURI() can throw if e.g. our app knows about imap:// // NetUtil.newURI() can throw if e.g. our app knows about imap://
// but the account is not set up and so the URL is invalid for us. // but the account is not set up and so the URL is invalid for us.
// Note this in the log but ignore as it's not the subject of this test. // Note this in the log but ignore as it's not the subject of this test.
do_log_info("Could not construct URI for '" + url + "'; ignoring"); do_print("Could not construct URI for '" + url + "'; ignoring");
} }
}); });
@ -384,7 +384,7 @@ add_task(function* test_non_addable_uri_errors() {
do_throw("Unexpected success."); do_throw("Unexpected success.");
} }
for (let place of placesResult.errors) { for (let place of placesResult.errors) {
do_log_info("Checking '" + place.info.uri.spec + "'"); do_print("Checking '" + place.info.uri.spec + "'");
do_check_eq(place.resultCode, Cr.NS_ERROR_INVALID_ARG); do_check_eq(place.resultCode, Cr.NS_ERROR_INVALID_ARG);
do_check_false(yield promiseIsURIVisited(place.info.uri)); do_check_false(yield promiseIsURIVisited(place.info.uri));
} }
@ -1046,7 +1046,7 @@ add_task(function* test_visit_notifies() {
}); });
PlacesUtils.history.addObserver(visitObserver, false); PlacesUtils.history.addObserver(visitObserver, false);
let observer = function(aSubject, aTopic, aData) { let observer = function(aSubject, aTopic, aData) {
do_log_info("observe(" + aSubject + ", " + aTopic + ", " + aData + ")"); do_print("observe(" + aSubject + ", " + aTopic + ", " + aData + ")");
do_check_true(aSubject instanceof Ci.nsIURI); do_check_true(aSubject instanceof Ci.nsIURI);
do_check_true(aSubject.equals(place.uri)); do_check_true(aSubject.equals(place.uri));
@ -1084,7 +1084,7 @@ add_task(function* test_callbacks_not_supplied() {
// NetUtil.newURI() can throw if e.g. our app knows about imap:// // NetUtil.newURI() can throw if e.g. our app knows about imap://
// but the account is not set up and so the URL is invalid for us. // but the account is not set up and so the URL is invalid for us.
// Note this in the log but ignore as it's not the subject of this test. // Note this in the log but ignore as it's not the subject of this test.
do_log_info("Could not construct URI for '" + url + "'; ignoring"); do_print("Could not construct URI for '" + url + "'; ignoring");
} }
}); });

Some files were not shown because too many files have changed in this diff Show More