This commit is contained in:
Ryan VanderMeulen 2014-02-26 16:43:08 -05:00
Родитель 11b8051865 e8b0013422
Коммит d6ce6b9120
513 изменённых файлов: 4626 добавлений и 2490 удалений

Просмотреть файл

@ -379,8 +379,6 @@
@BINPATH@/components/PeerConnection.js
@BINPATH@/components/PeerConnection.manifest
#endif
@BINPATH@/components/HttpDataUsage.manifest
@BINPATH@/components/HttpDataUsage.js
@BINPATH@/components/SiteSpecificUserAgent.js
@BINPATH@/components/SiteSpecificUserAgent.manifest
@BINPATH@/components/storage-mozStorage.js

Просмотреть файл

@ -61,11 +61,6 @@ RCINCLUDE = splash.rc
# Note the manifest file exists in the tree, so we use the explicit filename
# here.
EXTRA_DEPS += firefox.exe.manifest
ifndef GNU_CC
RCFLAGS += -DMOZ_PHOENIX -I$(srcdir)
else
RCFLAGS += -DMOZ_PHOENIX --include-dir $(srcdir)
endif
endif
PROGRAMS_DEST = $(DIST)/bin

Просмотреть файл

@ -37,3 +37,6 @@ if CONFIG['_MSC_VER']:
# Always enter a Windows program through wmain, whether or not we're
# a console application.
WIN32_EXE_LDFLAGS += ['-ENTRY:wmainCRTStartup']
if CONFIG['OS_ARCH'] == 'WINNT':
DEFINES['MOZ_PHOENIX'] = True

Просмотреть файл

@ -389,7 +389,22 @@ panel[noactions] > richlistbox > richlistitem[type~="action"] > .ac-url-box > .a
}
#identity-icon-labels {
max-width: 12vw;
max-width: 18em;
}
@media (max-width: 700px) {
#identity-icon-labels {
max-width: 70px;
}
}
@media (max-width: 600px) {
#identity-icon-labels {
max-width: 60px;
}
}
@media (max-width: 500px) {
#identity-icon-labels {
max-width: 50px;
}
}
#identity-icon-country-label {
@ -890,14 +905,14 @@ chatbox:-moz-full-screen-ancestor > .chat-titlebar {
}
/* Customize mode */
#navigator-toolbox > toolbar,
#navigator-toolbox,
#content-deck {
transition-property: margin-left, margin-right;
transition-duration: 150ms;
transition-timing-function: ease-out;
}
#tab-view-deck[fastcustomizeanimation] #navigator-toolbox > toolbar,
#tab-view-deck[fastcustomizeanimation] #navigator-toolbox,
#tab-view-deck[fastcustomizeanimation] #content-deck {
transition-duration: 1ms;
transition-timing-function: linear;

Просмотреть файл

@ -542,6 +542,11 @@
defaultset="tabbrowser-tabs,new-tab-button,alltabs-button,tabs-closebutton"
collapsed="true">
#ifdef XP_LINUX
<hbox id="private-browsing-indicator"
skipintoolbarset="true"/>
#endif
<tabs id="tabbrowser-tabs"
class="tabbrowser-tabs"
tabbrowser="content"
@ -628,7 +633,7 @@
overflowtarget="widget-overflow-list"
context="toolbar-context-menu">
<hbox id="nav-bar-customization-target" class="customization-target" flex="1">
<hbox id="nav-bar-customization-target" flex="1">
<toolbaritem id="urlbar-container" flex="400" persist="width"
forwarddisabled="true" title="&locationItem.title;" removable="false"
cui-areatype="toolbar"

Просмотреть файл

@ -25,15 +25,17 @@ const EXPECTED_REFLOWS = [
"ssi_getWindowDimension@resource:///modules/sessionstore/SessionStore.jsm",
];
if (Services.appinfo.OS == "Darwin") {
// TabsInTitlebar._update causes a reflow on OS X trying to do calculations
if (Services.appinfo.OS == "WINNT" || Services.appinfo.OS == "Darwin") {
// TabsInTitlebar._update causes a reflow on OS X and Windows trying to do calculations
// since layout info is already dirty. This doesn't seem to happen before
// MozAfterPaint on other platforms.
// MozAfterPaint on Linux.
EXPECTED_REFLOWS.push("rect@chrome://browser/content/browser.js|" +
"TabsInTitlebar._update@chrome://browser/content/browser.js|" +
"updateAppearance@chrome://browser/content/browser.js|" +
"handleEvent@chrome://browser/content/tabbrowser.xml|");
}
if (Services.appinfo.OS == "Darwin") {
// _onOverflow causes a reflow getting widths.
EXPECTED_REFLOWS.push("OverflowableToolbar.prototype._onOverflow@resource:///modules/CustomizableUI.jsm|" +
"OverflowableToolbar.prototype.init@resource:///modules/CustomizableUI.jsm|" +

Просмотреть файл

@ -217,7 +217,7 @@
this._transitioning = false;
}.bind(this));
let newHeight = this._heightOfSubview(viewNode);
let newHeight = this._heightOfSubview(viewNode, this._subViews);
this._viewContainer.style.height = newHeight + "px";
this._subViewObserver.observe(viewNode, {
@ -324,7 +324,7 @@
<method name="_syncContainerWithSubView">
<body><![CDATA[
if (!this.ignoreMutations && this.showingSubView) {
let newHeight = this._heightOfSubview(this._currentSubView);
let newHeight = this._heightOfSubview(this._currentSubView, this._subViews);
this._viewContainer.style.height = newHeight + "px";
}
]]></body>
@ -345,16 +345,50 @@
<method name="_heightOfSubview">
<parameter name="aSubview"/>
<parameter name="aContainerToCheck"/>
<body><![CDATA[
function getFullHeight(element) {
//XXXgijs: unfortunately, scrollHeight rounds values, and there's no alternative
// that works with overflow: auto elements. Fortunately for us,
// we have exactly 1 (potentially) scrolling element in here (the subview body),
// and rounding 1 value is OK - rounding more than 1 and adding them means we get
// off-by-1 errors. Now we might be off by a subpixel, but we care less about that.
// So, use scrollHeight *only* if the element is vertically scrollable.
let height;
let elementCS;
if (element.scrollTopMax) {
height = element.scrollHeight;
// Bounding client rects include borders, scrollHeight doesn't:
elementCS = win.getComputedStyle(element);
height += parseFloat(elementCS.borderTopWidth) +
parseFloat(elementCS.borderBottomWidth);
} else {
height = element.getBoundingClientRect().height;
if (height > 0) {
elementCS = win.getComputedStyle(element);
}
}
if (elementCS) {
// Include margins - but not borders or paddings because they
// were dealt with above.
height += parseFloat(elementCS.marginTop) + parseFloat(elementCS.marginBottom);
}
return height;
}
let win = aSubview.ownerDocument.defaultView;
let body = aSubview.querySelector(".panel-subview-body");
let height = body ? body.scrollHeight : aSubview.scrollHeight;
let height = getFullHeight(body || aSubview);
if (body) {
let header = aSubview.querySelector(".panel-subview-header");
let footer = aSubview.querySelector(".panel-subview-footer");
height += (header ? header.scrollHeight : 0) +
(footer ? footer.scrollHeight : 0);
height += (header ? getFullHeight(header) : 0) +
(footer ? getFullHeight(footer) : 0);
}
return height;
if (aContainerToCheck) {
let containerCS = win.getComputedStyle(aContainerToCheck);
height += parseFloat(containerCS.paddingTop) + parseFloat(containerCS.paddingBottom);
}
return Math.round(height);
]]></body>
</method>

Просмотреть файл

@ -794,6 +794,10 @@ let CustomizableUIInternal = {
}
gBuildAreas.get(aArea).add(aNode);
// Give a class to all customize targets to be used for styling in Customize Mode
let customizableNode = this.getCustomizeTargetForArea(aArea, window);
customizableNode.classList.add("customization-target");
},
registerBuildWindow: function(aWindow) {

Просмотреть файл

@ -292,6 +292,12 @@ CustomizeMode.prototype = {
return;
}
if (this.resetting) {
LOG("Attempted to exit while we're resetting. " +
"We'll exit after resetting has finished.");
return;
}
this._handler.isExitingCustomizeMode = true;
CustomizableUI.removeListener(this);
@ -885,6 +891,9 @@ CustomizeMode.prototype = {
this._updateEmptyPaletteNotice();
this._showPanelCustomizationPlaceholders();
this.resetting = false;
if (!this._wantToBeInCustomizeMode) {
this.exit();
}
}.bind(this)).then(null, ERROR);
},
@ -1475,6 +1484,7 @@ CustomizeMode.prototype = {
this._cancelDragActive(this._dragOverItem);
this._dragOverItem = null;
}
this._updateToolbarCustomizationOutline(this.window);
this._showPanelCustomizationPlaceholders();
},
@ -1511,6 +1521,7 @@ CustomizeMode.prototype = {
this._setGridDragActive(aItem, draggedItem, aValue);
} else {
let targetArea = this._getCustomizableParent(aItem);
this._updateToolbarCustomizationOutline(window, targetArea);
let makeSpaceImmediately = false;
if (!gDraggingInToolbars.has(targetArea.id)) {
gDraggingInToolbars.add(targetArea.id);
@ -1545,6 +1556,7 @@ CustomizeMode.prototype = {
}
},
_cancelDragActive: function(aItem, aNextItem, aNoTransition) {
this._updateToolbarCustomizationOutline(aItem.ownerDocument.defaultView);
let currentArea = this._getCustomizableParent(aItem);
if (!currentArea) {
return;
@ -1771,7 +1783,36 @@ CustomizeMode.prototype = {
while (oldPlaceholders.length) {
contents.removeChild(oldPlaceholders[0]);
}
},
/**
* Update toolbar customization targets during drag events to add or remove
* outlines to indicate that an area is customizable.
*
* @param aWindow The XUL window in which outlines should be updated.
* @param {Element} [aToolbarArea=null] The element of the customizable toolbar area to add the
* outline to. If aToolbarArea is falsy, the outline will be
* removed from all toolbar areas.
*/
_updateToolbarCustomizationOutline: function(aWindow, aToolbarArea = null) {
// Remove the attribute from existing customization targets
for (let area of CustomizableUI.areas) {
if (CustomizableUI.getAreaType(area) != CustomizableUI.TYPE_TOOLBAR) {
continue;
}
let target = CustomizableUI.getCustomizeTargetForArea(area, aWindow);
target.removeAttribute("customizing-dragovertarget");
}
// Now set the attribute on the desired target
if (aToolbarArea) {
if (CustomizableUI.getAreaType(aToolbarArea.id) != CustomizableUI.TYPE_TOOLBAR)
return;
let target = CustomizableUI.getCustomizeTargetForArea(aToolbarArea.id, aWindow);
target.setAttribute("customizing-dragovertarget", true);
}
},
};
function __dumpDragData(aEvent, caller) {

Просмотреть файл

@ -2,7 +2,7 @@ const {Cc,Ci,Cu} = require("chrome");
const ObservableObject = require("devtools/shared/observable-object");
const promise = require("sdk/core/promise");
const {EventEmitter} = Cu.import("resource:///modules/devtools/shared/event-emitter.js");
const {EventEmitter} = Cu.import("resource://gre/modules/devtools/event-emitter.js");
const {generateUUID} = Cc['@mozilla.org/uuid-generator;1'].getService(Ci.nsIUUIDGenerator);
/**

Просмотреть файл

@ -16,7 +16,7 @@ const {Services} = Cu.import("resource://gre/modules/Services.jsm");
const {FileUtils} = Cu.import("resource://gre/modules/FileUtils.jsm");
const {installHosted, installPackaged, getTargetForApp,
reloadApp, launchApp, closeApp} = require("devtools/app-actor-front");
const {EventEmitter} = Cu.import("resource:///modules/devtools/shared/event-emitter.js");
const {EventEmitter} = Cu.import("resource://gre/modules/devtools/event-emitter.js");
const promise = require("sdk/core/promise");

Просмотреть файл

@ -16,7 +16,7 @@ let Utils = (function() {
const {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
const {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
const {require} = devtools;
const EventEmitter = require("devtools/shared/event-emitter");
const EventEmitter = require("devtools/toolkit/event-emitter");
function _createSetEventForwarder(key, finalStore) {

Просмотреть файл

@ -17,7 +17,7 @@ let promise = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js").P
Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource://gre/modules/devtools/gcli.jsm");
Cu.import("resource:///modules/devtools/shared/event-emitter.js");
Cu.import("resource://gre/modules/devtools/event-emitter.js");
let devtools = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools;
let Telemetry = devtools.require("devtools/shared/telemetry");

Просмотреть файл

@ -90,7 +90,7 @@ const FRAME_TYPE = {
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
Cu.import("resource:///modules/devtools/shared/event-emitter.js");
Cu.import("resource://gre/modules/devtools/event-emitter.js");
Cu.import("resource:///modules/devtools/SimpleListWidget.jsm");
Cu.import("resource:///modules/devtools/BreadcrumbsWidget.jsm");
Cu.import("resource:///modules/devtools/SideMenuWidget.jsm");

Просмотреть файл

@ -7,7 +7,7 @@
const { Cc, Ci, Cu, Cr } = require("chrome");
const promise = require("sdk/core/promise");
const EventEmitter = require("devtools/shared/event-emitter");
const EventEmitter = require("devtools/toolkit/event-emitter");
const { DevToolsUtils } = Cu.import("resource://gre/modules/devtools/DevToolsUtils.jsm", {});

Просмотреть файл

@ -10,7 +10,7 @@ const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource:///modules/devtools/shared/event-emitter.js");
Cu.import("resource://gre/modules/devtools/event-emitter.js");
let promise = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js").Promise;
Cu.import("resource://gre/modules/devtools/Loader.jsm");

Просмотреть файл

@ -7,7 +7,7 @@
"use strict";
const {Cu, Ci} = require("chrome");
let EventEmitter = require("devtools/shared/event-emitter");
let EventEmitter = require("devtools/toolkit/event-emitter");
/**
* API

Просмотреть файл

@ -9,7 +9,7 @@ const {Cu} = require("chrome");
Cu.import("resource://gre/modules/Services.jsm");
var promise = require("sdk/core/promise");
var EventEmitter = require("devtools/shared/event-emitter");
var EventEmitter = require("devtools/toolkit/event-emitter");
var Telemetry = require("devtools/shared/telemetry");
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";

Просмотреть файл

@ -7,7 +7,7 @@
const {Cc, Ci, Cu} = require("chrome");
var promise = require("sdk/core/promise");
var EventEmitter = require("devtools/shared/event-emitter");
var EventEmitter = require("devtools/toolkit/event-emitter");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "DebuggerServer",
@ -352,6 +352,8 @@ TabTarget.prototype = {
* Setup listeners for remote debugging, updating existing ones as necessary.
*/
_setupRemoteListeners: function TabTarget__setupRemoteListeners() {
this.client.addListener("closed", this.destroy);
this._onTabDetached = (aType, aPacket) => {
// We have to filter message to ensure that this detach is for this tab
if (aPacket.from == this._form.actor) {
@ -384,6 +386,7 @@ TabTarget.prototype = {
* Teardown listeners for remote debugging.
*/
_teardownRemoteListeners: function TabTarget__teardownRemoteListeners() {
this.client.removeListener("closed", this.destroy);
this.client.removeListener("tabNavigated", this._onTabNavigated);
this.client.removeListener("tabDetached", this._onTabDetached);
},

Просмотреть файл

@ -10,6 +10,7 @@ support-files =
[browser_keybindings.js]
[browser_new_activation_workflow.js]
[browser_target_events.js]
[browser_target_remote.js]
[browser_toolbox_dynamic_registration.js]
[browser_toolbox_highlight.js]
[browser_toolbox_hosts.js]

Просмотреть файл

@ -7,7 +7,7 @@ const Cu = Components.utils;
const toolId = "test-tool";
let tempScope = {};
Cu.import("resource:///modules/devtools/shared/event-emitter.js", tempScope);
Cu.import("resource://gre/modules/devtools/event-emitter.js", tempScope);
let EventEmitter = tempScope.EventEmitter;
function test() {

Просмотреть файл

@ -0,0 +1,39 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
let { DebuggerServer } =
Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
let { DebuggerClient } =
Cu.import("resource://gre/modules/devtools/dbg-client.jsm", {});
let { devtools } =
Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
// Ensure target is closed if client is closed directly
function test() {
waitForExplicitFinish();
if (!DebuggerServer.initialized) {
DebuggerServer.init(function () { return true; });
DebuggerServer.addBrowserActors();
}
var client = new DebuggerClient(DebuggerServer.connectPipe());
client.connect(() => {
client.listTabs(response => {
let options = {
form: response,
client: client,
chrome: true
};
devtools.TargetFactory.forRemoteTab(options).then(target => {
target.on("close", () => {
ok(true, "Target was closed");
DebuggerServer.destroy();
finish();
});
client.close();
});
});
});
}

Просмотреть файл

@ -7,7 +7,7 @@
const {Cu} = require("chrome");
let promise = require("sdk/core/promise");
let EventEmitter = require("devtools/shared/event-emitter");
let EventEmitter = require("devtools/toolkit/event-emitter");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource:///modules/devtools/DOMHelpers.jsm");

Просмотреть файл

@ -7,7 +7,7 @@
const {Cu, Cc, Ci} = require("chrome");
let promise = require("sdk/core/promise");
let EventEmitter = require("devtools/shared/event-emitter");
let EventEmitter = require("devtools/toolkit/event-emitter");
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
Cu.import("resource://gre/modules/Services.jsm");

Просмотреть файл

@ -11,7 +11,7 @@ const MAX_ZOOM = 2;
let {Cc, Ci, Cu} = require("chrome");
let promise = require("sdk/core/promise");
let EventEmitter = require("devtools/shared/event-emitter");
let EventEmitter = require("devtools/toolkit/event-emitter");
let Telemetry = require("devtools/shared/telemetry");
let HUDService = require("devtools/webconsole/hudservice");

Просмотреть файл

@ -9,7 +9,7 @@ const {Cc, Ci, Cu, Cr} = require("chrome");
Cu.import("resource://gre/modules/Services.jsm");
let promise = require("sdk/core/promise");
let EventEmitter = require("devtools/shared/event-emitter");
let EventEmitter = require("devtools/toolkit/event-emitter");
let {CssLogic} = require("devtools/styleinspector/css-logic");
loader.lazyGetter(this, "MarkupView", () => require("devtools/markupview/markup-view").MarkupView);

Просмотреть файл

@ -7,7 +7,7 @@
const {Cu} = require("chrome");
const Editor = require("devtools/sourceeditor/editor");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource:///modules/devtools/shared/event-emitter.js");
Cu.import("resource://gre/modules/devtools/event-emitter.js");
exports.HTMLEditor = HTMLEditor;

Просмотреть файл

@ -22,7 +22,7 @@ const {gDevTools} = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
const {HTMLEditor} = require("devtools/markupview/html-editor");
const promise = require("sdk/core/promise");
const {Tooltip} = require("devtools/shared/widgets/Tooltip");
const EventEmitter = require("devtools/shared/event-emitter");
const EventEmitter = require("devtools/toolkit/event-emitter");
Cu.import("resource://gre/modules/devtools/LayoutHelpers.jsm");
Cu.import("resource://gre/modules/devtools/Templater.jsm");

Просмотреть файл

@ -106,7 +106,7 @@ Cu.import("resource:///modules/devtools/ViewHelpers.jsm");
const require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require;
const promise = Cu.import("resource://gre/modules/Promise.jsm", {}).Promise;
const EventEmitter = require("devtools/shared/event-emitter");
const EventEmitter = require("devtools/toolkit/event-emitter");
const Editor = require("devtools/sourceeditor/editor");
const {Tooltip} = require("devtools/shared/widgets/Tooltip");

Просмотреть файл

@ -7,7 +7,7 @@
const { Cc, Ci, Cu, Cr } = require("chrome");
const { Promise: promise } = Cu.import("resource://gre/modules/Promise.jsm", {});
const EventEmitter = require("devtools/shared/event-emitter");
const EventEmitter = require("devtools/toolkit/event-emitter");
function NetMonitorPanel(iframeWindow, toolbox) {
this.panelWin = iframeWindow;

Просмотреть файл

@ -6,7 +6,7 @@
let { Cu } = require("chrome");
let { defer } = Cu.import("resource://gre/modules/Promise.jsm", {}).Promise;
let EventEmitter = require("devtools/shared/event-emitter");
let EventEmitter = require("devtools/toolkit/event-emitter");
const { PROFILE_IDLE, PROFILE_COMPLETED, PROFILE_RUNNING } = require("devtools/profiler/consts");

Просмотреть файл

@ -20,7 +20,7 @@ if (isJSM) {
const { L10N_BUNDLE } = require("devtools/profiler/consts");
var EventEmitter = require("devtools/shared/event-emitter");
var EventEmitter = require("devtools/toolkit/event-emitter");
Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
Cu.import("resource://gre/modules/devtools/Console.jsm");

Просмотреть файл

@ -16,7 +16,7 @@ const {
const { TextEncoder } = Cu.import("resource://gre/modules/commonjs/toolkit/loader.js", {});
var EventEmitter = require("devtools/shared/event-emitter");
var EventEmitter = require("devtools/toolkit/event-emitter");
var Cleopatra = require("devtools/profiler/cleopatra");
var Sidebar = require("devtools/profiler/sidebar");
var ProfilerController = require("devtools/profiler/controller");

Просмотреть файл

@ -5,7 +5,7 @@
"use strict";
let { Cu } = require("chrome");
let EventEmitter = require("devtools/shared/event-emitter");
let EventEmitter = require("devtools/toolkit/event-emitter");
Cu.import("resource:///modules/devtools/SideMenuWidget.jsm");
Cu.import("resource:///modules/devtools/ViewHelpers.jsm");

Просмотреть файл

@ -11,7 +11,7 @@ Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource:///modules/devtools/gDevTools.jsm");
Cu.import("resource:///modules/devtools/FloatingScrollbars.jsm");
Cu.import("resource:///modules/devtools/shared/event-emitter.js");
Cu.import("resource://gre/modules/devtools/event-emitter.js");
var require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require;
let Telemetry = require("devtools/shared/telemetry");

Просмотреть файл

@ -6,7 +6,7 @@
"use strict";
const {Cu} = require("chrome");
const EventEmitter = require("devtools/shared/event-emitter");
const EventEmitter = require("devtools/toolkit/event-emitter");
const {Promise: promise} = Cu.import("resource://gre/modules/Promise.jsm", {});

Просмотреть файл

@ -7,7 +7,7 @@
const { Cc, Ci, Cu, Cr } = require("chrome");
const promise = Cu.import("resource://gre/modules/Promise.jsm", {}).Promise;
const EventEmitter = require("devtools/shared/event-emitter");
const EventEmitter = require("devtools/toolkit/event-emitter");
const { WebGLFront } = require("devtools/server/actors/webgl");
function ShaderEditorPanel(iframeWindow, toolbox) {

Просмотреть файл

@ -14,7 +14,7 @@ Cu.import("resource:///modules/devtools/ViewHelpers.jsm");
const require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require;
const promise = Cu.import("resource://gre/modules/Promise.jsm", {}).Promise;
const EventEmitter = require("devtools/shared/event-emitter");
const EventEmitter = require("devtools/toolkit/event-emitter");
const {Tooltip} = require("devtools/shared/widgets/Tooltip");
const Editor = require("devtools/sourceeditor/editor");

Просмотреть файл

@ -35,7 +35,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "require",
"resource://gre/modules/devtools/Require.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "EventEmitter",
"resource:///modules/devtools/shared/event-emitter.js");
"resource://gre/modules/devtools/event-emitter.js");
XPCOMUtils.defineLazyGetter(this, "prefBranch", function() {
let prefService = Cc["@mozilla.org/preferences-service;1"]

Просмотреть файл

@ -40,7 +40,7 @@ const FOCUS_BACKWARD = Ci.nsIFocusManager.MOVEFOCUS_BACKWARD;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource:///modules/devtools/shared/event-emitter.js");
Cu.import("resource://gre/modules/devtools/event-emitter.js");
/**
* Mark a span editable. |editableField| will listen for the span to

Просмотреть файл

@ -30,7 +30,7 @@
"use strict";
const EventEmitter = require("devtools/shared/event-emitter");
const EventEmitter = require("devtools/toolkit/event-emitter");
function ObservableObject(object = {}) {
EventEmitter.decorate(this);

Просмотреть файл

@ -9,7 +9,6 @@ support-files =
leakhunt.js
[browser_css_color.js]
[browser_eventemitter_basic.js]
[browser_layoutHelpers.js]
[browser_observableobject.js]
[browser_outputparser.js]

Просмотреть файл

@ -1,154 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const promise = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", {}).Promise;
const EventEmitter = Cu.import("resource:///modules/devtools/shared/event-emitter.js", {}).EventEmitter;
function test() {
waitForExplicitFinish();
testEmitter();
testEmitter({});
Task.spawn(testPromise).then(null, ok.bind(null, false)).then(finish);
}
function testEmitter(aObject) {
let emitter;
if (aObject) {
emitter = aObject;
EventEmitter.decorate(emitter);
} else {
emitter = new EventEmitter();
}
ok(emitter, "We have an event emitter");
emitter.on("next", next);
emitter.emit("next", "abc", "def");
let beenHere1 = false;
function next(eventName, str1, str2) {
is(eventName, "next", "Got event");
is(str1, "abc", "Argument 1 is correct");
is(str2, "def", "Argument 2 is correct");
ok(!beenHere1, "first time in next callback");
beenHere1 = true;
emitter.off("next", next);
emitter.emit("next");
emitter.once("onlyonce", onlyOnce);
emitter.emit("onlyonce");
emitter.emit("onlyonce");
}
let beenHere2 = false;
function onlyOnce() {
ok(!beenHere2, "\"once\" listner has been called once");
beenHere2 = true;
emitter.emit("onlyonce");
killItWhileEmitting();
}
function killItWhileEmitting() {
function c1() {
ok(true, "c1 called");
}
function c2() {
ok(true, "c2 called");
emitter.off("tick", c3);
}
function c3() {
ok(false, "c3 should not be called");
}
function c4() {
ok(true, "c4 called");
}
emitter.on("tick", c1);
emitter.on("tick", c2);
emitter.on("tick", c3);
emitter.on("tick", c4);
emitter.emit("tick");
offAfterOnce();
}
function offAfterOnce() {
let enteredC1 = false;
function c1() {
enteredC1 = true;
}
emitter.once("oao", c1);
emitter.off("oao", c1);
emitter.emit("oao");
ok(!enteredC1, "c1 should not be called");
}
}
function testPromise() {
let emitter = new EventEmitter();
let p = emitter.once("thing");
// Check that the promise is only resolved once event though we
// emit("thing") more than once
let firstCallbackCalled = false;
let check1 = p.then(arg => {
is(firstCallbackCalled, false, "first callback called only once");
firstCallbackCalled = true;
is(arg, "happened", "correct arg in promise");
return "rval from c1";
});
emitter.emit("thing", "happened", "ignored");
// Check that the promise is resolved asynchronously
let secondCallbackCalled = false;
let check2 = p.then(arg => {
ok(true, "second callback called");
is(arg, "happened", "correct arg in promise");
secondCallbackCalled = true;
is(arg, "happened", "correct arg in promise (a second time)");
return "rval from c2";
});
// Shouldn't call any of the above listeners
emitter.emit("thing", "trashinate");
// Check that we can still separate events with different names
// and that it works with no parameters
let pfoo = emitter.once("foo");
let pbar = emitter.once("bar");
let check3 = pfoo.then(arg => {
ok(arg === undefined, "no arg for foo event");
return "rval from c3";
});
pbar.then(() => {
ok(false, "pbar should not be called");
});
emitter.emit("foo");
is(secondCallbackCalled, false, "second callback not called yet");
return promise.all([ check1, check2, check3 ]).then(args => {
is(args[0], "rval from c1", "callback 1 done good");
is(args[1], "rval from c2", "callback 2 done good");
is(args[2], "rval from c3", "callback 3 done good");
});
}

Просмотреть файл

@ -11,7 +11,7 @@ const Cu = Components.utils;
const ENSURE_SELECTION_VISIBLE_DELAY = 50; // ms
Cu.import("resource:///modules/devtools/ViewHelpers.jsm");
Cu.import("resource:///modules/devtools/shared/event-emitter.js");
Cu.import("resource://gre/modules/devtools/event-emitter.js");
this.EXPORTED_SYMBOLS = ["BreadcrumbsWidget"];

Просмотреть файл

@ -20,7 +20,7 @@ const HOVERED_SLICE_TRANSLATE_DISTANCE_RATIO = 20;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource:///modules/devtools/ViewHelpers.jsm");
Cu.import("resource:///modules/devtools/shared/event-emitter.js");
Cu.import("resource://gre/modules/devtools/event-emitter.js");
this.EXPORTED_SYMBOLS = ["Chart"];

Просмотреть файл

@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const EventEmitter = require("devtools/shared/event-emitter");
const EventEmitter = require("devtools/toolkit/event-emitter");
const { Cu, Ci } = require("chrome");
const { ViewHelpers } = Cu.import("resource:///modules/devtools/ViewHelpers.jsm", {});

Просмотреть файл

@ -9,7 +9,7 @@ const Ci = Components.interfaces;
const Cu = Components.utils;
Cu.import("resource:///modules/devtools/ViewHelpers.jsm");
Cu.import("resource:///modules/devtools/shared/event-emitter.js");
Cu.import("resource://gre/modules/devtools/event-emitter.js");
this.EXPORTED_SYMBOLS = ["SideMenuWidget"];

Просмотреть файл

@ -4,7 +4,7 @@
"use strict";
const EventEmitter = require("devtools/shared/event-emitter");
const EventEmitter = require("devtools/toolkit/event-emitter");
/**
* Spectrum creates a color picker widget in any container you give it.

Просмотреть файл

@ -9,7 +9,7 @@ const promise = require("sdk/core/promise");
const IOService = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
const {Spectrum} = require("devtools/shared/widgets/Spectrum");
const EventEmitter = require("devtools/shared/event-emitter");
const EventEmitter = require("devtools/toolkit/event-emitter");
const {colorUtils} = require("devtools/css-color");
const Heritage = require("sdk/core/heritage");
const {CSSTransformPreviewer} = require("devtools/shared/widgets/CSSTransformPreviewer");

Просмотреть файл

@ -21,7 +21,7 @@ const ITEM_FLASH_DURATION = 300 // ms
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource:///modules/devtools/ViewHelpers.jsm");
Cu.import("resource:///modules/devtools/shared/event-emitter.js");
Cu.import("resource://gre/modules/devtools/event-emitter.js");
Cu.import("resource://gre/modules/devtools/DevToolsUtils.jsm");
Cu.import("resource://gre/modules/Task.jsm");
let promise = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js").Promise;

Просмотреть файл

@ -19,7 +19,7 @@ const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.x
const MAX_VERTICAL_OFFSET = 3;
const {Promise: promise} = Cu.import("resource://gre/modules/Promise.jsm", {});
const events = require("devtools/shared/event-emitter");
const events = require("devtools/toolkit/event-emitter");
Cu.import("resource://gre/modules/Services.jsm");
const L10N = Services.strings.createBundle(L10N_BUNDLE);

Просмотреть файл

@ -16,7 +16,7 @@ Cu.import("resource://gre/modules/PluralForm.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://gre/modules/osfile.jsm");
let promise = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js").Promise;
Cu.import("resource:///modules/devtools/shared/event-emitter.js");
Cu.import("resource://gre/modules/devtools/event-emitter.js");
Cu.import("resource:///modules/devtools/gDevTools.jsm");
Cu.import("resource:///modules/devtools/StyleEditorUtil.jsm");
Cu.import("resource:///modules/devtools/SplitView.jsm");

Просмотреть файл

@ -21,7 +21,7 @@ Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource:///modules/devtools/shared/event-emitter.js");
Cu.import("resource://gre/modules/devtools/event-emitter.js");
Cu.import("resource:///modules/devtools/StyleEditorUtil.jsm");
const LOAD_ERROR = "error-load";

Просмотреть файл

@ -10,7 +10,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
let promise = require("sdk/core/promise");
let EventEmitter = require("devtools/shared/event-emitter");
let EventEmitter = require("devtools/toolkit/event-emitter");
Cu.import("resource:///modules/devtools/StyleEditorUI.jsm");
Cu.import("resource:///modules/devtools/StyleEditorUtil.jsm");

Просмотреть файл

@ -7,7 +7,7 @@
const {Cc, Ci, Cu, Cr} = require("chrome");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource:///modules/devtools/shared/event-emitter.js");
Cu.import("resource://gre/modules/devtools/event-emitter.js");
exports.PREF_ORIG_SOURCES = "devtools.styleeditor.source-maps-enabled";

Просмотреть файл

@ -10,7 +10,7 @@ const ToolDefinitions = require("main").Tools;
const {CssLogic} = require("devtools/styleinspector/css-logic");
const {ELEMENT_STYLE} = require("devtools/server/actors/styles");
const promise = require("sdk/core/promise");
const {EventEmitter} = require("devtools/shared/event-emitter");
const {EventEmitter} = require("devtools/toolkit/event-emitter");
const {OutputParser} = require("devtools/output-parser");
const {Tooltip} = require("devtools/shared/widgets/Tooltip");
const {PrefObserver, PREF_ORIG_SOURCES} = require("devtools/styleeditor/utils");

Просмотреть файл

@ -10,7 +10,7 @@ const {Cu} = require("chrome");
let {TiltVisualizer} = require("devtools/tilt/tilt-visualizer");
let TiltGL = require("devtools/tilt/tilt-gl");
let TiltUtils = require("devtools/tilt/tilt-utils");
let EventEmitter = require("devtools/shared/event-emitter");
let EventEmitter = require("devtools/toolkit/event-emitter");
let Telemetry = require("devtools/shared/telemetry");
Cu.import("resource://gre/modules/Services.jsm");

Просмотреть файл

@ -9,7 +9,7 @@ const {Cc, Ci, Cu} = require("chrome");
loader.lazyImporter(this, "devtools", "resource://gre/modules/devtools/Loader.jsm");
loader.lazyImporter(this, "promise", "resource://gre/modules/Promise.jsm", "Promise");
loader.lazyGetter(this, "HUDService", () => require("devtools/webconsole/hudservice"));
loader.lazyGetter(this, "EventEmitter", () => require("devtools/shared/event-emitter"));
loader.lazyGetter(this, "EventEmitter", () => require("devtools/toolkit/event-emitter"));
loader.lazyImporter(this, "gDevTools", "resource:///modules/devtools/gDevTools.jsm");
/**

Просмотреть файл

@ -268,5 +268,6 @@ run-if = os == "mac"
[browser_webconsole_output_04.js]
[browser_webconsole_output_events.js]
[browser_console_variables_view_highlighter.js]
[browser_webconsole_start_netmon_first.js]
[browser_webconsole_console_trace_duplicates.js]
[browser_webconsole_cd_iframe.js]

Просмотреть файл

@ -0,0 +1,37 @@
/* 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/. */
// Check that the webconsole works if the network monitor is first opened, then
// the user switches to the webconsole. See bug 970914.
function test() {
Task.spawn(runner).then(finishTest);
function* runner() {
const {tab} = yield loadTab("data:text/html;charset=utf8,<p>hello");
const target = TargetFactory.forTab(tab);
const toolbox = yield gDevTools.showToolbox(target, "netmonitor");
const hud = yield openConsole(tab);
hud.jsterm.execute("console.log('foobar bug970914')");
yield waitForMessages({
webconsole: hud,
messages: [{
name: "console.log",
text: "foobar bug970914",
category: CATEGORY_WEBDEV,
severity: SEVERITY_LOG,
}],
});
let text = hud.outputNode.textContent;
isnot(text.indexOf("foobar bug970914"), -1, "console.log message confirmed");
ok(!/logging API|disabled by a script/i.test(text),
"no warning about disabled console API");
}
}

Просмотреть файл

@ -15,7 +15,7 @@ loader.lazyServiceGetter(this, "clipboardHelper",
"nsIClipboardHelper");
loader.lazyImporter(this, "Services", "resource://gre/modules/Services.jsm");
loader.lazyImporter(this, "promise", "resource://gre/modules/Promise.jsm", "Promise");
loader.lazyGetter(this, "EventEmitter", () => require("devtools/shared/event-emitter"));
loader.lazyGetter(this, "EventEmitter", () => require("devtools/toolkit/event-emitter"));
loader.lazyGetter(this, "AutocompletePopup",
() => require("devtools/shared/autocomplete-popup").AutocompletePopup);
loader.lazyGetter(this, "ToolSidebar",

Просмотреть файл

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

Просмотреть файл

@ -541,10 +541,23 @@ var RangedChromeActions = (function RangedChromeActionsClosure() {
};
originalRequest.visitRequestHeaders(httpHeaderVisitor);
var self = this;
var xhr_onreadystatechange = function xhr_onreadystatechange() {
if (this.readyState === 1) { // LOADING
var netChannel = this.channel;
if ('nsIPrivateBrowsingChannel' in Ci &&
netChannel instanceof Ci.nsIPrivateBrowsingChannel) {
var docIsPrivate = self.isInPrivateBrowsing();
netChannel.setPrivate(docIsPrivate);
}
}
};
var getXhr = function getXhr() {
const XMLHttpRequest = Components.Constructor(
'@mozilla.org/xmlextras/xmlhttprequest;1');
return new XMLHttpRequest();
var xhr = new XMLHttpRequest();
xhr.addEventListener('readystatechange', xhr_onreadystatechange);
return xhr;
};
this.networkManager = new NetworkManager(this.pdfUrl, {
@ -552,7 +565,6 @@ var RangedChromeActions = (function RangedChromeActionsClosure() {
getXhr: getXhr
});
var self = this;
// If we are in range request mode, this means we manually issued xhr
// requests, which we need to abort when we leave the page
domWindow.addEventListener('unload', function unload(e) {

Просмотреть файл

@ -20,8 +20,8 @@ if (typeof PDFJS === 'undefined') {
(typeof window !== 'undefined' ? window : this).PDFJS = {};
}
PDFJS.version = '0.8.990';
PDFJS.build = '54f6291';
PDFJS.version = '0.8.1041';
PDFJS.build = '2188bcb';
(function pdfjsWrapper() {
// Use strict in our context only - users might not want it
@ -3309,7 +3309,7 @@ var LinkAnnotation = (function LinkAnnotationClosure() {
if (isName(url)) {
// Some bad PDFs do not put parentheses around relative URLs.
url = '/' + url.name;
} else {
} else if (url) {
url = addDefaultProtocolToUrl(url);
}
// TODO: pdf spec mentions urls can be relative to a Base
@ -3349,7 +3349,7 @@ var LinkAnnotation = (function LinkAnnotationClosure() {
// Lets URLs beginning with 'www.' default to using the 'http://' protocol.
function addDefaultProtocolToUrl(url) {
if (url.indexOf('www.') === 0) {
if (url && url.indexOf('www.') === 0) {
return ('http://' + url);
}
return url;
@ -4086,6 +4086,7 @@ var WorkerTransport = (function WorkerTransportClosure() {
messageHandler.on('GetDoc', function transportDoc(data) {
var pdfInfo = data.pdfInfo;
this.numPages = data.pdfInfo.numPages;
var pdfDocument = new PDFDocumentProxy(pdfInfo, this);
this.pdfDocument = pdfDocument;
this.workerReadyPromise.resolve(pdfDocument);
@ -4290,6 +4291,13 @@ var WorkerTransport = (function WorkerTransportClosure() {
},
getPage: function WorkerTransport_getPage(pageNumber, promise) {
if (pageNumber <= 0 || pageNumber > this.numPages ||
(pageNumber|0) !== pageNumber) {
var pagePromise = new PDFJS.LegacyPromise();
pagePromise.reject(new Error('Invalid page request'));
return pagePromise;
}
var pageIndex = pageNumber - 1;
if (pageIndex in this.pagePromises)
return this.pagePromises[pageIndex];

Просмотреть файл

@ -20,8 +20,8 @@ if (typeof PDFJS === 'undefined') {
(typeof window !== 'undefined' ? window : this).PDFJS = {};
}
PDFJS.version = '0.8.990';
PDFJS.build = '54f6291';
PDFJS.version = '0.8.1041';
PDFJS.build = '2188bcb';
(function pdfjsWrapper() {
// Use strict in our context only - users might not want it
@ -3309,7 +3309,7 @@ var LinkAnnotation = (function LinkAnnotationClosure() {
if (isName(url)) {
// Some bad PDFs do not put parentheses around relative URLs.
url = '/' + url.name;
} else {
} else if (url) {
url = addDefaultProtocolToUrl(url);
}
// TODO: pdf spec mentions urls can be relative to a Base
@ -3349,7 +3349,7 @@ var LinkAnnotation = (function LinkAnnotationClosure() {
// Lets URLs beginning with 'www.' default to using the 'http://' protocol.
function addDefaultProtocolToUrl(url) {
if (url.indexOf('www.') === 0) {
if (url && url.indexOf('www.') === 0) {
return ('http://' + url);
}
return url;
@ -3877,6 +3877,9 @@ var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
// The maximum number of bytes fetched per range request
var RANGE_CHUNK_SIZE = 65536;
// TODO(mack): Make use of PDFJS.Util.inherit() when it becomes available
var BasePdfManager = (function BasePdfManagerClosure() {
function BasePdfManager() {
@ -3990,9 +3993,6 @@ var LocalPdfManager = (function LocalPdfManagerClosure() {
})();
var NetworkPdfManager = (function NetworkPdfManagerClosure() {
var CHUNK_SIZE = 65536;
function NetworkPdfManager(args, msgHandler) {
this.msgHandler = msgHandler;
@ -4005,7 +4005,7 @@ var NetworkPdfManager = (function NetworkPdfManagerClosure() {
disableAutoFetch: args.disableAutoFetch,
initialData: args.initialData
};
this.streamManager = new ChunkedStreamManager(args.length, CHUNK_SIZE,
this.streamManager = new ChunkedStreamManager(args.length, RANGE_CHUNK_SIZE,
args.url, params);
this.pdfModel = new PDFDocument(this, this.streamManager.getStream(),
@ -31953,47 +31953,85 @@ var Lexer = (function LexerClosure() {
nextChar: function Lexer_nextChar() {
return (this.currentChar = this.stream.getByte());
},
peekChar: function Lexer_peekChar() {
return this.stream.peekBytes(1)[0];
},
getNumber: function Lexer_getNumber() {
var floating = false;
var ch = this.currentChar;
var allDigits = ch >= 0x30 && ch <= 0x39;
var strBuf = this.strBuf;
strBuf.length = 0;
strBuf.push(String.fromCharCode(ch));
var eNotation = false;
var divideBy = 0; // different from 0 if it's a floating point value
var sign = 1;
if (ch === 0x2D) { // '-'
sign = -1;
ch = this.nextChar();
} else if (ch === 0x2B) { // '+'
ch = this.nextChar();
}
if (ch === 0x2E) { // '.'
divideBy = 10;
ch = this.nextChar();
}
if (ch < 0x30 || ch > 0x39) { // '0' - '9'
error('Invalid number: ' + String.fromCharCode(ch));
return 0;
}
var baseValue = ch - 0x30; // '0'
var powerValue = 0;
var powerValueSign = 1;
while ((ch = this.nextChar()) >= 0) {
if (ch >= 0x30 && ch <= 0x39) { // '0'-'9'
strBuf.push(String.fromCharCode(ch));
} else if (ch === 0x2E && !floating) { // '.'
strBuf.push('.');
floating = true;
allDigits = false;
if (0x30 <= ch && ch <= 0x39) { // '0' - '9'
var currentDigit = ch - 0x30; // '0'
if (eNotation) { // We are after an 'e' or 'E'
powerValue = powerValue * 10 + currentDigit;
} else {
if (divideBy !== 0) { // We are after a point
divideBy *= 10;
}
baseValue = baseValue * 10 + currentDigit;
}
} else if (ch === 0x2E) { // '.'
if (divideBy === 0) {
divideBy = 1;
} else {
// A number can have only one '.'
break;
}
} else if (ch === 0x2D) { // '-'
// ignore minus signs in the middle of numbers to match
// Adobe's behavior
warn('Badly formated number');
allDigits = false;
} else if (ch === 0x45 || ch === 0x65) { // 'E', 'e'
floating = true;
allDigits = false;
// 'E' can be either a scientific notation or the beginning of a new
// operator
var hasE = true;
ch = this.peekChar();
if (ch === 0x2B || ch === 0x2D) { // '+', '-'
powerValueSign = (ch === 0x2D) ? -1 : 1;
this.nextChar(); // Consume the sign character
} else if (ch < 0x30 || ch > 0x39) { // '0' - '9'
// The 'E' must be the beginning of a new operator
break;
}
eNotation = true;
} else {
// the last character doesn't belong to us
break;
}
}
var value;
if (allDigits) {
value = 0;
var charCodeOfZero = 48; // '0'
for (var i = 0, ii = strBuf.length; i < ii; i++) {
value = value * 10 + (strBuf[i].charCodeAt(0) - charCodeOfZero);
if (divideBy !== 0) {
baseValue /= divideBy;
}
} else {
value = parseFloat(strBuf.join(''));
if (isNaN(value)) {
error('Invalid floating point number: ' + value);
if (eNotation) {
baseValue *= Math.pow(10, powerValueSign * powerValue);
}
}
return value;
return sign * baseValue;
},
getString: function Lexer_getString() {
var numParen = 1;
@ -34948,6 +34986,13 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
if (!isInt(length)) {
return;
}
source.length = length;
if (length <= 2 * RANGE_CHUNK_SIZE) {
// The file size is smaller than the size of two chunks, so it does
// not make any sense to abort the request and retry with a range
// request.
return;
}
// NOTE: by cancelling the full request, and then issuing range
// requests, there will be an issue for sites where you can only
@ -34955,7 +35000,6 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
// server should not be returning that it can support range requests.
networkManager.abortRequest(fullRequestXhrId);
source.length = length;
try {
pdfManager = new NetworkPdfManager(source, handler);
pdfManagerPromise.resolve(pdfManager);
@ -35159,8 +35203,8 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
// Pre compile the pdf page and fetch the fonts/images.
page.getOperatorList(handler).then(function(operatorList) {
info('page=%d - getOperatorList: time=%dms, len=%d', pageNum,
Date.now() - start, operatorList.fnArray.length);
info('page=' + pageNum + ' - getOperatorList: time=' +
(Date.now() - start) + 'ms, len=' + operatorList.fnArray.length);
}, function(e) {
@ -35201,8 +35245,8 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
var start = Date.now();
page.extractTextContent().then(function(textContent) {
deferred.resolve(textContent);
info('text indexing: page=%d - time=%dms', pageNum,
Date.now() - start);
info('text indexing: page=' + pageNum + ' - time=' +
(Date.now() - start) + 'ms');
}, function (e) {
// Skip errored pages
deferred.reject(e);
@ -35224,8 +35268,43 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
var consoleTimer = {};
var workerConsole = {
log: function log() {
var args = Array.prototype.slice.call(arguments);
globalScope.postMessage({
action: 'console_log',
data: args
});
},
error: function error() {
var args = Array.prototype.slice.call(arguments);
globalScope.postMessage({
action: 'console_error',
data: args
});
throw 'pdf.js execution error';
},
time: function time(name) {
consoleTimer[name] = Date.now();
},
timeEnd: function timeEnd(name) {
var time = consoleTimer[name];
if (!time) {
error('Unknown timer name ' + name);
}
this.log('Timer:', name, Date.now() - time);
}
};
// Worker thread?
if (typeof window === 'undefined') {
if (!('console' in globalScope)) {
globalScope.console = workerConsole;
}
// Listen for unsupported features so we can pass them on to the main thread.
PDFJS.UnsupportedManager.listen(function (msg) {
@ -36914,18 +36993,18 @@ var JpxImage = (function JpxImageClosure() {
}
return ll;
};
Transform.prototype.expand = function expand(buffer, bufferPadding, step) {
Transform.prototype.extend = function extend(buffer, offset, size) {
// Section F.3.7 extending... using max extension of 4
var i1 = bufferPadding - 1, j1 = bufferPadding + 1;
var i2 = bufferPadding + step - 2, j2 = bufferPadding + step;
buffer[i1--] = buffer[j1++];
buffer[j2++] = buffer[i2--];
var i1 = offset - 1, j1 = offset + 1;
var i2 = offset + size - 2, j2 = offset + size;
buffer[i1--] = buffer[j1++];
buffer[j2++] = buffer[i2--];
buffer[i1--] = buffer[j1++];
buffer[j2++] = buffer[i2--];
buffer[i1--] = buffer[j1++];
buffer[j2++] = buffer[i2--];
buffer[i1] = buffer[j1];
buffer[j2] = buffer[i2];
};
Transform.prototype.iterate = function Transform_iterate(ll, hl, lh, hh,
u0, v0) {
@ -36938,32 +37017,35 @@ var JpxImage = (function JpxImageClosure() {
var width = llWidth + hlWidth;
var height = llHeight + lhHeight;
var items = new Float32Array(width * height);
for (var i = 0, ii = llHeight; i < ii; i++) {
var i, j, k, l;
for (i = 0; i < llHeight; i++) {
var k = i * llWidth, l = i * 2 * width;
for (var j = 0, jj = llWidth; j < jj; j++, k++, l += 2)
for (var j = 0; j < llWidth; j++, k++, l += 2) {
items[l] = llItems[k];
}
for (var i = 0, ii = hlHeight; i < ii; i++) {
var k = i * hlWidth, l = i * 2 * width + 1;
for (var j = 0, jj = hlWidth; j < jj; j++, k++, l += 2)
}
for (i = 0; i < hlHeight; i++) {
k = i * hlWidth, l = i * 2 * width + 1;
for (j = 0; j < hlWidth; j++, k++, l += 2) {
items[l] = hlItems[k];
}
for (var i = 0, ii = lhHeight; i < ii; i++) {
var k = i * lhWidth, l = (i * 2 + 1) * width;
for (var j = 0, jj = lhWidth; j < jj; j++, k++, l += 2)
}
for (i = 0; i < lhHeight; i++) {
k = i * lhWidth, l = (i * 2 + 1) * width;
for (j = 0; j < lhWidth; j++, k++, l += 2) {
items[l] = lhItems[k];
}
for (var i = 0, ii = hhHeight; i < ii; i++) {
var k = i * hhWidth, l = (i * 2 + 1) * width + 1;
for (var j = 0, jj = hhWidth; j < jj; j++, k++, l += 2)
}
for (i = 0; i < hhHeight; i++) {
k = i * hhWidth, l = (i * 2 + 1) * width + 1;
for (j = 0; j < hhWidth; j++, k++, l += 2) {
items[l] = hhItems[k];
}
}
var bufferPadding = 4;
var bufferLength = new Float32Array(Math.max(width, height) +
2 * bufferPadding);
var buffer = new Float32Array(bufferLength);
var bufferOut = new Float32Array(bufferLength);
var rowBuffer = new Float32Array(width + 2 * bufferPadding);
// Section F.3.4 HOR_SR
for (var v = 0; v < height; v++) {
@ -36974,21 +37056,28 @@ var JpxImage = (function JpxImageClosure() {
}
continue;
}
var k = v * width;
var l = bufferPadding;
for (var u = 0; u < width; u++, k++, l++)
buffer[l] = items[k];
this.expand(buffer, bufferPadding, width);
this.filter(buffer, bufferPadding, width, u0, bufferOut);
k = v * width;
l = bufferPadding;
for (var u = 0; u < width; u++, k++, l++)
items[k] = bufferOut[l];
rowBuffer.set(items.subarray(k, k + width), bufferPadding);
this.extend(rowBuffer, bufferPadding, width);
this.filter(rowBuffer, bufferPadding, width, u0, rowBuffer);
items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
}
// Accesses to the items array can take long, because it may not fit into
// CPU cache and has to be fetched from main memory. Since subsequent
// accesses to the items array are not local when reading columns, we
// have a cache miss every time. To reduce cache misses, get up to
// 'numBuffers' items at a time and store them into the individual
// buffers. The colBuffers should be small enough to fit into CPU cache.
var numBuffers = 16;
var colBuffers = [];
for (i = 0; i < numBuffers; i++) {
colBuffers.push(new Float32Array(height + 2 * bufferPadding));
}
var b, currentBuffer = 0, ll = bufferPadding + height;
// Section F.3.5 VER_SR
for (var u = 0; u < width; u++) {
if (height == 1) {
@ -36999,19 +37088,33 @@ var JpxImage = (function JpxImageClosure() {
continue;
}
var k = u;
var l = bufferPadding;
for (var v = 0; v < height; v++, k += width, l++)
buffer[l] = items[k];
this.expand(buffer, bufferPadding, height);
this.filter(buffer, bufferPadding, height, v0, bufferOut);
k = u;
l = bufferPadding;
for (var v = 0; v < height; v++, k += width, l++)
items[k] = bufferOut[l];
// if we ran out of buffers, copy several image columns at once
if (currentBuffer === 0) {
numBuffers = Math.min(width - u, numBuffers);
for (k = u, l = bufferPadding; l < ll; k += width, l++) {
for (b = 0; b < numBuffers; b++) {
colBuffers[b][l] = items[k + b];
}
}
currentBuffer = numBuffers;
}
currentBuffer--;
var buffer = colBuffers[currentBuffer];
this.extend(buffer, bufferPadding, height);
this.filter(buffer, bufferPadding, height, v0, buffer);
// If this is last buffer in this group of buffers, flush all buffers.
if (currentBuffer === 0) {
k = u - numBuffers + 1;
for (l = bufferPadding; l < ll; k += width, l++) {
for (b = 0; b < numBuffers; b++) {
items[k + b] = colBuffers[b][l];
}
}
}
}
return {
width: width,
height: height,
@ -39413,17 +39516,16 @@ var JpegImage = (function jpegImage() {
var blocksPerLine = component.blocksPerLine;
var blocksPerColumn = component.blocksPerColumn;
var samplesPerLine = blocksPerLine << 3;
var R = new Int32Array(64), r = new Uint8Array(64);
var R = new Int32Array(64);
// A port of poppler's IDCT method which in turn is taken from:
// Christoph Loeffler, Adriaan Ligtenberg, George S. Moschytz,
// "Practical Fast 1-D DCT Algorithms with 11 Multiplications",
// IEEE Intl. Conf. on Acoustics, Speech & Signal Processing, 1989,
// 988-991.
function quantizeAndInverse(zz, dataOut, dataIn) {
function quantizeAndInverse(zz, p) {
var qt = component.quantizationTable;
var v0, v1, v2, v3, v4, v5, v6, v7, t;
var p = dataIn;
var i;
// dequant
@ -39507,7 +39609,7 @@ var JpegImage = (function jpegImage() {
if (p[1*8 + col] == 0 && p[2*8 + col] == 0 && p[3*8 + col] == 0 &&
p[4*8 + col] == 0 && p[5*8 + col] == 0 && p[6*8 + col] == 0 &&
p[7*8 + col] == 0) {
t = (dctSqrt2 * dataIn[i+0] + 8192) >> 14;
t = (dctSqrt2 * p[i+0] + 8192) >> 14;
p[0*8 + col] = t;
p[1*8 + col] = t;
p[2*8 + col] = t;
@ -39570,8 +39672,7 @@ var JpegImage = (function jpegImage() {
// convert to 8-bit integers
for (i = 0; i < 64; ++i) {
var sample = 128 + ((p[i] + 8) >> 4);
dataOut[i] = sample < 0 ? 0 : sample > 0xFF ? 0xFF : sample;
p[i] = clampTo8bit((p[i] + 2056) >> 4);
}
}
@ -39581,13 +39682,13 @@ var JpegImage = (function jpegImage() {
for (i = 0; i < 8; i++)
lines.push(new Uint8Array(samplesPerLine));
for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) {
quantizeAndInverse(component.blocks[blockRow][blockCol], r, R);
quantizeAndInverse(component.blocks[blockRow][blockCol], R);
var offset = 0, sample = blockCol << 3;
for (j = 0; j < 8; j++) {
var line = lines[scanLine + j];
for (i = 0; i < 8; i++)
line[sample + i] = r[offset++];
line[sample + i] = R[offset++];
}
}
}
@ -39648,7 +39749,7 @@ var JpegImage = (function jpegImage() {
for (var i = 0; i < blocksPerColumnForMcu; i++) {
var row = [];
for (var j = 0; j < blocksPerLineForMcu; j++)
row.push(new Int32Array(64));
row.push(new Int16Array(64));
blocks.push(row);
}
component.blocksPerLine = blocksPerLine;
@ -39852,41 +39953,35 @@ var JpegImage = (function jpegImage() {
getData: function getData(width, height) {
var scaleX = this.width / width, scaleY = this.height / height;
var component1, component2, component3, component4;
var component1Line, component2Line, component3Line, component4Line;
var x, y;
var component, componentLine, componentScaleX, componentScaleY;
var x, y, i;
var offset = 0;
var Y, Cb, Cr, K, C, M, Ye, R, G, B;
var colorTransform;
var dataLength = width * height * this.components.length;
var numComponents = this.components.length;
var dataLength = width * height * numComponents;
var data = new Uint8Array(dataLength);
switch (this.components.length) {
case 1:
component1 = this.components[0];
for (y = 0; y < height; y++) {
component1Line = component1.lines[0 | (y * component1.scaleY * scaleY)];
for (x = 0; x < width; x++) {
Y = component1Line[0 | (x * component1.scaleX * scaleX)];
data[offset++] = Y;
}
}
break;
case 2:
// PDF might compress two component data in custom colorspace
component1 = this.components[0];
component2 = this.components[1];
// First construct image data ...
for (i = 0; i < numComponents; i++) {
component = this.components[i];
componentScaleX = component.scaleX * scaleX;
componentScaleY = component.scaleY * scaleY;
offset = i;
for (y = 0; y < height; y++) {
component1Line = component1.lines[0 | (y * component1.scaleY * scaleY)];
component2Line = component2.lines[0 | (y * component2.scaleY * scaleY)];
componentLine = component.lines[0 | (y * componentScaleY)];
for (x = 0; x < width; x++) {
Y = component1Line[0 | (x * component1.scaleX * scaleX)];
data[offset++] = Y;
Y = component2Line[0 | (x * component2.scaleX * scaleX)];
data[offset++] = Y;
data[offset] = componentLine[0 | (x * componentScaleX)];
offset += numComponents;
}
}
break;
}
// ... then transform colors, if necessary
switch (numComponents) {
case 1: case 2: break;
// no color conversion for one or two compoenents
case 3:
// The default transform for three components is true
colorTransform = true;
@ -39896,31 +39991,19 @@ var JpegImage = (function jpegImage() {
else if (typeof this.colorTransform !== 'undefined')
colorTransform = !!this.colorTransform;
component1 = this.components[0];
component2 = this.components[1];
component3 = this.components[2];
for (y = 0; y < height; y++) {
component1Line = component1.lines[0 | (y * component1.scaleY * scaleY)];
component2Line = component2.lines[0 | (y * component2.scaleY * scaleY)];
component3Line = component3.lines[0 | (y * component3.scaleY * scaleY)];
for (x = 0; x < width; x++) {
if (!colorTransform) {
R = component1Line[0 | (x * component1.scaleX * scaleX)];
G = component2Line[0 | (x * component2.scaleX * scaleX)];
B = component3Line[0 | (x * component3.scaleX * scaleX)];
} else {
Y = component1Line[0 | (x * component1.scaleX * scaleX)];
Cb = component2Line[0 | (x * component2.scaleX * scaleX)];
Cr = component3Line[0 | (x * component3.scaleX * scaleX)];
if (colorTransform) {
for (i = 0; i < dataLength; i += numComponents) {
Y = data[i ];
Cb = data[i + 1];
Cr = data[i + 2];
R = clampTo8bit(Y + 1.402 * (Cr - 128));
G = clampTo8bit(Y - 0.3441363 * (Cb - 128) - 0.71413636 * (Cr - 128));
B = clampTo8bit(Y + 1.772 * (Cb - 128));
}
data[offset++] = R;
data[offset++] = G;
data[offset++] = B;
data[i ] = R;
data[i + 1] = G;
data[i + 2] = B;
}
}
break;
@ -39933,35 +40016,20 @@ var JpegImage = (function jpegImage() {
else if (typeof this.colorTransform !== 'undefined')
colorTransform = !!this.colorTransform;
component1 = this.components[0];
component2 = this.components[1];
component3 = this.components[2];
component4 = this.components[3];
for (y = 0; y < height; y++) {
component1Line = component1.lines[0 | (y * component1.scaleY * scaleY)];
component2Line = component2.lines[0 | (y * component2.scaleY * scaleY)];
component3Line = component3.lines[0 | (y * component3.scaleY * scaleY)];
component4Line = component4.lines[0 | (y * component4.scaleY * scaleY)];
for (x = 0; x < width; x++) {
if (!colorTransform) {
C = component1Line[0 | (x * component1.scaleX * scaleX)];
M = component2Line[0 | (x * component2.scaleX * scaleX)];
Ye = component3Line[0 | (x * component3.scaleX * scaleX)];
K = component4Line[0 | (x * component4.scaleX * scaleX)];
} else {
Y = component1Line[0 | (x * component1.scaleX * scaleX)];
Cb = component2Line[0 | (x * component2.scaleX * scaleX)];
Cr = component3Line[0 | (x * component3.scaleX * scaleX)];
K = component4Line[0 | (x * component4.scaleX * scaleX)];
if (colorTransform) {
for (i = 0; i < dataLength; i += numComponents) {
Y = data[i];
Cb = data[i + 1];
Cr = data[i + 2];
C = 255 - clampTo8bit(Y + 1.402 * (Cr - 128));
M = 255 - clampTo8bit(Y - 0.3441363 * (Cb - 128) - 0.71413636 * (Cr - 128));
Ye = 255 - clampTo8bit(Y + 1.772 * (Cb - 128));
}
data[offset++] = C;
data[offset++] = M;
data[offset++] = Ye;
data[offset++] = K;
data[i ] = C;
data[i + 1] = M;
data[i + 2] = Ye;
// K is unchanged
}
}
break;
@ -39972,14 +40040,14 @@ var JpegImage = (function jpegImage() {
},
copyToImageData: function copyToImageData(imageData) {
var width = imageData.width, height = imageData.height;
var imageDataBytes = width * height * 4;
var imageDataArray = imageData.data;
var data = this.getData(width, height);
var i = 0, j = 0, x, y;
var i = 0, j = 0;
var Y, K, C, M, R, G, B;
switch (this.components.length) {
case 1:
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
while (j < imageDataBytes) {
Y = data[i++];
imageDataArray[j++] = Y;
@ -39987,11 +40055,9 @@ var JpegImage = (function jpegImage() {
imageDataArray[j++] = Y;
imageDataArray[j++] = 255;
}
}
break;
case 3:
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
while (j < imageDataBytes) {
R = data[i++];
G = data[i++];
B = data[i++];
@ -40001,11 +40067,9 @@ var JpegImage = (function jpegImage() {
imageDataArray[j++] = B;
imageDataArray[j++] = 255;
}
}
break;
case 4:
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
while (j < imageDataBytes) {
C = data[i++];
M = data[i++];
Y = data[i++];
@ -40020,7 +40084,6 @@ var JpegImage = (function jpegImage() {
imageDataArray[j++] = B;
imageDataArray[j++] = 255;
}
}
break;
default:
throw 'Unsupported color mode';

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 272 B

После

Ширина:  |  Высота:  |  Размер: 199 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 304 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 268 B

После

Ширина:  |  Высота:  |  Размер: 193 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 296 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 268 B

После

Ширина:  |  Высота:  |  Размер: 193 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 296 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 272 B

После

Ширина:  |  Высота:  |  Размер: 199 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 304 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.2 KiB

После

Ширина:  |  Высота:  |  Размер: 403 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 933 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 340 B

После

Ширина:  |  Высота:  |  Размер: 179 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 266 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 250 B

После

Ширина:  |  Высота:  |  Размер: 301 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 583 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 315 B

После

Ширина:  |  Высота:  |  Размер: 175 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 276 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 414 B

После

Ширина:  |  Высота:  |  Размер: 360 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 731 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 414 B

После

Ширина:  |  Высота:  |  Размер: 359 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 714 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 210 B

После

Ширина:  |  Высота:  |  Размер: 174 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 260 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 343 B

После

Ширина:  |  Высота:  |  Размер: 259 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 425 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 200 B

После

Ширина:  |  Высота:  |  Размер: 108 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 152 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 348 B

После

Ширина:  |  Высота:  |  Размер: 295 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 550 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 462 B

После

Ширина:  |  Высота:  |  Размер: 242 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 398 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 296 B

После

Ширина:  |  Высота:  |  Размер: 238 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 396 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 310 B

После

Ширина:  |  Высота:  |  Размер: 245 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 405 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 307 B

После

Ширина:  |  Высота:  |  Размер: 246 B

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше