mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-27 19:07:31 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
3
dom/media/webvtt/WebVTT.manifest
Normal file
3
dom/media/webvtt/WebVTT.manifest
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# WebVTTParserWrapper
|
||||
component {acf6e493-0092-4b26-b172-241e375c57ab} WebVTTParserWrapper.js
|
||||
contract @mozilla.org/webvttParserWrapper;1 {acf6e493-0092-4b26-b172-241e375c57ab}
|
||||
72
dom/media/webvtt/WebVTTParserWrapper.js
Normal file
72
dom/media/webvtt/WebVTTParserWrapper.js
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/* 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/. */
|
||||
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Components.utils.import("resource://gre/modules/vtt.jsm");
|
||||
|
||||
var Ci = Components.interfaces;
|
||||
|
||||
var WEBVTTPARSERWRAPPER_CID = "{acf6e493-0092-4b26-b172-241e375c57ab}";
|
||||
var WEBVTTPARSERWRAPPER_CONTRACTID = "@mozilla.org/webvttParserWrapper;1";
|
||||
|
||||
function WebVTTParserWrapper()
|
||||
{
|
||||
// Nothing
|
||||
}
|
||||
|
||||
WebVTTParserWrapper.prototype =
|
||||
{
|
||||
loadParser: function(window)
|
||||
{
|
||||
this.parser = new WebVTT.Parser(window, new TextDecoder("utf8"));
|
||||
},
|
||||
|
||||
parse: function(data)
|
||||
{
|
||||
// We can safely translate the string data to a Uint8Array as we are
|
||||
// guaranteed character codes only from \u0000 => \u00ff
|
||||
var buffer = new Uint8Array(data.length);
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
buffer[i] = data.charCodeAt(i);
|
||||
}
|
||||
|
||||
this.parser.parse(buffer);
|
||||
},
|
||||
|
||||
flush: function()
|
||||
{
|
||||
this.parser.flush();
|
||||
},
|
||||
|
||||
watch: function(callback)
|
||||
{
|
||||
this.parser.oncue = callback.onCue;
|
||||
this.parser.onregion = callback.onRegion;
|
||||
this.parser.onparsingerror = function(e) {
|
||||
// Passing the just the error code back is enough for our needs.
|
||||
callback.onParsingError(("code" in e) ? e.code : -1);
|
||||
};
|
||||
},
|
||||
|
||||
convertCueToDOMTree: function(window, cue)
|
||||
{
|
||||
return WebVTT.convertCueToDOMTree(window, cue.text);
|
||||
},
|
||||
|
||||
processCues: function(window, cues, overlay, controls)
|
||||
{
|
||||
WebVTT.processCues(window, cues, overlay, controls);
|
||||
},
|
||||
|
||||
classDescription: "Wrapper for the JS WebVTT implementation (vtt.js)",
|
||||
classID: Components.ID(WEBVTTPARSERWRAPPER_CID),
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebVTTParserWrapper]),
|
||||
classInfo: XPCOMUtils.generateCI({
|
||||
classID: WEBVTTPARSERWRAPPER_CID,
|
||||
contractID: WEBVTTPARSERWRAPPER_CONTRACTID,
|
||||
interfaces: [Ci.nsIWebVTTParserWrapper]
|
||||
})
|
||||
};
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([WebVTTParserWrapper]);
|
||||
21
dom/media/webvtt/moz.build
Normal file
21
dom/media/webvtt/moz.build
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
'nsIWebVTTListener.idl',
|
||||
'nsIWebVTTParserWrapper.idl',
|
||||
]
|
||||
|
||||
XPIDL_MODULE = 'webvtt'
|
||||
|
||||
EXTRA_COMPONENTS += [
|
||||
'WebVTT.manifest',
|
||||
'WebVTTParserWrapper.js',
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES += [
|
||||
'vtt.jsm',
|
||||
]
|
||||
37
dom/media/webvtt/nsIWebVTTListener.idl
Normal file
37
dom/media/webvtt/nsIWebVTTListener.idl
Normal file
|
|
@ -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/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
/**
|
||||
* Listener for a JS WebVTT parser (vtt.js).
|
||||
*/
|
||||
[scriptable, uuid(8a2d7780-2045-4a29-99f4-df15cae5fc49)]
|
||||
interface nsIWebVTTListener : nsISupports
|
||||
{
|
||||
/**
|
||||
* Is called when the WebVTTParser successfully parses a WebVTT cue.
|
||||
*
|
||||
* @param cue An object representing the data of a parsed WebVTT cue.
|
||||
*/
|
||||
[implicit_jscontext]
|
||||
void onCue(in jsval cue);
|
||||
|
||||
/**
|
||||
* Is called when the WebVTT parser successfully parses a WebVTT region.
|
||||
*
|
||||
* @param region An object representing the data of a parsed
|
||||
* WebVTT region.
|
||||
*/
|
||||
[implicit_jscontext]
|
||||
void onRegion(in jsval region);
|
||||
|
||||
/**
|
||||
* Is called when the WebVTT parser encounters a parsing error.
|
||||
*
|
||||
* @param error The error code of the ParserError the occured.
|
||||
*/
|
||||
[implicit_jscontext]
|
||||
void onParsingError(in long errorCode);
|
||||
};
|
||||
88
dom/media/webvtt/nsIWebVTTParserWrapper.idl
Normal file
88
dom/media/webvtt/nsIWebVTTParserWrapper.idl
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
/* 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/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMHTMLElement;
|
||||
interface nsIWebVTTListener;
|
||||
interface mozIDOMWindow;
|
||||
interface nsIVariant;
|
||||
|
||||
/**
|
||||
* Interface for a wrapper of a JS WebVTT parser (vtt.js).
|
||||
*/
|
||||
[scriptable, uuid(8dfe016e-1701-4618-9f5e-9a6154e853f0)]
|
||||
interface nsIWebVTTParserWrapper : nsISupports
|
||||
{
|
||||
/**
|
||||
* Loads the JS WebVTTParser and sets it to use the passed window to create
|
||||
* VTTRegions and VTTCues. This function must be called before calling
|
||||
* parse, flush, or watch.
|
||||
*
|
||||
* @param window The window that the parser will use to create VTTCues and
|
||||
* VTTRegions.
|
||||
*
|
||||
*/
|
||||
void loadParser(in mozIDOMWindow window);
|
||||
|
||||
/**
|
||||
* Attempts to parse the stream's data as WebVTT format. When it successfully
|
||||
* parses a WebVTT region or WebVTT cue it will create a VTTRegion or VTTCue
|
||||
* object and pass it back to the callee through its callbacks.
|
||||
*
|
||||
* @param data The buffer that contains the WebVTT data received by the
|
||||
* Necko consumer so far.
|
||||
*/
|
||||
void parse(in ACString data);
|
||||
|
||||
/**
|
||||
* Flush indicates that no more data is expected from the stream. As such the
|
||||
* parser should try to parse any kind of partial data it has.
|
||||
*/
|
||||
void flush();
|
||||
|
||||
/**
|
||||
* Set this parser object to use an nsIWebVTTListener object for its onCue
|
||||
* and onRegion callbacks.
|
||||
*
|
||||
* @param callback The nsIWebVTTListener object that exposes onCue and
|
||||
* onRegion callbacks for the parser.
|
||||
*/
|
||||
void watch(in nsIWebVTTListener callback);
|
||||
|
||||
/**
|
||||
* Convert the text content of a WebVTT cue to a document fragment so that
|
||||
* we can display it on the page.
|
||||
*
|
||||
* @param window A window object with which the document fragment will be
|
||||
* created.
|
||||
* @param cue The cue whose content will be converted to a document
|
||||
* fragment.
|
||||
*/
|
||||
nsIDOMHTMLElement convertCueToDOMTree(in mozIDOMWindow window,
|
||||
in nsISupports cue);
|
||||
|
||||
|
||||
/**
|
||||
* Compute the display state of the VTTCues in cues along with any VTTRegions
|
||||
* that they might be in. First, it computes the positioning and styling of
|
||||
* the cues and regions passed and converts them into a DOM tree rooted at
|
||||
* a containing HTMLDivElement. It then adjusts those computed divs for
|
||||
* overlap avoidance using the dimensions of 'overlay'. Finally, it adds the
|
||||
* computed divs to the VTTCues display state property for use later.
|
||||
*
|
||||
* @param window A window object with which it will create the DOM tree
|
||||
* and containing div element.
|
||||
* @param cues An array of VTTCues who need there display state to be
|
||||
* computed.
|
||||
* @param overlay The HTMLElement that the cues will be displayed within.
|
||||
* @param controls The video control element that will affect cues position.
|
||||
*/
|
||||
void processCues(in mozIDOMWindow window, in nsIVariant cues,
|
||||
in nsISupports overlay, in nsISupports controls);
|
||||
};
|
||||
|
||||
%{C++
|
||||
#define NS_WEBVTTPARSERWRAPPER_CONTRACTID "@mozilla.org/webvttParserWrapper;1"
|
||||
%}
|
||||
6
dom/media/webvtt/package.json
Normal file
6
dom/media/webvtt/package.json
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"devDependencies": {
|
||||
"gift": "~0.0.6",
|
||||
"optimist": "~0.6.0"
|
||||
}
|
||||
}
|
||||
55
dom/media/webvtt/update-webvtt.js
Normal file
55
dom/media/webvtt/update-webvtt.js
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
#!/usr/bin/env node
|
||||
var gift = require('gift'),
|
||||
fs = require('fs'),
|
||||
argv = require('optimist')
|
||||
.usage('Update vtt.jsm with the latest from a vtt.js directory.\nUsage:' +
|
||||
' $0 -d [dir]')
|
||||
.demand('d')
|
||||
.options('d', {
|
||||
alias: 'dir',
|
||||
describe: 'Path to WebVTT directory.'
|
||||
})
|
||||
.options('r', {
|
||||
alias: 'rev',
|
||||
describe: 'Revision to update to.',
|
||||
default: 'master'
|
||||
})
|
||||
.options('w', {
|
||||
alias: 'write',
|
||||
describe: 'Path to file to write to.',
|
||||
default: "./vtt.jsm"
|
||||
})
|
||||
.argv;
|
||||
|
||||
var repo = gift(argv.d);
|
||||
repo.status(function(err, status) {
|
||||
if (!status.clean) {
|
||||
console.log("The repository's working directory is not clean. Aborting.");
|
||||
process.exit(1);
|
||||
}
|
||||
repo.checkout(argv.r, function() {
|
||||
repo.commits(argv.r, 1, function(err, commits) {
|
||||
var vttjs = fs.readFileSync(argv.d + "/lib/vtt.js", 'utf8');
|
||||
|
||||
// Remove settings for VIM and Emacs.
|
||||
vttjs = vttjs.replace(/\/\* -\*-.*-\*- \*\/\n/, '');
|
||||
vttjs = vttjs.replace(/\/\* vim:.* \*\/\n/, '');
|
||||
|
||||
// Concatenate header and vttjs code.
|
||||
vttjs =
|
||||
'/* This Source Code Form is subject to the terms of the Mozilla Public\n' +
|
||||
' * License, v. 2.0. If a copy of the MPL was not distributed with this\n' +
|
||||
' * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\n\n' +
|
||||
'this.EXPORTED_SYMBOLS = ["WebVTT"];\n\n' +
|
||||
'/**\n' +
|
||||
' * Code below is vtt.js the JS WebVTT implementation.\n' +
|
||||
' * Current source code can be found at http://github.com/mozilla/vtt.js\n' +
|
||||
' *\n' +
|
||||
' * Code taken from commit ' + commits[0].id + '\n' +
|
||||
' */\n' +
|
||||
vttjs;
|
||||
|
||||
fs.writeFileSync(argv.w, vttjs);
|
||||
});
|
||||
});
|
||||
});
|
||||
1528
dom/media/webvtt/vtt.jsm
Normal file
1528
dom/media/webvtt/vtt.jsm
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue