зеркало из https://github.com/mozilla/pjs.git
Merge m-c to s-c.
This commit is contained in:
Коммит
2f6327aa2b
|
@ -503,3 +503,12 @@ pref("app.update.download.backgroundInterval", 0);
|
|||
// field.
|
||||
pref("app.update.log", true);
|
||||
#endif
|
||||
|
||||
// Extensions preferences
|
||||
pref("extensions.update.enabled", false);
|
||||
pref("extensions.getAddons.cache.enabled", false);
|
||||
|
||||
// Context Menu
|
||||
pref("ui.click_hold_context_menus", true);
|
||||
pref("ui.click_hold_context_menus.delay", 1000);
|
||||
|
||||
|
|
|
@ -14,36 +14,31 @@ Cu.import('resource://gre/modules/Services.jsm');
|
|||
Cu.import('resource://gre/modules/ContactService.jsm');
|
||||
Cu.import('resource://gre/modules/Webapps.jsm');
|
||||
|
||||
XPCOMUtils.defineLazyGetter(Services, 'env', function() {
|
||||
return Cc['@mozilla.org/process/environment;1']
|
||||
.getService(Ci.nsIEnvironment);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(Services, 'env',
|
||||
'@mozilla.org/process/environment;1',
|
||||
'nsIEnvironment');
|
||||
|
||||
XPCOMUtils.defineLazyGetter(Services, 'ss', function() {
|
||||
return Cc['@mozilla.org/content/style-sheet-service;1']
|
||||
.getService(Ci.nsIStyleSheetService);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(Services, 'ss',
|
||||
'@mozilla.org/content/style-sheet-service;1',
|
||||
'nsIStyleSheetService');
|
||||
|
||||
XPCOMUtils.defineLazyGetter(Services, 'idle', function() {
|
||||
return Cc['@mozilla.org/widget/idleservice;1']
|
||||
.getService(Ci.nsIIdleService);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(Services, 'idle',
|
||||
'@mozilla.org/widget/idleservice;1',
|
||||
'nsIIdleService');
|
||||
|
||||
XPCOMUtils.defineLazyGetter(Services, 'audioManager', function() {
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
return Cc['@mozilla.org/telephony/audiomanager;1']
|
||||
.getService(Ci.nsIAudioManager);
|
||||
XPCOMUtils.defineLazyServiceGetter(Services, 'audioManager',
|
||||
'@mozilla.org/telephony/audiomanager;1',
|
||||
'nsIAudioManager');
|
||||
#else
|
||||
return {
|
||||
"masterVolume": 0
|
||||
};
|
||||
Services.audioManager = {
|
||||
'masterVolume': 0
|
||||
};
|
||||
#endif
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(Services, 'fm', function() {
|
||||
return Cc['@mozilla.org/focus-manager;1']
|
||||
.getService(Ci.nsFocusManager);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(Services, 'fm',
|
||||
'@mozilla.org/focus-manager;1',
|
||||
'nsIFocusManager');
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, 'DebuggerServer', function() {
|
||||
Cu.import('resource://gre/modules/devtools/dbg-server.jsm');
|
||||
|
@ -144,9 +139,20 @@ var shell = {
|
|||
},
|
||||
|
||||
stop: function shell_stop() {
|
||||
['keydown', 'keypress', 'keyup'].forEach((function unlistenKey(type) {
|
||||
window.removeEventListener(type, this, false, true);
|
||||
window.removeEventListener(type, this, true, true);
|
||||
}).bind(this));
|
||||
|
||||
window.addEventListener('MozApplicationManifest', this);
|
||||
window.removeEventListener('MozApplicationManifest', this);
|
||||
window.removeEventListener('mozfullscreenchange', this);
|
||||
window.removeEventListener('sizemodechange', this);
|
||||
this.contentBrowser.removeEventListener('load', this, true);
|
||||
|
||||
#ifndef MOZ_WIDGET_GONK
|
||||
delete Services.audioManager;
|
||||
#endif
|
||||
},
|
||||
|
||||
toggleDebug: function shell_toggleDebug() {
|
||||
|
@ -301,118 +307,6 @@ var shell = {
|
|||
}
|
||||
};
|
||||
|
||||
(function PowerManager() {
|
||||
// This will eventually be moved to content, so use content API as
|
||||
// much as possible here. TODO: Bug 738530
|
||||
let power = navigator.mozPower;
|
||||
let idleHandler = function idleHandler(subject, topic, time) {
|
||||
if (topic === "idle") {
|
||||
if (power.getWakeLockState("screen") != "locked-foreground") {
|
||||
navigator.mozPower.screenEnabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let wakeLockHandler = function wakeLockHandler(topic, state) {
|
||||
// Turn off the screen when no one needs the it or all of them are
|
||||
// invisible, otherwise turn the screen on. Note that the CPU
|
||||
// might go to sleep as soon as the screen is turned off and
|
||||
// acquiring wake lock will not bring it back (actually the code
|
||||
// is not executed at all).
|
||||
if (topic == "screen") {
|
||||
if (state != "locked-foreground") {
|
||||
if (Services.idle.idleTime > idleTimeout*1000) {
|
||||
navigator.mozPower.screenEnabled = false;
|
||||
}
|
||||
} else {
|
||||
navigator.mozPower.screenEnabled = true;
|
||||
}
|
||||
}
|
||||
if (topic == "cpu") {
|
||||
navigator.mozPower.cpuSleepAllowed = (state != "locked-foreground" &&
|
||||
state != "locked-background");
|
||||
}
|
||||
}
|
||||
|
||||
let idleTimeout = Services.prefs.getIntPref("power.screen.timeout");
|
||||
if (!('mozSettings' in navigator))
|
||||
return;
|
||||
|
||||
let request = navigator.mozSettings.getLock().get("power.screen.timeout");
|
||||
request.onsuccess = function onSuccess() {
|
||||
idleTimeout = request.result["power.screen.timeout"] || idleTimeout;
|
||||
if (idleTimeout) {
|
||||
Services.idle.addIdleObserver(idleHandler, idleTimeout);
|
||||
power.addWakeLockListener(wakeLockHandler);
|
||||
}
|
||||
};
|
||||
|
||||
request.onerror = function onError() {
|
||||
if (idleTimeout) {
|
||||
Services.idle.addIdleObserver(idleHandler, idleTimeout);
|
||||
power.addWakeLockListener(wakeLockHandler);
|
||||
}
|
||||
};
|
||||
|
||||
// XXX We may override other's callback here, but this is the only
|
||||
// user of mozSettings in shell.js at this moment.
|
||||
navigator.mozSettings.onsettingchange = function onSettingChange(e) {
|
||||
if (e.settingName == "power.screen.timeout" && e.settingValue) {
|
||||
Services.idle.removeIdleObserver(idleHandler, idleTimeout);
|
||||
idleTimeout = e.settingValue;
|
||||
Services.idle.addIdleObserver(idleHandler, idleTimeout);
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
const DATA_CALL_SETTING_BOLKEYS = ["ril.data.enabled",
|
||||
"ril.data.roaming.enabled"];
|
||||
const DATA_CALL_SETTING_CHARKEYS = ["ril.data.apn",
|
||||
"ril.data.user",
|
||||
"ril.data.passwd"];
|
||||
(function DataCallSettings() {
|
||||
let sm = navigator.mozSettings;
|
||||
let lock = sm.getLock();
|
||||
DATA_CALL_SETTING_BOLKEYS.forEach(function(key) {
|
||||
let request = lock.get(key);
|
||||
request.onsuccess = function onSuccess() {
|
||||
let value = request.result[key] || false;
|
||||
Services.prefs.setBoolPref(key, value);
|
||||
dump("DataCallSettings - " + key + ":" + value);
|
||||
};
|
||||
request.onerror = function onError() {
|
||||
Services.prefs.setBoolPref(key, false);
|
||||
};
|
||||
});
|
||||
|
||||
DATA_CALL_SETTING_CHARKEYS.forEach(function(key) {
|
||||
let request = lock.get(key);
|
||||
request.onsuccess = function onSuccess() {
|
||||
let value = request.result[key] || "";
|
||||
Services.prefs.setCharPref(key, value);
|
||||
dump("DataCallSettings - " + key + ":" + value);
|
||||
};
|
||||
request.onerror = function onError() {
|
||||
Services.prefs.setCharPref(key, "");
|
||||
};
|
||||
});
|
||||
|
||||
navigator.mozSettings.onsettingchange = function onSettingChange(e) {
|
||||
dump("DataCallSettings - onsettingchange: " + e.settingName +
|
||||
": " + e.settingValue);
|
||||
if (e.settingValue) {
|
||||
if (DATA_CALL_SETTING_BOLKEYS.indexOf(e.settingName) > -1 ) {
|
||||
Services.prefs.setBoolPref(e.settingName, e.settingValue);
|
||||
return;
|
||||
}
|
||||
if (DATA_CALL_SETTING_CHARKEYS.indexOf(e.settingName) > -1) {
|
||||
Services.prefs.setCharPref(e.settingName, e.settingValue);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
function nsBrowserAccess() {
|
||||
}
|
||||
|
||||
|
@ -593,7 +487,11 @@ var WebappsHelper = {
|
|||
return;
|
||||
|
||||
let manifest = new DOMApplicationManifest(aManifest, json.origin);
|
||||
shell.sendEvent(content, "mozChromeEvent", { type: "webapps-launch", url: manifest.fullLaunchPath(), origin: json.origin });
|
||||
shell.sendEvent(content, "mozChromeEvent", {
|
||||
"type": "webapps-launch",
|
||||
"url": manifest.fullLaunchPath(json.startPoint),
|
||||
"origin": json.origin
|
||||
});
|
||||
});
|
||||
break;
|
||||
case "webapps-ask-install":
|
||||
|
@ -623,4 +521,136 @@ window.addEventListener('ContentStart', function(evt) {
|
|||
if (Services.prefs.getBoolPref('devtools.debugger.enabled')) {
|
||||
startDebugger();
|
||||
}
|
||||
}, false);
|
||||
});
|
||||
|
||||
|
||||
// Once Bug 731746 - Allow chrome JS object to implement nsIDOMEventTarget
|
||||
// is resolved this helper could be removed.
|
||||
var SettingsListener = {
|
||||
_callbacks: {},
|
||||
|
||||
init: function sl_init() {
|
||||
if ('mozSettings' in navigator && navigator.mozSettings)
|
||||
navigator.mozSettings.onsettingchange = this.onchange.bind(this);
|
||||
},
|
||||
|
||||
onchange: function sl_onchange(evt) {
|
||||
var callback = this._callbacks[evt.settingName];
|
||||
if (callback) {
|
||||
callback(evt.settingValue);
|
||||
}
|
||||
},
|
||||
|
||||
observe: function sl_observe(name, defaultValue, callback) {
|
||||
var settings = window.navigator.mozSettings;
|
||||
if (!settings) {
|
||||
window.setTimeout(function() { callback(defaultValue); });
|
||||
return;
|
||||
}
|
||||
|
||||
if (!callback || typeof callback !== 'function') {
|
||||
throw new Error('Callback is not a function');
|
||||
}
|
||||
|
||||
var req = settings.getLock().get(name);
|
||||
req.addEventListener('success', (function onsuccess() {
|
||||
callback(typeof(req.result[name]) != 'undefined' ?
|
||||
req.result[name] : defaultValue);
|
||||
}));
|
||||
|
||||
this._callbacks[name] = callback;
|
||||
}
|
||||
};
|
||||
|
||||
SettingsListener.init();
|
||||
|
||||
SettingsListener.observe('language.current', 'en-US', function(value) {
|
||||
Services.prefs.setCharPref('intl.accept_languages', value);
|
||||
});
|
||||
|
||||
|
||||
(function PowerManager() {
|
||||
// This will eventually be moved to content, so use content API as
|
||||
// much as possible here. TODO: Bug 738530
|
||||
let power = navigator.mozPower;
|
||||
let idleHandler = function idleHandler(subject, topic, time) {
|
||||
if (topic !== 'idle')
|
||||
return;
|
||||
|
||||
if (power.getWakeLockState("screen") != "locked-foreground") {
|
||||
navigator.mozPower.screenEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
let wakeLockHandler = function(topic, state) {
|
||||
// Turn off the screen when no one needs the it or all of them are
|
||||
// invisible, otherwise turn the screen on. Note that the CPU
|
||||
// might go to sleep as soon as the screen is turned off and
|
||||
// acquiring wake lock will not bring it back (actually the code
|
||||
// is not executed at all).
|
||||
if (topic === 'screen') {
|
||||
if (state != "locked-foreground") {
|
||||
if (Services.idle.idleTime > idleTimeout*1000) {
|
||||
navigator.mozPower.screenEnabled = false;
|
||||
}
|
||||
} else {
|
||||
navigator.mozPower.screenEnabled = true;
|
||||
}
|
||||
} else if (topic == 'cpu') {
|
||||
navigator.mozPower.cpuSleepAllowed = (state != 'locked-foreground' &&
|
||||
state != 'locked-background');
|
||||
}
|
||||
}
|
||||
|
||||
let idleTimeout = Services.prefs.getIntPref('power.screen.timeout');
|
||||
if (!('mozSettings' in navigator))
|
||||
return;
|
||||
|
||||
let request = navigator.mozSettings.getLock().get('power.screen.timeout');
|
||||
request.onsuccess = function onSuccess() {
|
||||
idleTimeout = request.result['power.screen.timeout'] || idleTimeout;
|
||||
if (!idleTimeout)
|
||||
return;
|
||||
|
||||
Services.idle.addIdleObserver(idleHandler, idleTimeout);
|
||||
power.addWakeLockListener(wakeLockHandler);
|
||||
};
|
||||
|
||||
request.onerror = function onError() {
|
||||
if (!idleTimeout)
|
||||
return;
|
||||
|
||||
Services.idle.addIdleObserver(idleHandler, idleTimeout);
|
||||
power.addWakeLockListener(wakeLockHandler);
|
||||
};
|
||||
|
||||
SettingsListener.observe('power.screen.timeout', 30, function(value) {
|
||||
if (!value)
|
||||
return;
|
||||
|
||||
Services.idle.removeIdleObserver(idleHandler, idleTimeout);
|
||||
idleTimeout = value;
|
||||
Services.idle.addIdleObserver(idleHandler, idleTimeout);
|
||||
});
|
||||
|
||||
window.addEventListener('unload', function removeIdleObjects() {
|
||||
Services.idle.removeIdleObserver(idleHandler, idleTimeout);
|
||||
power.removeWakeLockListener(wakeLockHandler);
|
||||
});
|
||||
})();
|
||||
|
||||
|
||||
(function RILSettingsToPrefs() {
|
||||
['ril.data.enabled', 'ril.data.roaming.enabled'].forEach(function(key) {
|
||||
SettingsListener.observe(key, false, function(value) {
|
||||
Services.prefs.setBoolPref(key, value);
|
||||
});
|
||||
});
|
||||
|
||||
['ril.data.apn', 'ril.data.user', 'ril.data.passwd'].forEach(function(key) {
|
||||
SettingsListener.observe(key, false, function(value) {
|
||||
Services.prefs.setBoolPref(key, value);
|
||||
});
|
||||
});
|
||||
})();
|
||||
|
||||
|
|
|
@ -16,9 +16,6 @@
|
|||
onunload="shell.stop();">
|
||||
|
||||
<script type="application/javascript" src="chrome://browser/content/shell.js"/>
|
||||
#ifndef MOZ_TOUCH
|
||||
<script type="application/javascript" src="chrome://browser/content/touch.js"/>
|
||||
#endif
|
||||
|
||||
<browser id="homescreen"
|
||||
type="content-primary"
|
||||
|
|
|
@ -1,201 +0,0 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
|
||||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
||||
/* 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/. */
|
||||
|
||||
(function touchEventHandler() {
|
||||
let debugging = false;
|
||||
function debug(str) {
|
||||
if (debugging)
|
||||
dump(str + '\n');
|
||||
};
|
||||
|
||||
let contextMenuTimeout = 0;
|
||||
|
||||
// This guard is used to not re-enter the events processing loop for
|
||||
// self dispatched events
|
||||
let ignoreEvents = false;
|
||||
|
||||
// During a 'touchstart' and the first 'touchmove' mouse events can be
|
||||
// prevented for the current touch sequence.
|
||||
let canPreventMouseEvents = false;
|
||||
|
||||
// Used to track the first mousemove and to cancel click dispatc if it's not
|
||||
// true.
|
||||
let isNewTouchAction = false;
|
||||
|
||||
// If this is set to true all mouse events will be cancelled by calling
|
||||
// both evt.preventDefault() and evt.stopPropagation().
|
||||
// This will not prevent a contextmenu event to be fired.
|
||||
// This can be turned on if canPreventMouseEvents is true and the consumer
|
||||
// application call evt.preventDefault();
|
||||
let preventMouseEvents = false;
|
||||
|
||||
let TouchEventHandler = {
|
||||
events: ['mousedown', 'mousemove', 'mouseup', 'click', 'unload'],
|
||||
start: function teh_start() {
|
||||
this.events.forEach((function(evt) {
|
||||
shell.contentBrowser.addEventListener(evt, this, true);
|
||||
}).bind(this));
|
||||
},
|
||||
stop: function teh_stop() {
|
||||
this.events.forEach((function(evt) {
|
||||
shell.contentBrowser.removeEventListener(evt, this, true);
|
||||
}).bind(this));
|
||||
},
|
||||
handleEvent: function teh_handleEvent(evt) {
|
||||
if (evt.button || ignoreEvents)
|
||||
return;
|
||||
|
||||
let eventTarget = this.target;
|
||||
let type = '';
|
||||
switch (evt.type) {
|
||||
case 'mousedown':
|
||||
debug('mousedown:');
|
||||
|
||||
this.target = evt.target;
|
||||
this.timestamp = evt.timeStamp;
|
||||
|
||||
preventMouseEvents = false;
|
||||
canPreventMouseEvents = true;
|
||||
isNewTouchAction = true;
|
||||
|
||||
contextMenuTimeout =
|
||||
this.sendContextMenu(evt.target, evt.pageX, evt.pageY, 2000);
|
||||
this.startX = evt.pageX;
|
||||
this.startY = evt.pageY;
|
||||
type = 'touchstart';
|
||||
break;
|
||||
|
||||
case 'mousemove':
|
||||
if (!eventTarget)
|
||||
return;
|
||||
|
||||
// On device a mousemove event if fired right after the mousedown
|
||||
// because of the size of the finger, so let's ignore what happens
|
||||
// below 5ms
|
||||
if (evt.timeStamp - this.timestamp < 30)
|
||||
break;
|
||||
|
||||
if (isNewTouchAction) {
|
||||
canPreventMouseEvents = true;
|
||||
isNewTouchAction = false;
|
||||
}
|
||||
|
||||
if (Math.abs(this.startX - evt.pageX) > 15 ||
|
||||
Math.abs(this.startY - evt.pageY) > 15)
|
||||
window.clearTimeout(contextMenuTimeout);
|
||||
type = 'touchmove';
|
||||
break;
|
||||
|
||||
case 'mouseup':
|
||||
if (!eventTarget)
|
||||
return;
|
||||
debug('mouseup:');
|
||||
|
||||
window.clearTimeout(contextMenuTimeout);
|
||||
this.target = null;
|
||||
type = 'touchend';
|
||||
break;
|
||||
|
||||
case 'unload':
|
||||
if (!eventTarget)
|
||||
return;
|
||||
|
||||
window.clearTimeout(contextMenuTimeout);
|
||||
this.target = null;
|
||||
TouchEventHandler.stop();
|
||||
return;
|
||||
|
||||
case 'click':
|
||||
if (isNewTouchAction) {
|
||||
// Mouse events has been cancelled so dispatch a sequence
|
||||
// of events to where touchend has been fired
|
||||
if (preventMouseEvents) {
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
|
||||
let target = evt.target;
|
||||
ignoreEvents = true;
|
||||
window.setTimeout(function dispatchMouseEvents(self) {
|
||||
self.fireMouseEvent('mousemove', evt);
|
||||
self.fireMouseEvent('mousedown', evt);
|
||||
self.fireMouseEvent('mouseup', evt);
|
||||
ignoreEvents = false;
|
||||
}, 0, this);
|
||||
}
|
||||
|
||||
debug('click: fire');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
let target = eventTarget || this.target;
|
||||
if (target && type) {
|
||||
let touchEvent = this.sendTouchEvent(evt, target, type);
|
||||
if (touchEvent.defaultPrevented && canPreventMouseEvents)
|
||||
preventMouseEvents = true;
|
||||
}
|
||||
|
||||
if (preventMouseEvents) {
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
|
||||
if (type != 'touchmove')
|
||||
debug('cancelled (fire ' + type + ')');
|
||||
}
|
||||
},
|
||||
fireMouseEvent: function teh_fireMouseEvent(type, evt) {
|
||||
debug(type + ': fire');
|
||||
|
||||
let content = evt.target.ownerDocument.defaultView;
|
||||
var utils = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
utils.sendMouseEvent(type, evt.pageX, evt.pageY, 0, 1, 0, true);
|
||||
},
|
||||
sendContextMenu: function teh_sendContextMenu(target, x, y, delay) {
|
||||
let doc = target.ownerDocument;
|
||||
let evt = doc.createEvent('MouseEvent');
|
||||
evt.initMouseEvent('contextmenu', true, true, doc.defaultView,
|
||||
0, x, y, x, y, false, false, false, false,
|
||||
0, null);
|
||||
|
||||
let timeout = window.setTimeout((function contextMenu() {
|
||||
debug('fire context-menu');
|
||||
|
||||
target.dispatchEvent(evt);
|
||||
if (!evt.defaultPrevented)
|
||||
return;
|
||||
|
||||
doc.releaseCapture();
|
||||
this.target = null;
|
||||
|
||||
isNewTouchAction = false;
|
||||
}).bind(this), delay);
|
||||
return timeout;
|
||||
},
|
||||
sendTouchEvent: function teh_sendTouchEvent(evt, target, name) {
|
||||
let touchEvent = document.createEvent('touchevent');
|
||||
let point = document.createTouch(window, target, 0,
|
||||
evt.pageX, evt.pageY,
|
||||
evt.screenX, evt.screenY,
|
||||
evt.clientX, evt.clientY,
|
||||
1, 1, 0, 0);
|
||||
let touches = document.createTouchList(point);
|
||||
let targetTouches = touches;
|
||||
let changedTouches = touches;
|
||||
touchEvent.initTouchEvent(name, true, true, window, 0,
|
||||
false, false, false, false,
|
||||
touches, targetTouches, changedTouches);
|
||||
target.dispatchEvent(touchEvent);
|
||||
return touchEvent;
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('ContentStart', function touchStart(evt) {
|
||||
window.removeEventListener('ContentStart', touchStart);
|
||||
TouchEventHandler.start();
|
||||
});
|
||||
})();
|
||||
|
|
@ -13,10 +13,9 @@ Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
|||
Cu.import('resource://gre/modules/Services.jsm');
|
||||
Cu.import('resource://gre/modules/Geometry.jsm');
|
||||
|
||||
XPCOMUtils.defineLazyGetter(Services, 'fm', function() {
|
||||
return Cc['@mozilla.org/focus-manager;1']
|
||||
.getService(Ci.nsIFocusManager);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(Services, 'fm',
|
||||
'@mozilla.org/focus-manager;1',
|
||||
'nsIFocusManager');
|
||||
|
||||
// MozKeyboard
|
||||
(function VirtualKeyboardManager() {
|
||||
|
|
|
@ -7,9 +7,6 @@ chrome.jar:
|
|||
content/dbg-browser-actors.js (content/dbg-browser-actors.js)
|
||||
* content/shell.xul (content/shell.xul)
|
||||
* content/shell.js (content/shell.js)
|
||||
#ifndef MOZ_TOUCH
|
||||
content/touch.js (content/touch.js)
|
||||
#endif
|
||||
content/webapi.js (content/webapi.js)
|
||||
content/content.css (content/content.css)
|
||||
|
||||
|
|
|
@ -344,7 +344,7 @@ let TestPilotSetup = {
|
|||
appcontent.addEventListener("DOMContentLoaded", function(event) {
|
||||
let newUrl = event.originalTarget.URL;
|
||||
self._feedbackManager.fillInFeedbackPage(newUrl, window);
|
||||
for (i = 0; i < self.taskList.length; i++) {
|
||||
for (let i = 0; i < self.taskList.length; i++) {
|
||||
self.taskList[i].onUrlLoad(newUrl, event);
|
||||
}
|
||||
}, true);
|
||||
|
|
|
@ -873,12 +873,6 @@ pref("places.frecency.unvisitedTypedBonus", 200);
|
|||
// 2 - pre-populate site URL and pre-fetch certificate
|
||||
pref("browser.ssl_override_behavior", 2);
|
||||
|
||||
// Controls the display of domain in the identity box for SSL connections.
|
||||
// 0 - do not show domain
|
||||
// 1 - show effectiveTLD + 1 (e.g. mozilla.org)
|
||||
// 2 - show full domain (e.g. bugzilla.mozilla.org)
|
||||
pref("browser.identity.ssl_domain_display", 0);
|
||||
|
||||
// True if the user should be prompted when a web application supports
|
||||
// offline apps.
|
||||
pref("browser.offline-apps.notify", true);
|
||||
|
|
|
@ -1025,27 +1025,31 @@ let gGestureSupport = {
|
|||
switch (aEvent.type) {
|
||||
case "MozSwipeGesture":
|
||||
aEvent.preventDefault();
|
||||
return this.onSwipe(aEvent);
|
||||
this.onSwipe(aEvent);
|
||||
break;
|
||||
case "MozMagnifyGestureStart":
|
||||
aEvent.preventDefault();
|
||||
#ifdef XP_WIN
|
||||
return this._setupGesture(aEvent, "pinch", def(25, 0), "out", "in");
|
||||
this._setupGesture(aEvent, "pinch", def(25, 0), "out", "in");
|
||||
#else
|
||||
return this._setupGesture(aEvent, "pinch", def(150, 1), "out", "in");
|
||||
this._setupGesture(aEvent, "pinch", def(150, 1), "out", "in");
|
||||
#endif
|
||||
break;
|
||||
case "MozRotateGestureStart":
|
||||
aEvent.preventDefault();
|
||||
return this._setupGesture(aEvent, "twist", def(25, 0), "right", "left");
|
||||
this._setupGesture(aEvent, "twist", def(25, 0), "right", "left");
|
||||
break;
|
||||
case "MozMagnifyGestureUpdate":
|
||||
case "MozRotateGestureUpdate":
|
||||
aEvent.preventDefault();
|
||||
return this._doUpdate(aEvent);
|
||||
this._doUpdate(aEvent);
|
||||
break;
|
||||
case "MozTapGesture":
|
||||
aEvent.preventDefault();
|
||||
return this._doAction(aEvent, ["tap"]);
|
||||
case "MozPressTapGesture":
|
||||
// Fall through to default behavior
|
||||
return;
|
||||
this._doAction(aEvent, ["tap"]);
|
||||
break;
|
||||
/* case "MozPressTapGesture":
|
||||
break; */
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1130,8 +1134,6 @@ let gGestureSupport = {
|
|||
* The original gesture event to convert into a fake click event
|
||||
* @param aGesture
|
||||
* Array of gesture name parts (to be joined by periods)
|
||||
* @return Name of the command found for the event's keys and gesture. If no
|
||||
* command is found, no value is returned (undefined).
|
||||
*/
|
||||
_doAction: function GS__doAction(aEvent, aGesture) {
|
||||
// Create an array of pressed keys in a fixed order so that a command for
|
||||
|
@ -1169,9 +1171,8 @@ let gGestureSupport = {
|
|||
goDoCommand(command);
|
||||
}
|
||||
|
||||
return command;
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1192,10 +1193,12 @@ let gGestureSupport = {
|
|||
*/
|
||||
onSwipe: function GS_onSwipe(aEvent) {
|
||||
// Figure out which one (and only one) direction was triggered
|
||||
["UP", "RIGHT", "DOWN", "LEFT"].forEach(function (dir) {
|
||||
if (aEvent.direction == aEvent["DIRECTION_" + dir])
|
||||
return this._doAction(aEvent, ["swipe", dir.toLowerCase()]);
|
||||
}, this);
|
||||
for (let dir of ["UP", "RIGHT", "DOWN", "LEFT"]) {
|
||||
if (aEvent.direction == aEvent["DIRECTION_" + dir]) {
|
||||
this._doAction(aEvent, ["swipe", dir.toLowerCase()]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -4453,10 +4456,10 @@ var FullScreen = {
|
|||
XPCOMUtils.defineLazyGetter(FullScreen, "useLionFullScreen", function() {
|
||||
// We'll only use OS X Lion full screen if we're
|
||||
// * on OS X
|
||||
// * on Lion (Darwin 11.x) -- this will need to be updated for OS X 10.8
|
||||
// * on Lion or higher (Darwin 11+)
|
||||
// * have fullscreenbutton="true"
|
||||
#ifdef XP_MACOSX
|
||||
return /^11\./.test(Services.sysinfo.getProperty("version")) &&
|
||||
return parseFloat(Services.sysinfo.getProperty("version")) >= 11 &&
|
||||
document.documentElement.getAttribute("fullscreenbutton") == "true";
|
||||
#else
|
||||
return false;
|
||||
|
@ -5201,10 +5204,11 @@ var TabsProgressListener = {
|
|||
aFlags) {
|
||||
// Filter out any sub-frame loads
|
||||
if (aBrowser.contentWindow == aWebProgress.DOMWindow) {
|
||||
// initialize the click-to-play state
|
||||
aBrowser._clickToPlayDoorhangerShown = false;
|
||||
aBrowser._clickToPlayPluginsActivated = false;
|
||||
|
||||
if (aRequest) {
|
||||
// Initialize the click-to-play state.
|
||||
aBrowser._clickToPlayDoorhangerShown = false;
|
||||
aBrowser._clickToPlayPluginsActivated = false;
|
||||
}
|
||||
FullZoom.onLocationChange(aLocationURI, false, aBrowser);
|
||||
}
|
||||
},
|
||||
|
@ -8199,30 +8203,19 @@ var gIdentityHandler = {
|
|||
* @param newMode The newly set identity mode. Should be one of the IDENTITY_MODE_* constants.
|
||||
*/
|
||||
setIdentityMessages : function(newMode) {
|
||||
if (newMode == this.IDENTITY_MODE_DOMAIN_VERIFIED) {
|
||||
var iData = this.getIdentityData();
|
||||
let icon_label = "";
|
||||
let tooltip = "";
|
||||
let icon_country_label = "";
|
||||
let icon_labels_dir = "ltr";
|
||||
|
||||
// It would be sort of nice to use the CN= field in the cert, since that's
|
||||
// typically what we want here, but thanks to x509 certs being extensible,
|
||||
// it's not the only place you have to check, there can be more than one domain,
|
||||
// et cetera, ad nauseum. We know the cert is valid for location.host, so
|
||||
// let's just use that. Check the pref to determine how much of the verified
|
||||
// hostname to show
|
||||
var icon_label = "";
|
||||
var icon_country_label = "";
|
||||
var icon_labels_dir = "ltr";
|
||||
switch (gPrefService.getIntPref("browser.identity.ssl_domain_display")) {
|
||||
case 2 : // Show full domain
|
||||
icon_label = this._lastLocation.hostname;
|
||||
break;
|
||||
case 1 : // Show eTLD.
|
||||
icon_label = this.getEffectiveHost();
|
||||
}
|
||||
switch (newMode) {
|
||||
case this.IDENTITY_MODE_DOMAIN_VERIFIED: {
|
||||
let iData = this.getIdentityData();
|
||||
|
||||
// Verifier is either the CA Org, for a normal cert, or a special string
|
||||
// for certs that are trusted because of a security exception.
|
||||
var tooltip = gNavigatorBundle.getFormattedString("identity.identified.verifier",
|
||||
[iData.caOrg]);
|
||||
tooltip = gNavigatorBundle.getFormattedString("identity.identified.verifier",
|
||||
[iData.caOrg]);
|
||||
|
||||
// Check whether this site is a security exception. XPConnect does the right
|
||||
// thing here in terms of converting _lastLocation.port from string to int, but
|
||||
|
@ -8237,15 +8230,16 @@ var gIdentityHandler = {
|
|||
(this._lastLocation.port || 443),
|
||||
iData.cert, {}, {}))
|
||||
tooltip = gNavigatorBundle.getString("identity.identified.verified_by_you");
|
||||
}
|
||||
else if (newMode == this.IDENTITY_MODE_IDENTIFIED) {
|
||||
break; }
|
||||
case this.IDENTITY_MODE_IDENTIFIED: {
|
||||
// If it's identified, then we can populate the dialog with credentials
|
||||
iData = this.getIdentityData();
|
||||
let iData = this.getIdentityData();
|
||||
tooltip = gNavigatorBundle.getFormattedString("identity.identified.verifier",
|
||||
[iData.caOrg]);
|
||||
icon_label = iData.subjectOrg;
|
||||
if (iData.country)
|
||||
icon_country_label = "(" + iData.country + ")";
|
||||
|
||||
// If the organization name starts with an RTL character, then
|
||||
// swap the positions of the organization and country code labels.
|
||||
// The Unicode ranges reflect the definition of the UCS2_CHAR_IS_BIDI
|
||||
|
@ -8254,18 +8248,11 @@ var gIdentityHandler = {
|
|||
// Unicode Bidirectional Algorithm proper (at the paragraph level).
|
||||
icon_labels_dir = /^[\u0590-\u08ff\ufb1d-\ufdff\ufe70-\ufefc]/.test(icon_label) ?
|
||||
"rtl" : "ltr";
|
||||
}
|
||||
else if (newMode == this.IDENTITY_MODE_CHROMEUI) {
|
||||
icon_label = "";
|
||||
tooltip = "";
|
||||
icon_country_label = "";
|
||||
icon_labels_dir = "ltr";
|
||||
}
|
||||
else {
|
||||
break; }
|
||||
case this.IDENTITY_MODE_CHROMEUI:
|
||||
break;
|
||||
default:
|
||||
tooltip = gNavigatorBundle.getString("identity.unknown.tooltip");
|
||||
icon_label = "";
|
||||
icon_country_label = "";
|
||||
icon_labels_dir = "ltr";
|
||||
}
|
||||
|
||||
// Push the appropriate strings out to the UI
|
||||
|
@ -8295,19 +8282,20 @@ var gIdentityHandler = {
|
|||
this._identityPopupEncLabel.textContent = this._encryptionLabel[newMode];
|
||||
|
||||
// Initialize the optional strings to empty values
|
||||
var supplemental = "";
|
||||
var verifier = "";
|
||||
let supplemental = "";
|
||||
let verifier = "";
|
||||
let host = "";
|
||||
let owner = "";
|
||||
|
||||
if (newMode == this.IDENTITY_MODE_DOMAIN_VERIFIED) {
|
||||
var iData = this.getIdentityData();
|
||||
var host = this.getEffectiveHost();
|
||||
var owner = gNavigatorBundle.getString("identity.ownerUnknown2");
|
||||
switch (newMode) {
|
||||
case this.IDENTITY_MODE_DOMAIN_VERIFIED:
|
||||
host = this.getEffectiveHost();
|
||||
owner = gNavigatorBundle.getString("identity.ownerUnknown2");
|
||||
verifier = this._identityBox.tooltipText;
|
||||
supplemental = "";
|
||||
}
|
||||
else if (newMode == this.IDENTITY_MODE_IDENTIFIED) {
|
||||
break;
|
||||
case this.IDENTITY_MODE_IDENTIFIED: {
|
||||
// If it's identified, then we can populate the dialog with credentials
|
||||
iData = this.getIdentityData();
|
||||
let iData = this.getIdentityData();
|
||||
host = this.getEffectiveHost();
|
||||
owner = iData.subjectOrg;
|
||||
verifier = this._identityBox.tooltipText;
|
||||
|
@ -8322,11 +8310,7 @@ var gIdentityHandler = {
|
|||
supplemental += iData.state;
|
||||
else if (iData.country) // Country only
|
||||
supplemental += iData.country;
|
||||
}
|
||||
else {
|
||||
// These strings will be hidden in CSS anyhow
|
||||
host = "";
|
||||
owner = "";
|
||||
break; }
|
||||
}
|
||||
|
||||
// Push the appropriate strings out to the UI
|
||||
|
|
|
@ -181,6 +181,8 @@ _BROWSER_FILES = \
|
|||
browser_bug664672.js \
|
||||
browser_bug710878.js \
|
||||
browser_bug719271.js \
|
||||
browser_bug743421.js \
|
||||
browser_bug749738.js \
|
||||
browser_canonizeURL.js \
|
||||
browser_findbarClose.js \
|
||||
browser_homeDrop.js \
|
||||
|
@ -253,6 +255,7 @@ _BROWSER_FILES = \
|
|||
plugin_alternate_content.html \
|
||||
plugin_both.html \
|
||||
plugin_both2.html \
|
||||
plugin_bug743421.html \
|
||||
plugin_clickToPlayAllow.html \
|
||||
plugin_clickToPlayDeny.html \
|
||||
alltabslistener.html \
|
||||
|
|
|
@ -0,0 +1,107 @@
|
|||
var rootDir = getRootDirectory(gTestPath);
|
||||
const gTestRoot = rootDir;
|
||||
|
||||
var gTestBrowser = null;
|
||||
var gNextTest = null;
|
||||
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
registerCleanupFunction(function() { Services.prefs.clearUserPref("plugins.click_to_play"); });
|
||||
Services.prefs.setBoolPref("plugins.click_to_play", true);
|
||||
|
||||
var newTab = gBrowser.addTab();
|
||||
gBrowser.selectedTab = newTab;
|
||||
gTestBrowser = gBrowser.selectedBrowser;
|
||||
gTestBrowser.addEventListener("load", pageLoad, true);
|
||||
prepareTest(test1a, gTestRoot + "plugin_bug743421.html");
|
||||
}
|
||||
|
||||
function finishTest() {
|
||||
gTestBrowser.removeEventListener("load", pageLoad, true);
|
||||
gBrowser.removeCurrentTab();
|
||||
window.focus();
|
||||
finish();
|
||||
}
|
||||
|
||||
function pageLoad() {
|
||||
// The plugin events are async dispatched and can come after the load event
|
||||
// This just allows the events to fire before we then go on to test the states
|
||||
executeSoon(gNextTest);
|
||||
}
|
||||
|
||||
function prepareTest(nextTest, url) {
|
||||
gNextTest = nextTest;
|
||||
gTestBrowser.contentWindow.location = url;
|
||||
}
|
||||
|
||||
// Tests that navigation within the page and the window.history API doesn't break click-to-play state.
|
||||
function test1a() {
|
||||
var popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
|
||||
ok(!popupNotification, "Test 1a, Should not have a click-to-play notification");
|
||||
var plugin = gTestBrowser.contentWindow.addPlugin();
|
||||
|
||||
setTimeout(test1b, 500);
|
||||
}
|
||||
|
||||
function test1b() {
|
||||
var popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
|
||||
ok(popupNotification, "Test 1b, Should have a click-to-play notification");
|
||||
var plugin = gTestBrowser.contentDocument.getElementsByTagName("embed")[0];
|
||||
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(!objLoadingContent.activated, "Test 1b, Plugin should not be activated");
|
||||
|
||||
EventUtils.synthesizeMouse(plugin, 100, 100, { });
|
||||
setTimeout(test1c, 500);
|
||||
}
|
||||
|
||||
function test1c() {
|
||||
var popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
|
||||
ok(!popupNotification, "Test 1c, Should not have a click-to-play notification");
|
||||
var plugin = gTestBrowser.contentWindow.addPlugin();
|
||||
|
||||
setTimeout(test1d, 500);
|
||||
}
|
||||
|
||||
function test1d() {
|
||||
var popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
|
||||
ok(!popupNotification, "Test 1d, Should not have a click-to-play notification");
|
||||
var plugin = gTestBrowser.contentDocument.getElementsByTagName("embed")[1];
|
||||
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(objLoadingContent.activated, "Test 1d, Plugin should be activated");
|
||||
|
||||
gNextTest = test1e;
|
||||
gTestBrowser.contentWindow.addEventListener("hashchange", test1e, false);
|
||||
gTestBrowser.contentWindow.location += "#anchorNavigation";
|
||||
}
|
||||
|
||||
function test1e() {
|
||||
gTestBrowser.contentWindow.removeEventListener("hashchange", test1e, false);
|
||||
var popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
|
||||
ok(!popupNotification, "Test 1e, Should not have a click-to-play notification");
|
||||
var plugin = gTestBrowser.contentWindow.addPlugin();
|
||||
|
||||
setTimeout(test1f, 500);
|
||||
}
|
||||
|
||||
function test1f() {
|
||||
var popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
|
||||
ok(!popupNotification, "Test 1f, Should not have a click-to-play notification");
|
||||
var plugin = gTestBrowser.contentDocument.getElementsByTagName("embed")[2];
|
||||
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(objLoadingContent.activated, "Test 1f, Plugin should be activated");
|
||||
|
||||
gTestBrowser.contentWindow.history.replaceState({}, "", "replacedState");
|
||||
gTestBrowser.contentWindow.addPlugin();
|
||||
setTimeout(test1g, 500);
|
||||
}
|
||||
|
||||
function test1g() {
|
||||
var popupNotification2 = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
|
||||
ok(!popupNotification2, "Test 1g, Should not have a click-to-play notification after replaceState");
|
||||
var plugin = gTestBrowser.contentDocument.getElementsByTagName("embed")[3];
|
||||
var objLoadingContent2 = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(objLoadingContent2.activated, "Test 1g, Plugin should be activated");
|
||||
finishTest();
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/* 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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const DUMMY_PAGE = "http://example.org/browser/browser/base/content/test/dummy_page.html";
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
let tab = gBrowser.addTab();
|
||||
gBrowser.selectedTab = tab;
|
||||
|
||||
load(tab, DUMMY_PAGE, function() {
|
||||
gFindBar.onFindCommand();
|
||||
EventUtils.sendString("Dummy");
|
||||
gBrowser.removeTab(tab);
|
||||
|
||||
try {
|
||||
gFindBar.close();
|
||||
ok(true, "findbar.close should not throw an exception");
|
||||
} catch(e) {
|
||||
ok(false, "findbar.close threw exception: " + e);
|
||||
}
|
||||
finish();
|
||||
});
|
||||
}
|
||||
|
||||
function load(aTab, aUrl, aCallback) {
|
||||
aTab.linkedBrowser.addEventListener("load", function onload(aEvent) {
|
||||
aEvent.currentTarget.removeEventListener("load", onload, true);
|
||||
waitForFocus(aCallback, content);
|
||||
}, true);
|
||||
aTab.linkedBrowser.loadURI(aUrl);
|
||||
}
|
|
@ -1,9 +1,6 @@
|
|||
/* Tests for correct behaviour of getEffectiveHost on identity handler */
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
registerCleanupFunction(function() {
|
||||
Services.prefs.clearUserPref("browser.identity.ssl_domain_display");
|
||||
});
|
||||
|
||||
ok(gIdentityHandler, "gIdentityHandler should exist");
|
||||
|
||||
|
@ -102,7 +99,6 @@ function nextTest() {
|
|||
gTestDesc += " (second time)";
|
||||
if (gCurrentTest.isHTTPS) {
|
||||
gCheckETLD = true;
|
||||
Services.prefs.setIntPref("browser.identity.ssl_domain_display", 1);
|
||||
}
|
||||
content.location = gCurrentTest.location;
|
||||
} else {
|
||||
|
@ -110,18 +106,11 @@ function nextTest() {
|
|||
gTestDesc = "#" + gCurrentTestIndex + " (" + gCurrentTest.name + " without eTLD in identity icon label)";
|
||||
if (!gForward)
|
||||
gTestDesc += " (second time)";
|
||||
Services.prefs.clearUserPref("browser.identity.ssl_domain_display");
|
||||
content.location.reload(true);
|
||||
}
|
||||
}
|
||||
|
||||
function checkResult() {
|
||||
if (gCurrentTest.isHTTPS && Services.prefs.getIntPref("browser.identity.ssl_domain_display") == 1) {
|
||||
// Check that the effective host is displayed in the UI
|
||||
let label = document.getElementById("identity-icon-label");
|
||||
is(label.value, gCurrentTest.effectiveHost, "effective host is displayed in identity icon label for test " + gTestDesc);
|
||||
}
|
||||
|
||||
// Sanity check other values, and the value of gIdentityHandler.getEffectiveHost()
|
||||
is(gIdentityHandler._lastLocation.host, gCurrentTest.host, "host matches for test " + gTestDesc);
|
||||
is(gIdentityHandler.getEffectiveHost(), gCurrentTest.effectiveHost, "effectiveHost matches for test " + gTestDesc);
|
||||
|
|
|
@ -191,7 +191,7 @@ var wrongBrowserNotification;
|
|||
var tests = [
|
||||
{ // Test #0
|
||||
run: function () {
|
||||
this.notifyObj = new basicNotification(),
|
||||
this.notifyObj = new basicNotification();
|
||||
showNotification(this.notifyObj);
|
||||
},
|
||||
onShown: function (popup) {
|
||||
|
@ -206,7 +206,7 @@ var tests = [
|
|||
},
|
||||
{ // Test #1
|
||||
run: function () {
|
||||
this.notifyObj = new basicNotification(),
|
||||
this.notifyObj = new basicNotification();
|
||||
showNotification(this.notifyObj);
|
||||
},
|
||||
onShown: function (popup) {
|
||||
|
@ -221,7 +221,7 @@ var tests = [
|
|||
},
|
||||
{ // Test #2
|
||||
run: function () {
|
||||
this.notifyObj = new basicNotification(),
|
||||
this.notifyObj = new basicNotification();
|
||||
this.notification = showNotification(this.notifyObj);
|
||||
},
|
||||
onShown: function (popup) {
|
||||
|
@ -285,7 +285,7 @@ var tests = [
|
|||
// notification.
|
||||
{ // Test #6
|
||||
run: function () {
|
||||
this.notifyObj = new basicNotification(),
|
||||
this.notifyObj = new basicNotification();
|
||||
// Show the same notification twice
|
||||
this.notification1 = showNotification(this.notifyObj);
|
||||
this.notification2 = showNotification(this.notifyObj);
|
||||
|
@ -332,7 +332,7 @@ var tests = [
|
|||
// Test notification without mainAction
|
||||
{ // Test #8
|
||||
run: function () {
|
||||
this.notifyObj = new basicNotification(),
|
||||
this.notifyObj = new basicNotification();
|
||||
this.notifyObj.mainAction = null;
|
||||
this.notification = showNotification(this.notifyObj);
|
||||
},
|
||||
|
@ -568,7 +568,7 @@ var tests = [
|
|||
// Test notification "Not Now" menu item
|
||||
{ // Test #17
|
||||
run: function () {
|
||||
this.notifyObj = new basicNotification(),
|
||||
this.notifyObj = new basicNotification();
|
||||
this.notification = showNotification(this.notifyObj);
|
||||
},
|
||||
onShown: function (popup) {
|
||||
|
@ -584,7 +584,7 @@ var tests = [
|
|||
// Test notification close button
|
||||
{ // Test #18
|
||||
run: function () {
|
||||
this.notifyObj = new basicNotification(),
|
||||
this.notifyObj = new basicNotification();
|
||||
this.notification = showNotification(this.notifyObj);
|
||||
},
|
||||
onShown: function (popup) {
|
||||
|
@ -677,7 +677,7 @@ var tests = [
|
|||
this.notification2.remove();
|
||||
ok(this.notifyObj2.removedCallbackTriggered, "removed callback triggered");
|
||||
}
|
||||
],
|
||||
]
|
||||
},
|
||||
// Test that multiple notification icons are removed when switching tabs
|
||||
{ // Test #22
|
||||
|
@ -718,7 +718,7 @@ var tests = [
|
|||
gBrowser.selectedTab = this.oldSelectedTab;
|
||||
this.notificationOld.remove();
|
||||
}
|
||||
],
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
function addPlugin(callback) {
|
||||
var embed = document.createElement("embed");
|
||||
embed.style.width = "200px";
|
||||
embed.style.height = "200px";
|
||||
embed.setAttribute("type", "application/x-test");
|
||||
return document.body.appendChild(embed);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -811,7 +811,7 @@ BrowserGlue.prototype = {
|
|||
try {
|
||||
// This will throw NS_ERROR_NOT_AVAILABLE if the notification cannot
|
||||
// be displayed per the idl.
|
||||
notifier.showAlertNotification("post-update-notification", title, text,
|
||||
notifier.showAlertNotification(null, title, text,
|
||||
true, url, clickCallback);
|
||||
}
|
||||
catch (e) {
|
||||
|
|
|
@ -2901,11 +2901,6 @@ SessionStoreService.prototype = {
|
|||
ScratchpadManager.restoreSession(aState.scratchpads);
|
||||
}
|
||||
|
||||
// This will force the keypress listener that Panorama has to attach if it
|
||||
// isn't already. This will be the case if tab view wasn't entered or there
|
||||
// were only visible tabs when TabView.init was first called.
|
||||
aWindow.TabView.init();
|
||||
|
||||
// set smoothScroll back to the original value
|
||||
tabstrip.smoothScroll = smoothScroll;
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ function onTabViewWindowLoaded() {
|
|||
is(appTabCount(groupItemOne), 0, "there are no app tab icons");
|
||||
|
||||
// pin the tab, make sure the TabItem goes away and the icon comes on
|
||||
whenAppTabIconAdded(function() {
|
||||
whenAppTabIconAdded(groupItemOne, function () {
|
||||
is(groupItemOne._children.length, 0,
|
||||
"the app tab's TabItem was removed from the group");
|
||||
is(appTabCount(groupItemOne), 1, "there's now one app tab icon");
|
||||
|
@ -43,7 +43,7 @@ function onTabViewWindowLoaded() {
|
|||
box.offset(box.width + 20, 0);
|
||||
let groupItemTwo = new contentWindow.GroupItem([],
|
||||
{ bounds: box, title: "test2" });
|
||||
whenAppTabIconAdded(function() {
|
||||
whenAppTabIconAdded(groupItemTwo, function() {
|
||||
is(contentWindow.GroupItems.groupItems.length, 3, "we now have three groups");
|
||||
is(appTabCount(groupItemTwo), 1,
|
||||
"there's an app tab icon in the second group");
|
||||
|
@ -58,7 +58,7 @@ function onTabViewWindowLoaded() {
|
|||
is(appTabCount(groupItemOne), 0, "the icon is gone from group one");
|
||||
is(appTabCount(groupItemTwo), 0, "the icon is gone from group two");
|
||||
|
||||
whenAppTabIconAdded(function() {
|
||||
whenAppTabIconAdded(groupItemOne, function() {
|
||||
// close the second group
|
||||
groupItemTwo.close();
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ function onTabViewShown(win) {
|
|||
"$appTabTray container is not visible");
|
||||
|
||||
// pin the tab, make sure the TabItem goes away and the icon comes on
|
||||
whenAppTabIconAdded(function() {
|
||||
whenAppTabIconAdded(groupItem, function () {
|
||||
is(groupItem._children.length, 0,
|
||||
"the app tab's TabItem was removed from the group");
|
||||
is(appTabCount(groupItem), 1, "there's now one app tab icon");
|
||||
|
@ -80,7 +80,7 @@ function onTabViewShown(win) {
|
|||
|
||||
// add one more tab
|
||||
xulTabs.push(gBrowser.loadOneTab("about:blank"));
|
||||
whenAppTabIconAdded(function() {
|
||||
whenAppTabIconAdded(groupItem, function () {
|
||||
is(tray.css("-moz-column-count"), 3,
|
||||
"$appTabTray column count is 3");
|
||||
|
||||
|
@ -129,7 +129,7 @@ function onTabViewShown(win) {
|
|||
|
||||
executeSoon(finish);
|
||||
}, win);
|
||||
}, win);
|
||||
});
|
||||
win.gBrowser.pinTab(xulTabs[xulTabs.length-1]);
|
||||
};
|
||||
|
||||
|
@ -137,13 +137,13 @@ function onTabViewShown(win) {
|
|||
let returnCount = 0;
|
||||
for (let i = 1; i < icons; i++) {
|
||||
xulTabs.push(gBrowser.loadOneTab("about:blank"));
|
||||
whenAppTabIconAdded(function() {
|
||||
whenAppTabIconAdded(groupItem, function () {
|
||||
if (++returnCount == (icons - 1))
|
||||
executeSoon(pinnedSomeTabs);
|
||||
}, win);
|
||||
});
|
||||
win.gBrowser.pinTab(xulTabs[i]);
|
||||
}
|
||||
}, win);
|
||||
});
|
||||
win.gBrowser.pinTab(xulTabs[0]);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,13 +18,14 @@ function test() {
|
|||
newTab = gBrowser.addTab();
|
||||
|
||||
showTabView(function() {
|
||||
whenAppTabIconAdded(onTabPinned);
|
||||
let cw = TabView.getContentWindow();
|
||||
whenAppTabIconAdded(cw.GroupItems.groupItems[0], onTabPinned);
|
||||
gBrowser.pinTab(newTab);
|
||||
})
|
||||
}
|
||||
|
||||
function onTabPinned() {
|
||||
let contentWindow = document.getElementById("tab-view").contentWindow;
|
||||
let contentWindow = TabView.getContentWindow();
|
||||
is(contentWindow.GroupItems.groupItems.length, 1,
|
||||
"There is one group item on startup");
|
||||
|
||||
|
|
|
@ -23,9 +23,9 @@ function test() {
|
|||
|
||||
groupItem = contentWindow.GroupItems.groupItems[0];
|
||||
|
||||
whenAppTabIconAdded(function() {
|
||||
whenAppTabIconAdded(function() {
|
||||
whenAppTabIconAdded(function() {
|
||||
whenAppTabIconAdded(groupItem, function () {
|
||||
whenAppTabIconAdded(groupItem, function () {
|
||||
whenAppTabIconAdded(groupItem, function () {
|
||||
|
||||
is(xulTabForAppTabIcon(0), newTabOne,
|
||||
"New tab one matches the first app tab icon in tabview");
|
||||
|
|
|
@ -25,12 +25,12 @@ function test() {
|
|||
is(newTabItemOne.$favImage[0].src, ICON_URL, "The tab item is showing the right icon.");
|
||||
|
||||
// test pin tab
|
||||
whenAppTabIconAdded(function() {
|
||||
whenAppTabIconAdded(groupItem, function() {
|
||||
let icon = cw.iQ(".appTabIcon", groupItem.$appTabTray)[0];
|
||||
is(icon.src, ICON_URL, "The app tab is showing the right icon");
|
||||
|
||||
finish();
|
||||
}, win);
|
||||
});
|
||||
win.gBrowser.pinTab(newTabTwo);
|
||||
});
|
||||
}, function(win) {
|
||||
|
|
|
@ -8,8 +8,8 @@ function test() {
|
|||
let tab = gBrowser.addTab();
|
||||
registerCleanupFunction(function () gBrowser.removeTab(tab));
|
||||
|
||||
whenAppTabIconAdded(function() {
|
||||
let cw = TabView.getContentWindow();
|
||||
let cw = TabView.getContentWindow();
|
||||
whenAppTabIconAdded(cw.GroupItems.groupItems[0], function() {
|
||||
let body = cw.document.body;
|
||||
let [appTabIcon] = cw.iQ(".appTabTray .appTabIcon");
|
||||
|
||||
|
|
|
@ -411,15 +411,9 @@ function goToNextGroup(win) {
|
|||
}
|
||||
|
||||
// ----------
|
||||
function whenAppTabIconAdded(callback, win) {
|
||||
win = win || window;
|
||||
|
||||
let contentWindow = win.TabView.getContentWindow();
|
||||
let groupItems = contentWindow.GroupItems.groupItems;
|
||||
let groupItem = groupItems[(groupItems.length - 1)];
|
||||
|
||||
function whenAppTabIconAdded(groupItem, callback) {
|
||||
groupItem.addSubscriber("appTabIconAdded", function onAppTabIconAdded() {
|
||||
groupItem.removeSubscriber("appTabIconAdded", onAppTabIconAdded);
|
||||
callback();
|
||||
executeSoon(callback);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -7,7 +7,11 @@ export MOZILLA_OFFICIAL=1
|
|||
|
||||
mk_add_options MOZ_MAKE_FLAGS=-j1
|
||||
|
||||
. $topsrcdir/build/win32/mozconfig.vs2010
|
||||
if test "$PROCESSOR_ARCHITECTURE" = "AMD64" -o "$PROCESSOR_ARCHITEW6432" = "AMD64"; then
|
||||
. $topsrcdir/build/win32/mozconfig.vs2010-win64
|
||||
else
|
||||
. $topsrcdir/build/win32/mozconfig.vs2010
|
||||
fi
|
||||
|
||||
# Package js shell.
|
||||
export MOZ_PACKAGE_JSSHELL=1
|
||||
|
|
|
@ -3,4 +3,8 @@ ac_add_options --enable-update-packaging
|
|||
ac_add_options --enable-official-branding
|
||||
ac_add_options --with-l10n-base=../../l10n-central
|
||||
|
||||
. $topsrcdir/build/win32/mozconfig.vs2010
|
||||
if test "$PROCESSOR_ARCHITECTURE" = "AMD64" -o "$PROCESSOR_ARCHITEW6432" = "AMD64"; then
|
||||
. $topsrcdir/build/win32/mozconfig.vs2010-win64
|
||||
else
|
||||
. $topsrcdir/build/win32/mozconfig.vs2010
|
||||
fi
|
||||
|
|
|
@ -16,7 +16,11 @@ export MOZ_TELEMETRY_REPORTING=1
|
|||
|
||||
mk_add_options MOZ_MAKE_FLAGS=-j1
|
||||
|
||||
. $topsrcdir/build/win32/mozconfig.vs2010
|
||||
if test "$PROCESSOR_ARCHITECTURE" = "AMD64" -o "$PROCESSOR_ARCHITEW6432" = "AMD64"; then
|
||||
. $topsrcdir/build/win32/mozconfig.vs2010-win64
|
||||
else
|
||||
. $topsrcdir/build/win32/mozconfig.vs2010
|
||||
fi
|
||||
|
||||
# Package js shell.
|
||||
export MOZ_PACKAGE_JSSHELL=1
|
||||
|
|
|
@ -12,7 +12,11 @@ export MOZILLA_OFFICIAL=1
|
|||
|
||||
export MOZ_TELEMETRY_REPORTING=1
|
||||
|
||||
. $topsrcdir/build/win32/mozconfig.vs2010
|
||||
if test "$PROCESSOR_ARCHITECTURE" = "AMD64" -o "$PROCESSOR_ARCHITEW6432" = "AMD64"; then
|
||||
. $topsrcdir/build/win32/mozconfig.vs2010-win64
|
||||
else
|
||||
. $topsrcdir/build/win32/mozconfig.vs2010
|
||||
fi
|
||||
|
||||
# Package js shell.
|
||||
export MOZ_PACKAGE_JSSHELL=1
|
||||
|
|
|
@ -61,6 +61,7 @@ Cu.import("resource://gre/modules/NetUtil.jsm");
|
|||
Cu.import("resource:///modules/PropertyPanel.jsm");
|
||||
Cu.import("resource:///modules/source-editor.jsm");
|
||||
Cu.import("resource:///modules/devtools/scratchpad-manager.jsm");
|
||||
Cu.import("resource://gre/modules/jsdebugger.jsm");
|
||||
|
||||
|
||||
const SCRATCHPAD_CONTEXT_CONTENT = 1;
|
||||
|
@ -295,6 +296,7 @@ var Scratchpad = {
|
|||
this._chromeSandbox = new Cu.Sandbox(this.browserWindow,
|
||||
{ sandboxPrototype: this.browserWindow, wantXrays: false,
|
||||
sandboxName: 'scratchpad-chrome'});
|
||||
addDebuggerToGlobal(this._chromeSandbox);
|
||||
|
||||
this._previousBrowserWindow = this.browserWindow;
|
||||
}
|
||||
|
|
|
@ -114,6 +114,10 @@ ifdef MOZ_JSDEBUGGER
|
|||
DEFINES += -DMOZ_JSDEBUGGER
|
||||
endif
|
||||
|
||||
ifdef NECKO_WIFI
|
||||
DEFINES += -DNECKO_WIFI
|
||||
endif
|
||||
|
||||
ifdef MOZ_PKG_MANIFEST_P
|
||||
MOZ_PKG_MANIFEST = package-manifest
|
||||
|
||||
|
|
Двоичные данные
browser/themes/gnomestripe/actionicon-tab.png
Двоичные данные
browser/themes/gnomestripe/actionicon-tab.png
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 293 B После Ширина: | Высота: | Размер: 244 B |
|
@ -1335,6 +1335,7 @@ toolbar[iconsize="small"] #feed-button {
|
|||
|
||||
richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-icon {
|
||||
list-style-image: url("chrome://browser/skin/actionicon-tab.png");
|
||||
padding: 0 3px;
|
||||
}
|
||||
|
||||
.autocomplete-treebody::-moz-tree-cell-text(treecolAutoCompleteComment) {
|
||||
|
|
Двоичные данные
browser/themes/pinstripe/actionicon-tab.png
Двоичные данные
browser/themes/pinstripe/actionicon-tab.png
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 293 B После Ширина: | Высота: | Размер: 649 B |
|
@ -1170,6 +1170,20 @@ richlistitem[selected="true"][current="true"] > hbox > .ac-result-type-bookmark,
|
|||
|
||||
richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-icon {
|
||||
list-style-image: url("chrome://browser/skin/actionicon-tab.png");
|
||||
-moz-image-region: rect(0, 16px, 16px, 0);
|
||||
padding: 0 3px;
|
||||
}
|
||||
|
||||
richlistitem[type~="action"][actiontype="switchtab"][selected="true"] > .ac-url-box > .ac-action-icon {
|
||||
-moz-image-region: rect(16px, 16px, 32px, 0);
|
||||
}
|
||||
|
||||
window[tabsontop="false"] richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-icon {
|
||||
-moz-image-region: rect(0, 32px, 16px, 16px);
|
||||
}
|
||||
|
||||
window[tabsontop="false"] richlistitem[type~="action"][actiontype="switchtab"][selected="true"] > .ac-url-box > .ac-action-icon {
|
||||
-moz-image-region: rect(16px, 32px, 32px, 16px);
|
||||
}
|
||||
|
||||
.autocomplete-treebody::-moz-tree-cell-text(treecolAutoCompleteComment) {
|
||||
|
|
Двоичные данные
browser/themes/winstripe/actionicon-tab.png
Двоичные данные
browser/themes/winstripe/actionicon-tab.png
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 293 B После Ширина: | Высота: | Размер: 434 B |
|
@ -1536,6 +1536,12 @@ html|*.urlbar-input:-moz-lwtheme:-moz-placeholder,
|
|||
|
||||
richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-icon {
|
||||
list-style-image: url("chrome://browser/skin/actionicon-tab.png");
|
||||
-moz-image-region: rect(0, 16px, 16px, 0);
|
||||
padding: 0 3px;
|
||||
}
|
||||
|
||||
richlistitem[type~="action"][actiontype="switchtab"][selected="true"] > .ac-url-box > .ac-action-icon {
|
||||
-moz-image-region: rect(16px, 16px, 32px, 0);
|
||||
}
|
||||
|
||||
.autocomplete-treebody::-moz-tree-cell-text(treecolAutoCompleteComment) {
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
fun:_ZN2js6Parser*
|
||||
fun:_ZN2js13FoldConstants*
|
||||
fun:_ZN2js8frontend.Emit*
|
||||
fun:_ZN2js8frontend..Emit*
|
||||
fun:_ZL.Emit*
|
||||
fun:_ZL..Emit*
|
||||
fun:_ZN2jsL23MarkRangeConservativelyEP8JSTracerPKmS3_
|
||||
fun:_ZN2jsL23MarkRangeConservativelyEP8JSTracerPKjS3_
|
|
@ -459,7 +459,7 @@ class ShutdownLeakLogger(object):
|
|||
DOM windows (that are still around after test suite shutdown, despite running
|
||||
the GC) to the tests that created them and prints leak statistics.
|
||||
"""
|
||||
MAX_LEAK_COUNT = 23
|
||||
MAX_LEAK_COUNT = 21
|
||||
|
||||
def __init__(self, logger):
|
||||
self.logger = logger
|
||||
|
@ -507,6 +507,10 @@ class ShutdownLeakLogger(object):
|
|||
created = line[:2] == "++"
|
||||
id = self._parseValue(line, "serial")
|
||||
|
||||
# log line has invalid format
|
||||
if not id:
|
||||
return
|
||||
|
||||
if self.currentTest:
|
||||
windows = self.currentTest["windows"]
|
||||
if created:
|
||||
|
@ -520,6 +524,10 @@ class ShutdownLeakLogger(object):
|
|||
created = line[:2] == "++"
|
||||
id = self._parseValue(line, "id")
|
||||
|
||||
# log line has invalid format
|
||||
if not id:
|
||||
return
|
||||
|
||||
if self.currentTest:
|
||||
docShells = self.currentTest["docShells"]
|
||||
if created:
|
||||
|
@ -530,7 +538,10 @@ class ShutdownLeakLogger(object):
|
|||
self.leakedDocShells.add(id)
|
||||
|
||||
def _parseValue(self, line, name):
|
||||
return re.search("\[%s = (.+?)\]" % name, line).group(1)
|
||||
match = re.search("\[%s = (.+?)\]" % name, line)
|
||||
if match:
|
||||
return match.group(1)
|
||||
return None
|
||||
|
||||
def _parseLeakingTests(self):
|
||||
leakingTests = []
|
||||
|
|
|
@ -307,10 +307,10 @@ my(@gCleanup, %gConfig, $gDarwinMajor, $gDryRun, $gVerbosity);
|
|||
'cmd_hdiutil' => 'hdiutil',
|
||||
'cmd_mkdir' => 'mkdir',
|
||||
'cmd_mktemp' => 'mktemp',
|
||||
'cmd_Rez' => '/Developer/Tools/Rez',
|
||||
'cmd_Rez' => 'Rez',
|
||||
'cmd_rm' => 'rm',
|
||||
'cmd_rsync' => 'rsync',
|
||||
'cmd_SetFile' => '/Developer/Tools/SetFile',
|
||||
'cmd_SetFile' => 'SetFile',
|
||||
|
||||
# create_directly indicates whether hdiutil create supports
|
||||
# -srcfolder and -srcdevice. It does on >= 10.3 (Panther).
|
||||
|
|
|
@ -363,10 +363,7 @@ JSContext *
|
|||
nsScriptSecurityManager::GetSafeJSContext()
|
||||
{
|
||||
// Get JSContext from stack.
|
||||
JSContext *cx;
|
||||
if (NS_FAILED(sJSContextStack->GetSafeJSContext(&cx)))
|
||||
return nsnull;
|
||||
return cx;
|
||||
return sJSContextStack->GetSafeJSContext();
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
|
|
@ -214,6 +214,9 @@ nsChromeProtocolHandler::NewChannel(nsIURI* aURI,
|
|||
|
||||
// Make sure that the channel remembers where it was
|
||||
// originally loaded from.
|
||||
nsLoadFlags loadFlags = 0;
|
||||
result->GetLoadFlags(&loadFlags);
|
||||
result->SetLoadFlags(loadFlags & ~nsIChannel::LOAD_REPLACE);
|
||||
rv = result->SetOriginalURI(aURI);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
|
12
configure.in
12
configure.in
|
@ -1926,6 +1926,11 @@ MOZ_ARG_ENABLE_BOOL(profiling,
|
|||
MOZ_PROFILING=1,
|
||||
MOZ_PROFILING= )
|
||||
|
||||
# For profiling builds keep the symbol information
|
||||
if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
|
||||
STRIP_FLAGS="--strip-debug"
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Use Valgrind
|
||||
dnl ========================================================
|
||||
|
@ -7438,6 +7443,13 @@ MOZ_ARG_DISABLE_BOOL(elf-hack,
|
|||
USE_ELF_HACK=,
|
||||
USE_ELF_HACK=1)
|
||||
|
||||
# Disable elf hack for profiling because the built in profiler
|
||||
# doesn't read the segments properly with elf hack. This is
|
||||
# temporary and should be fixed soon in the profiler.
|
||||
if test "$MOZ_PROFILING" = 1; then
|
||||
USE_ELF_HACK=
|
||||
fi
|
||||
|
||||
# Only enable elfhack where supported
|
||||
if test "$USE_ELF_HACK" = 1; then
|
||||
case "${HOST_OS_ARCH},${OS_ARCH}" in
|
||||
|
|
|
@ -1675,8 +1675,7 @@ nsContentUtils::TraceSafeJSContext(JSTracer* aTrc)
|
|||
if (!sThreadJSContextStack) {
|
||||
return;
|
||||
}
|
||||
JSContext* cx = nsnull;
|
||||
sThreadJSContextStack->GetSafeJSContext(&cx);
|
||||
JSContext* cx = sThreadJSContextStack->GetSafeJSContext();
|
||||
if (!cx) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -3863,7 +3863,7 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
|
|||
if (!cx) {
|
||||
nsContentUtils::ThreadJSContextStack()->Peek(&cx);
|
||||
if (!cx) {
|
||||
nsContentUtils::ThreadJSContextStack()->GetSafeJSContext(&cx);
|
||||
cx = nsContentUtils::ThreadJSContextStack()->GetSafeJSContext();
|
||||
NS_ASSERTION(cx, "Uhoh, no context, this is bad!");
|
||||
}
|
||||
}
|
||||
|
@ -6072,7 +6072,7 @@ GetContextAndScope(nsIDocument* aOldDocument, nsIDocument* aNewDocument,
|
|||
stack->Peek(&cx);
|
||||
|
||||
if (!cx) {
|
||||
stack->GetSafeJSContext(&cx);
|
||||
cx = stack->GetSafeJSContext();
|
||||
|
||||
if (!cx) {
|
||||
// No safe context reachable, bail.
|
||||
|
|
|
@ -379,7 +379,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
|
|||
{
|
||||
JSContext* ctx = mContext ? mContext : aContext;
|
||||
if (!ctx) {
|
||||
nsContentUtils::ThreadJSContextStack()->GetSafeJSContext(&ctx);
|
||||
ctx = nsContentUtils::ThreadJSContextStack()->GetSafeJSContext();
|
||||
}
|
||||
if (mListeners.Length()) {
|
||||
nsCOMPtr<nsIAtom> name = do_GetAtom(aMessage);
|
||||
|
@ -723,8 +723,7 @@ void
|
|||
nsFrameScriptExecutor::Shutdown()
|
||||
{
|
||||
if (sCachedScripts) {
|
||||
JSContext* cx = nsnull;
|
||||
nsContentUtils::ThreadJSContextStack()->GetSafeJSContext(&cx);
|
||||
JSContext* cx = nsContentUtils::ThreadJSContextStack()->GetSafeJSContext();
|
||||
if (cx) {
|
||||
#ifdef DEBUG_smaug
|
||||
printf("Will clear cached frame manager scripts!\n");
|
||||
|
|
|
@ -71,6 +71,7 @@ GK_ATOM(mozeditorbogusnode, "_moz_editor_bogus_node")
|
|||
GK_ATOM(mozgeneratedcontentbefore, "_moz_generated_content_before")
|
||||
GK_ATOM(mozgeneratedcontentafter, "_moz_generated_content_after")
|
||||
GK_ATOM(mozgeneratedcontentimage, "_moz_generated_content_image")
|
||||
GK_ATOM(mozquote, "_moz_quote")
|
||||
GK_ATOM(_moz_original_size, "_moz_original_size")
|
||||
GK_ATOM(_moz_target, "_moz_target")
|
||||
GK_ATOM(_moz_type, "_moz-type")
|
||||
|
|
|
@ -788,9 +788,11 @@ static void LogMessage(const char* aWarning, nsPIDOMWindow* aWindow)
|
|||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::GetResponseXML(nsIDOMDocument **aResponseXML)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
ErrorResult rv;
|
||||
nsIDocument* responseXML = GetResponseXML(rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (rv.Failed()) {
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
if (!responseXML) {
|
||||
*aResponseXML = nsnull;
|
||||
|
@ -801,11 +803,11 @@ nsXMLHttpRequest::GetResponseXML(nsIDOMDocument **aResponseXML)
|
|||
}
|
||||
|
||||
nsIDocument*
|
||||
nsXMLHttpRequest::GetResponseXML(nsresult& aRv)
|
||||
nsXMLHttpRequest::GetResponseXML(ErrorResult& aRv)
|
||||
{
|
||||
if (mResponseType != XML_HTTP_RESPONSE_TYPE_DEFAULT &&
|
||||
mResponseType != XML_HTTP_RESPONSE_TYPE_DOCUMENT) {
|
||||
aRv = NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return nsnull;
|
||||
}
|
||||
if (mWarnAboutMultipartHtml) {
|
||||
|
@ -929,22 +931,22 @@ nsXMLHttpRequest::AppendToResponseText(const char * aSrcBuffer,
|
|||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::GetResponseText(nsAString& aResponseText)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
ErrorResult rv;
|
||||
nsString responseText;
|
||||
GetResponseText(responseText, rv);
|
||||
aResponseText = responseText;
|
||||
return rv;
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
void
|
||||
nsXMLHttpRequest::GetResponseText(nsString& aResponseText, nsresult& aRv)
|
||||
nsXMLHttpRequest::GetResponseText(nsString& aResponseText, ErrorResult& aRv)
|
||||
{
|
||||
aResponseText.Truncate();
|
||||
|
||||
if (mResponseType != XML_HTTP_RESPONSE_TYPE_DEFAULT &&
|
||||
mResponseType != XML_HTTP_RESPONSE_TYPE_TEXT &&
|
||||
mResponseType != XML_HTTP_RESPONSE_TYPE_CHUNKED_TEXT) {
|
||||
aRv = NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -972,15 +974,17 @@ nsXMLHttpRequest::GetResponseText(nsString& aResponseText, nsresult& aRv)
|
|||
mResponseText.Truncate();
|
||||
mResponseBodyDecodedPos = 0;
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsICharsetConverterManager> ccm =
|
||||
do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &aRv);
|
||||
if (NS_FAILED(aRv)) {
|
||||
do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
return;
|
||||
}
|
||||
|
||||
aRv = ccm->GetUnicodeDecoderRaw(mResponseCharset.get(),
|
||||
getter_AddRefs(mDecoder));
|
||||
if (NS_FAILED(aRv)) {
|
||||
if (aRv.Failed()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -989,7 +993,7 @@ nsXMLHttpRequest::GetResponseText(nsString& aResponseText, nsresult& aRv)
|
|||
"Unexpected mResponseBodyDecodedPos");
|
||||
aRv = AppendToResponseText(mResponseBody.get() + mResponseBodyDecodedPos,
|
||||
mResponseBody.Length() - mResponseBodyDecodedPos);
|
||||
if (NS_FAILED(aRv)) {
|
||||
if (aRv.Failed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1134,27 +1138,27 @@ NS_IMETHODIMP nsXMLHttpRequest::SetResponseType(const nsAString& aResponseType)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
ErrorResult rv;
|
||||
SetResponseType(responseType, rv);
|
||||
return rv;
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
void
|
||||
nsXMLHttpRequest::SetResponseType(XMLHttpRequestResponseType aType,
|
||||
nsresult& aRv)
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
SetResponseType(ResponseType(aType), aRv);
|
||||
}
|
||||
|
||||
void
|
||||
nsXMLHttpRequest::SetResponseType(nsXMLHttpRequest::ResponseType aResponseType,
|
||||
nsresult& aRv)
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
// If the state is not OPENED or HEADERS_RECEIVED raise an
|
||||
// INVALID_STATE_ERR exception and terminate these steps.
|
||||
if (!(mState & (XML_HTTP_REQUEST_OPENED | XML_HTTP_REQUEST_SENT |
|
||||
XML_HTTP_REQUEST_HEADERS_RECEIVED))) {
|
||||
aRv = NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1162,14 +1166,14 @@ nsXMLHttpRequest::SetResponseType(nsXMLHttpRequest::ResponseType aResponseType,
|
|||
if (HasOrHasHadOwner() &&
|
||||
!(mState & (XML_HTTP_REQUEST_UNSENT | XML_HTTP_REQUEST_ASYNC))) {
|
||||
LogMessage("ResponseTypeSyncXHRWarning", GetOwner());
|
||||
aRv = NS_ERROR_DOM_INVALID_ACCESS_ERR;
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(mState & XML_HTTP_REQUEST_ASYNC) &&
|
||||
(aResponseType == XML_HTTP_RESPONSE_TYPE_CHUNKED_TEXT ||
|
||||
aResponseType == XML_HTTP_RESPONSE_TYPE_CHUNKED_ARRAYBUFFER)) {
|
||||
aRv = NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1188,20 +1192,19 @@ nsXMLHttpRequest::SetResponseType(nsXMLHttpRequest::ResponseType aResponseType,
|
|||
mResponseType == XML_HTTP_RESPONSE_TYPE_MOZ_BLOB);
|
||||
}
|
||||
}
|
||||
aRv = NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute jsval response; */
|
||||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::GetResponse(JSContext *aCx, jsval *aResult)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
ErrorResult rv;
|
||||
*aResult = GetResponse(aCx, rv);
|
||||
return rv;
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
JS::Value
|
||||
nsXMLHttpRequest::GetResponse(JSContext* aCx, nsresult& aRv)
|
||||
nsXMLHttpRequest::GetResponse(JSContext* aCx, ErrorResult& aRv)
|
||||
{
|
||||
switch (mResponseType) {
|
||||
case XML_HTTP_RESPONSE_TYPE_DEFAULT:
|
||||
|
@ -1210,12 +1213,12 @@ nsXMLHttpRequest::GetResponse(JSContext* aCx, nsresult& aRv)
|
|||
{
|
||||
nsString str;
|
||||
aRv = GetResponseText(str);
|
||||
if (NS_FAILED(aRv)) {
|
||||
if (aRv.Failed()) {
|
||||
return JSVAL_NULL;
|
||||
}
|
||||
JS::Value result;
|
||||
if (!xpc::StringToJsval(aCx, str, &result)) {
|
||||
aRv = NS_ERROR_OUT_OF_MEMORY;
|
||||
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return JSVAL_NULL;
|
||||
}
|
||||
return result;
|
||||
|
@ -1235,7 +1238,7 @@ nsXMLHttpRequest::GetResponse(JSContext* aCx, nsresult& aRv)
|
|||
RootResultArrayBuffer();
|
||||
aRv = nsContentUtils::CreateArrayBuffer(aCx, mResponseBody,
|
||||
&mResultArrayBuffer);
|
||||
if (NS_FAILED(aRv)) {
|
||||
if (aRv.Failed()) {
|
||||
return JSVAL_NULL;
|
||||
}
|
||||
}
|
||||
|
@ -1251,7 +1254,7 @@ nsXMLHttpRequest::GetResponse(JSContext* aCx, nsresult& aRv)
|
|||
|
||||
if (!mResponseBlob) {
|
||||
aRv = CreatePartialBlob();
|
||||
if (NS_FAILED(aRv)) {
|
||||
if (aRv.Failed()) {
|
||||
return JSVAL_NULL;
|
||||
}
|
||||
}
|
||||
|
@ -1288,7 +1291,7 @@ nsXMLHttpRequest::GetResponse(JSContext* aCx, nsresult& aRv)
|
|||
if (mResultJSON == JSVAL_VOID) {
|
||||
aRv = CreateResponseParsedJSON(aCx);
|
||||
mResponseText.Truncate();
|
||||
if (NS_FAILED(aRv)) {
|
||||
if (aRv.Failed()) {
|
||||
// Per spec, errors aren't propagated. null is returned instead.
|
||||
aRv = NS_OK;
|
||||
// It would be nice to log the error to the console. That's hard to
|
||||
|
@ -1499,14 +1502,14 @@ NS_IMETHODIMP
|
|||
nsXMLHttpRequest::GetResponseHeader(const nsACString& aHeader,
|
||||
nsACString& aResult)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
ErrorResult rv;
|
||||
GetResponseHeader(aHeader, aResult, rv);
|
||||
return rv;
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
void
|
||||
nsXMLHttpRequest::GetResponseHeader(const nsACString& header,
|
||||
nsACString& _retval, nsresult& aRv)
|
||||
nsACString& _retval, ErrorResult& aRv)
|
||||
{
|
||||
_retval.SetIsVoid(true);
|
||||
|
||||
|
@ -1610,7 +1613,7 @@ nsXMLHttpRequest::GetResponseHeader(const nsACString& header,
|
|||
}
|
||||
|
||||
aRv = httpChannel->GetResponseHeader(header, _retval);
|
||||
if (aRv == NS_ERROR_NOT_AVAILABLE) {
|
||||
if (aRv.ErrorCode() == NS_ERROR_NOT_AVAILABLE) {
|
||||
// Means no header
|
||||
_retval.SetIsVoid(true);
|
||||
aRv = NS_OK;
|
||||
|
@ -2518,17 +2521,18 @@ nsXMLHttpRequest::ChangeStateToDone()
|
|||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::SendAsBinary(const nsAString &aBody, JSContext *aCx)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
ErrorResult rv;
|
||||
SendAsBinary(aCx, aBody, rv);
|
||||
return rv;
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
void
|
||||
nsXMLHttpRequest::SendAsBinary(JSContext *aCx, const nsAString &aBody, nsresult& aRv)
|
||||
nsXMLHttpRequest::SendAsBinary(JSContext *aCx, const nsAString &aBody,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
char *data = static_cast<char*>(NS_Alloc(aBody.Length() + 1));
|
||||
if (!data) {
|
||||
aRv = NS_ERROR_OUT_OF_MEMORY;
|
||||
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2539,7 +2543,7 @@ nsXMLHttpRequest::SendAsBinary(JSContext *aCx, const nsAString &aBody, nsresult&
|
|||
while (iter != end) {
|
||||
if (*iter & 0xFF00) {
|
||||
NS_Free(data);
|
||||
aRv = NS_ERROR_DOM_INVALID_CHARACTER_ERR;
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_CHARACTER_ERR);
|
||||
return;
|
||||
}
|
||||
*p++ = static_cast<char>(*iter++);
|
||||
|
@ -2549,7 +2553,7 @@ nsXMLHttpRequest::SendAsBinary(JSContext *aCx, const nsAString &aBody, nsresult&
|
|||
nsCOMPtr<nsIInputStream> stream;
|
||||
aRv = NS_NewByteInputStream(getter_AddRefs(stream), data, aBody.Length(),
|
||||
NS_ASSIGNMENT_ADOPT);
|
||||
if (NS_FAILED(aRv)){
|
||||
if (aRv.Failed()) {
|
||||
NS_Free(data);
|
||||
return;
|
||||
}
|
||||
|
@ -2557,7 +2561,7 @@ nsXMLHttpRequest::SendAsBinary(JSContext *aCx, const nsAString &aBody, nsresult&
|
|||
nsCOMPtr<nsIWritableVariant> variant = new nsVariant();
|
||||
|
||||
aRv = variant->SetAsISupports(stream);
|
||||
if (NS_FAILED(aRv)) {
|
||||
if (aRv.Failed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3298,20 +3302,20 @@ nsXMLHttpRequest::GetTimeout(PRUint32 *aTimeout)
|
|||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::SetTimeout(PRUint32 aTimeout)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
ErrorResult rv;
|
||||
SetTimeout(aTimeout, rv);
|
||||
return rv;
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
void
|
||||
nsXMLHttpRequest::SetTimeout(uint32_t aTimeout, nsresult& aRv)
|
||||
nsXMLHttpRequest::SetTimeout(uint32_t aTimeout, ErrorResult& aRv)
|
||||
{
|
||||
if (!(mState & (XML_HTTP_REQUEST_ASYNC | XML_HTTP_REQUEST_UNSENT)) &&
|
||||
HasOrHasHadOwner()) {
|
||||
/* Timeout is not supported for synchronous requests with an owning window,
|
||||
per XHR2 spec. */
|
||||
LogMessage("TimeoutSyncXHRWarning", GetOwner());
|
||||
aRv = NS_ERROR_DOM_INVALID_ACCESS_ERR;
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3871,17 +3875,17 @@ nsXMLHttpRequest::GetInterface(const nsIID & aIID, void **aResult)
|
|||
}
|
||||
|
||||
JS::Value
|
||||
nsXMLHttpRequest::GetInterface(JSContext* aCx, nsIJSIID* aIID, nsresult& aRv)
|
||||
nsXMLHttpRequest::GetInterface(JSContext* aCx, nsIJSIID* aIID, ErrorResult& aRv)
|
||||
{
|
||||
const nsID* iid = aIID->GetID();
|
||||
nsCOMPtr<nsISupports> result;
|
||||
JS::Value v = JSVAL_NULL;
|
||||
aRv = GetInterface(*iid, getter_AddRefs(result));
|
||||
NS_ENSURE_SUCCESS(aRv, JSVAL_NULL);
|
||||
NS_ENSURE_FALSE(aRv.Failed(), JSVAL_NULL);
|
||||
|
||||
JSObject* global = JS_GetGlobalForObject(aCx, GetWrapper());
|
||||
aRv = nsContentUtils::WrapNative(aCx, global, result, iid, &v);
|
||||
return NS_SUCCEEDED(aRv) ? v : JSVAL_NULL;
|
||||
return aRv.Failed() ? JSVAL_NULL : v;
|
||||
}
|
||||
|
||||
nsXMLHttpRequestUpload*
|
||||
|
|
|
@ -84,7 +84,7 @@ class nsIDOMFormData;
|
|||
{ \
|
||||
return GetListenerAsJSObject(mOn##_capitalized##Listener); \
|
||||
} \
|
||||
void SetOn##_lowercase(JSContext* aCx, JSObject* aCallback, nsresult& aRv) \
|
||||
void SetOn##_lowercase(JSContext* aCx, JSObject* aCallback, ErrorResult& aRv) \
|
||||
{ \
|
||||
aRv = SetJSObjectListener(aCx, NS_LITERAL_STRING(#_lowercase), \
|
||||
mOn##_capitalized##Listener, \
|
||||
|
@ -211,12 +211,12 @@ public:
|
|||
|
||||
// The WebIDL parser converts constructors into methods called _Constructor.
|
||||
static already_AddRefed<nsXMLHttpRequest>
|
||||
_Constructor(nsISupports* aGlobal, nsresult& aRv)
|
||||
_Constructor(nsISupports* aGlobal, ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal);
|
||||
nsCOMPtr<nsIScriptObjectPrincipal> principal = do_QueryInterface(aGlobal);
|
||||
if (!window || ! principal) {
|
||||
aRv = NS_ERROR_FAILURE;
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -283,13 +283,13 @@ public:
|
|||
|
||||
// request
|
||||
void Open(const nsAString& aMethod, const nsAString& aUrl, bool aAsync,
|
||||
const nsAString& aUser, const nsAString& aPassword, nsresult& aRv)
|
||||
const nsAString& aUser, const nsAString& aPassword, ErrorResult& aRv)
|
||||
{
|
||||
aRv = Open(NS_ConvertUTF16toUTF8(aMethod), NS_ConvertUTF16toUTF8(aUrl),
|
||||
aAsync, aUser, aPassword);
|
||||
}
|
||||
void SetRequestHeader(const nsAString& aHeader, const nsAString& aValue,
|
||||
nsresult& aRv)
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
aRv = SetRequestHeader(NS_ConvertUTF16toUTF8(aHeader),
|
||||
NS_ConvertUTF16toUTF8(aValue));
|
||||
|
@ -298,7 +298,7 @@ public:
|
|||
{
|
||||
return mTimeoutMilliseconds;
|
||||
}
|
||||
void SetTimeout(uint32_t aTimeout, nsresult& aRv);
|
||||
void SetTimeout(uint32_t aTimeout, ErrorResult& aRv);
|
||||
bool GetWithCredentials();
|
||||
void SetWithCredentials(bool aWithCredentials, nsresult& aRv);
|
||||
nsXMLHttpRequestUpload* GetUpload();
|
||||
|
@ -387,26 +387,26 @@ private:
|
|||
}
|
||||
|
||||
public:
|
||||
void Send(JSContext *aCx, nsresult& aRv)
|
||||
void Send(JSContext *aCx, ErrorResult& aRv)
|
||||
{
|
||||
aRv = Send(aCx, Nullable<RequestBody>());
|
||||
}
|
||||
void Send(JSContext *aCx, JSObject* aArrayBuffer, nsresult& aRv)
|
||||
void Send(JSContext *aCx, JSObject* aArrayBuffer, ErrorResult& aRv)
|
||||
{
|
||||
NS_ASSERTION(aArrayBuffer, "Null should go to string version");
|
||||
aRv = Send(aCx, RequestBody(aArrayBuffer));
|
||||
}
|
||||
void Send(JSContext *aCx, nsIDOMBlob* aBlob, nsresult& aRv)
|
||||
void Send(JSContext *aCx, nsIDOMBlob* aBlob, ErrorResult& aRv)
|
||||
{
|
||||
NS_ASSERTION(aBlob, "Null should go to string version");
|
||||
aRv = Send(aCx, RequestBody(aBlob));
|
||||
}
|
||||
void Send(JSContext *aCx, nsIDocument* aDoc, nsresult& aRv)
|
||||
void Send(JSContext *aCx, nsIDocument* aDoc, ErrorResult& aRv)
|
||||
{
|
||||
NS_ASSERTION(aDoc, "Null should go to string version");
|
||||
aRv = Send(aCx, RequestBody(aDoc));
|
||||
}
|
||||
void Send(JSContext *aCx, const nsAString& aString, nsresult& aRv)
|
||||
void Send(JSContext *aCx, const nsAString& aString, ErrorResult& aRv)
|
||||
{
|
||||
if (DOMStringIsNull(aString)) {
|
||||
Send(aCx, aRv);
|
||||
|
@ -415,17 +415,17 @@ public:
|
|||
aRv = Send(aCx, RequestBody(aString));
|
||||
}
|
||||
}
|
||||
void Send(JSContext *aCx, nsIDOMFormData* aFormData, nsresult& aRv)
|
||||
void Send(JSContext *aCx, nsIDOMFormData* aFormData, ErrorResult& aRv)
|
||||
{
|
||||
NS_ASSERTION(aFormData, "Null should go to string version");
|
||||
aRv = Send(aCx, RequestBody(aFormData));
|
||||
}
|
||||
void Send(JSContext *aCx, nsIInputStream* aStream, nsresult& aRv)
|
||||
void Send(JSContext *aCx, nsIInputStream* aStream, ErrorResult& aRv)
|
||||
{
|
||||
NS_ASSERTION(aStream, "Null should go to string version");
|
||||
aRv = Send(aCx, RequestBody(aStream));
|
||||
}
|
||||
void SendAsBinary(JSContext *aCx, const nsAString& aBody, nsresult& aRv);
|
||||
void SendAsBinary(JSContext *aCx, const nsAString& aBody, ErrorResult& aRv);
|
||||
|
||||
void Abort();
|
||||
|
||||
|
@ -433,9 +433,9 @@ public:
|
|||
uint32_t GetStatus();
|
||||
void GetStatusText(nsString& aStatusText);
|
||||
void GetResponseHeader(const nsACString& aHeader, nsACString& aResult,
|
||||
nsresult& aRv);
|
||||
ErrorResult& aRv);
|
||||
void GetResponseHeader(const nsAString& aHeader, nsString& aResult,
|
||||
nsresult& aRv)
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsCString result;
|
||||
GetResponseHeader(NS_ConvertUTF16toUTF8(aHeader), result, aRv);
|
||||
|
@ -460,10 +460,10 @@ public:
|
|||
{
|
||||
return XMLHttpRequestResponseType(mResponseType);
|
||||
}
|
||||
void SetResponseType(XMLHttpRequestResponseType aType, nsresult& aRv);
|
||||
JS::Value GetResponse(JSContext* aCx, nsresult& aRv);
|
||||
void GetResponseText(nsString& aResponseText, nsresult& aRv);
|
||||
nsIDocument* GetResponseXML(nsresult& aRv);
|
||||
void SetResponseType(XMLHttpRequestResponseType aType, ErrorResult& aRv);
|
||||
JS::Value GetResponse(JSContext* aCx, ErrorResult& aRv);
|
||||
void GetResponseText(nsString& aResponseText, ErrorResult& aRv);
|
||||
nsIDocument* GetResponseXML(ErrorResult& aRv);
|
||||
|
||||
bool GetMozBackgroundRequest();
|
||||
void SetMozBackgroundRequest(bool aMozBackgroundRequest, nsresult& aRv);
|
||||
|
@ -476,7 +476,7 @@ public:
|
|||
}
|
||||
|
||||
// We need a GetInterface callable from JS for chrome JS
|
||||
JS::Value GetInterface(JSContext* aCx, nsIJSIID* aIID, nsresult& aRv);
|
||||
JS::Value GetInterface(JSContext* aCx, nsIJSIID* aIID, ErrorResult& aRv);
|
||||
|
||||
// This creates a trusted readystatechange event, which is not cancelable and
|
||||
// doesn't bubble.
|
||||
|
@ -633,7 +633,7 @@ protected:
|
|||
XML_HTTP_RESPONSE_TYPE_MOZ_BLOB
|
||||
};
|
||||
|
||||
void SetResponseType(nsXMLHttpRequest::ResponseType aType, nsresult& aRv);
|
||||
void SetResponseType(nsXMLHttpRequest::ResponseType aType, ErrorResult& aRv);
|
||||
|
||||
ResponseType mResponseType;
|
||||
|
||||
|
|
|
@ -107,6 +107,8 @@ INCLUDES += \
|
|||
-I$(srcdir)/../../../layout/generic \
|
||||
-I$(srcdir)/../../base/src \
|
||||
-I$(srcdir)/../../html/content/src \
|
||||
-I$(srcdir)/../../../js/xpconnect/src \
|
||||
-I$(srcdir)/../../../dom/base \
|
||||
$(NULL)
|
||||
|
||||
DEFINES += -D_IMPL_NS_LAYOUT
|
||||
|
|
|
@ -784,22 +784,35 @@ WebGLContext::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
|
|||
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::GetContextAttributes(jsval *aResult)
|
||||
{
|
||||
ErrorResult rv;
|
||||
JSObject* obj = GetContextAttributes(rv);
|
||||
if (rv.Failed())
|
||||
return rv.ErrorCode();
|
||||
|
||||
*aResult = JS::ObjectOrNullValue(obj);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
JSObject*
|
||||
WebGLContext::GetContextAttributes(ErrorResult &rv)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
{
|
||||
*aResult = OBJECT_TO_JSVAL(NULL);
|
||||
return NS_OK;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
JSContext *cx = nsContentUtils::GetCurrentJSContext();
|
||||
if (!cx)
|
||||
return NS_ERROR_FAILURE;
|
||||
if (!cx) {
|
||||
rv.Throw(NS_ERROR_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
JSObject *obj = JS_NewObject(cx, NULL, NULL, NULL);
|
||||
if (!obj)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aResult = OBJECT_TO_JSVAL(obj);
|
||||
if (!obj) {
|
||||
rv.Throw(NS_ERROR_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gl::ContextFormat cf = gl->ActualFormat();
|
||||
|
||||
|
@ -818,11 +831,11 @@ WebGLContext::GetContextAttributes(jsval *aResult)
|
|||
mOptions.preserveDrawingBuffer ? JSVAL_TRUE : JSVAL_FALSE,
|
||||
NULL, NULL, JSPROP_ENUMERATE))
|
||||
{
|
||||
*aResult = JSVAL_VOID;
|
||||
return NS_ERROR_FAILURE;
|
||||
rv.Throw(NS_ERROR_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return obj;
|
||||
}
|
||||
|
||||
/* [noscript] DOMString mozGetUnderlyingParamString(in WebGLenum pname); */
|
||||
|
@ -884,12 +897,19 @@ bool WebGLContext::IsExtensionSupported(WebGLExtensionID ei)
|
|||
NS_IMETHODIMP
|
||||
WebGLContext::GetExtension(const nsAString& aName, nsIWebGLExtension **retval)
|
||||
{
|
||||
*retval = nsnull;
|
||||
*retval = GetExtension(aName);
|
||||
NS_IF_ADDREF(*retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIWebGLExtension*
|
||||
WebGLContext::GetExtension(const nsAString& aName)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
return NS_OK;
|
||||
return nsnull;
|
||||
|
||||
if (mDisableExtensions) {
|
||||
return NS_OK;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
// handle simple extensions that don't need custom objects first
|
||||
|
@ -930,10 +950,10 @@ WebGLContext::GetExtension(const nsAString& aName, nsIWebGLExtension **retval)
|
|||
break;
|
||||
}
|
||||
}
|
||||
NS_ADDREF(*retval = mEnabledExtensions[ei]);
|
||||
return mEnabledExtensions[ei];
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1026,13 +1046,13 @@ WebGLContext::EnsureBackbufferClearedAsNeeded()
|
|||
Invalidate();
|
||||
}
|
||||
|
||||
nsresult
|
||||
void
|
||||
WebGLContext::DummyFramebufferOperation(const char *info)
|
||||
{
|
||||
WebGLenum status;
|
||||
CheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER, &status);
|
||||
if (status == LOCAL_GL_FRAMEBUFFER_COMPLETE)
|
||||
return NS_OK;
|
||||
return;
|
||||
else
|
||||
return ErrorInvalidFramebufferOperation("%s: incomplete framebuffer", info);
|
||||
}
|
||||
|
@ -1193,22 +1213,33 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(WebGLContext)
|
|||
NS_IMPL_CYCLE_COLLECTING_RELEASE(WebGLContext)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(WebGLContext)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(WebGLContext)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(WebGLContext)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mCanvasElement)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSTARRAY(mEnabledExtensions)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(WebGLContext)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mCanvasElement)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSTARRAY_OF_NSCOMPTR(mEnabledExtensions)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
DOMCI_DATA(WebGLRenderingContext, WebGLContext)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WebGLContext)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMWebGLRenderingContext)
|
||||
NS_INTERFACE_MAP_ENTRY(nsICanvasRenderingContextInternal)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_INTERFACE_MAP_ENTRY(nsITimerCallback)
|
||||
// If the exact way we cast to nsISupports here ever changes, fix our
|
||||
// PreCreate hook!
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMWebGLRenderingContext)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLRenderingContext)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
@ -1357,10 +1388,7 @@ DOMCI_DATA(WebGLExtension, WebGLExtension)
|
|||
NS_IMETHODIMP
|
||||
WebGLContext::GetDrawingBufferWidth(WebGLsizei *aWidth)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
return NS_OK;
|
||||
|
||||
*aWidth = mWidth;
|
||||
*aWidth = GetDrawingBufferWidth();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1368,10 +1396,7 @@ WebGLContext::GetDrawingBufferWidth(WebGLsizei *aWidth)
|
|||
NS_IMETHODIMP
|
||||
WebGLContext::GetDrawingBufferHeight(WebGLsizei *aHeight)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
return NS_OK;
|
||||
|
||||
*aHeight = mHeight;
|
||||
*aHeight = GetDrawingBufferHeight();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1439,32 +1464,30 @@ WebGLShaderPrecisionFormat::GetPrecision(WebGLint *aPrecision)
|
|||
NS_IMETHODIMP
|
||||
WebGLContext::GetSupportedExtensions(nsIVariant **retval)
|
||||
{
|
||||
*retval = nsnull;
|
||||
if (!IsContextStable())
|
||||
return NS_OK;
|
||||
|
||||
if (mDisableExtensions) {
|
||||
Nullable< nsTArray<nsString> > extensions;
|
||||
GetSupportedExtensions(extensions);
|
||||
|
||||
if (extensions.IsNull()) {
|
||||
*retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsCOMPtr<nsIWritableVariant> wrval = do_CreateInstance("@mozilla.org/variant;1");
|
||||
NS_ENSURE_TRUE(wrval, NS_ERROR_FAILURE);
|
||||
|
||||
nsTArray<const char *> extList;
|
||||
|
||||
if (IsExtensionSupported(WebGL_OES_texture_float))
|
||||
extList.InsertElementAt(extList.Length(), "OES_texture_float");
|
||||
if (IsExtensionSupported(WebGL_OES_standard_derivatives))
|
||||
extList.InsertElementAt(extList.Length(), "OES_standard_derivatives");
|
||||
if (IsExtensionSupported(WebGL_EXT_texture_filter_anisotropic))
|
||||
extList.InsertElementAt(extList.Length(), "MOZ_EXT_texture_filter_anisotropic");
|
||||
if (IsExtensionSupported(WebGL_MOZ_WEBGL_lose_context))
|
||||
extList.InsertElementAt(extList.Length(), "MOZ_WEBGL_lose_context");
|
||||
const nsTArray<nsString>& extList = extensions.Value();
|
||||
|
||||
nsresult rv;
|
||||
if (extList.Length() > 0) {
|
||||
rv = wrval->SetAsArray(nsIDataType::VTYPE_CHAR_STR, nsnull,
|
||||
extList.Length(), &extList[0]);
|
||||
// nsIVariant can't handle SetAsArray with the AString or
|
||||
// DOMString type, so we have to spoon-feed it something it
|
||||
// knows how to handle.
|
||||
nsTArray<const PRUnichar*> exts(extList.Length());
|
||||
for (PRUint32 i = 0; i < extList.Length(); ++i) {
|
||||
exts.AppendElement(extList[i].get());
|
||||
}
|
||||
rv = wrval->SetAsArray(nsIDataType::VTYPE_WCHAR_STR, nsnull,
|
||||
exts.Length(), exts.Elements());
|
||||
} else {
|
||||
rv = wrval->SetAsEmptyArray();
|
||||
}
|
||||
|
@ -1473,6 +1496,30 @@ WebGLContext::GetSupportedExtensions(nsIVariant **retval)
|
|||
|
||||
*retval = wrval.forget().get();
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::GetSupportedExtensions(Nullable< nsTArray<nsString> > &retval)
|
||||
{
|
||||
retval.SetNull();
|
||||
if (!IsContextStable())
|
||||
return;
|
||||
|
||||
if (mDisableExtensions) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsTArray<nsString>& arr = retval.SetValue();
|
||||
|
||||
if (IsExtensionSupported(WebGL_OES_texture_float))
|
||||
arr.AppendElement(NS_LITERAL_STRING("OES_texture_float"));
|
||||
if (IsExtensionSupported(WebGL_OES_standard_derivatives))
|
||||
arr.AppendElement(NS_LITERAL_STRING("OES_standard_derivatives"));
|
||||
if (IsExtensionSupported(WebGL_EXT_texture_filter_anisotropic))
|
||||
arr.AppendElement(NS_LITERAL_STRING("MOZ_EXT_texture_filter_anisotropic"));
|
||||
if (IsExtensionSupported(WebGL_MOZ_WEBGL_lose_context))
|
||||
arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_lose_context"));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1481,10 +1528,3 @@ WebGLContext::IsContextLost(WebGLboolean *retval)
|
|||
*retval = mContextStatus != ContextStable;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Internalized version of IsContextLost.
|
||||
bool
|
||||
WebGLContext::IsContextStable()
|
||||
{
|
||||
return mContextStatus == ContextStable;
|
||||
}
|
||||
|
|
|
@ -67,12 +67,18 @@
|
|||
#include "CheckedInt.h"
|
||||
#include "nsDataHashtable.h"
|
||||
|
||||
#include "mozilla/dom/ImageData.h"
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
#include "ForceDiscreteGPUHelperCGL.h"
|
||||
#endif
|
||||
|
||||
#include "angle/ShaderLang.h"
|
||||
|
||||
#include "mozilla/dom/TypedArray.h"
|
||||
#include "mozilla/dom/Nullable.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
|
||||
/*
|
||||
* Minimum value constants defined in 6.2 State Tables of OpenGL ES - 2.0.25
|
||||
* https://bugzilla.mozilla.org/show_bug.cgi?id=686732
|
||||
|
@ -109,6 +115,8 @@ struct WebGLVertexAttribData;
|
|||
class WebGLMemoryPressureObserver;
|
||||
class WebGLRectangleObject;
|
||||
class WebGLContextBoundObject;
|
||||
class WebGLActiveInfo;
|
||||
class WebGLShaderPrecisionFormat;
|
||||
|
||||
enum FakeBlackStatus { DoNotNeedFakeBlack, DoNeedFakeBlack, DontKnowIfNeedFakeBlack };
|
||||
|
||||
|
@ -523,7 +531,8 @@ class WebGLContext :
|
|||
public nsICanvasRenderingContextInternal,
|
||||
public nsSupportsWeakReference,
|
||||
public nsITimerCallback,
|
||||
public WebGLRectangleObject
|
||||
public WebGLRectangleObject,
|
||||
public nsWrapperCache
|
||||
{
|
||||
friend class WebGLMemoryMultiReporterWrapper;
|
||||
friend class WebGLExtensionLoseContext;
|
||||
|
@ -536,7 +545,12 @@ public:
|
|||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(WebGLContext, nsIDOMWebGLRenderingContext)
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(WebGLContext,
|
||||
nsIDOMWebGLRenderingContext)
|
||||
|
||||
nsINode* GetParentObject() {
|
||||
return HTMLCanvasElement();
|
||||
}
|
||||
|
||||
NS_DECL_NSIDOMWEBGLRENDERINGCONTEXT
|
||||
|
||||
|
@ -544,7 +558,7 @@ public:
|
|||
|
||||
// nsICanvasRenderingContextInternal
|
||||
NS_IMETHOD SetCanvasElement(nsHTMLCanvasElement* aParentCanvas);
|
||||
nsHTMLCanvasElement* HTMLCanvasElement() {
|
||||
nsHTMLCanvasElement* HTMLCanvasElement() const {
|
||||
return static_cast<nsHTMLCanvasElement*>(mCanvasElement.get());
|
||||
}
|
||||
|
||||
|
@ -578,22 +592,22 @@ public:
|
|||
bool LoseContext();
|
||||
bool RestoreContext();
|
||||
|
||||
nsresult SynthesizeGLError(WebGLenum err);
|
||||
nsresult SynthesizeGLError(WebGLenum err, const char *fmt, ...);
|
||||
void SynthesizeGLError(WebGLenum err);
|
||||
void SynthesizeGLError(WebGLenum err, const char *fmt, ...);
|
||||
|
||||
nsresult ErrorInvalidEnum(const char *fmt = 0, ...);
|
||||
nsresult ErrorInvalidOperation(const char *fmt = 0, ...);
|
||||
nsresult ErrorInvalidValue(const char *fmt = 0, ...);
|
||||
nsresult ErrorInvalidFramebufferOperation(const char *fmt = 0, ...);
|
||||
nsresult ErrorInvalidEnumInfo(const char *info, PRUint32 enumvalue) {
|
||||
void ErrorInvalidEnum(const char *fmt = 0, ...);
|
||||
void ErrorInvalidOperation(const char *fmt = 0, ...);
|
||||
void ErrorInvalidValue(const char *fmt = 0, ...);
|
||||
void ErrorInvalidFramebufferOperation(const char *fmt = 0, ...);
|
||||
void ErrorInvalidEnumInfo(const char *info, PRUint32 enumvalue) {
|
||||
return ErrorInvalidEnum("%s: invalid enum value 0x%x", info, enumvalue);
|
||||
}
|
||||
nsresult ErrorOutOfMemory(const char *fmt = 0, ...);
|
||||
void ErrorOutOfMemory(const char *fmt = 0, ...);
|
||||
|
||||
const char *ErrorName(GLenum error);
|
||||
bool IsTextureFormatCompressed(GLenum format);
|
||||
|
||||
nsresult DummyFramebufferOperation(const char *info);
|
||||
void DummyFramebufferOperation(const char *info);
|
||||
|
||||
WebGLTexture *activeBoundTextureForTarget(WebGLenum target) {
|
||||
return target == LOCAL_GL_TEXTURE_2D ? mBound2DTextures[mActiveTexture]
|
||||
|
@ -666,6 +680,402 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
// WebIDL WebGLRenderingContext API
|
||||
nsHTMLCanvasElement* GetCanvas() const {
|
||||
return HTMLCanvasElement();
|
||||
}
|
||||
WebGLsizei GetDrawingBufferWidth() const {
|
||||
if (!IsContextStable())
|
||||
return 0;
|
||||
return mWidth;
|
||||
}
|
||||
WebGLsizei GetDrawingBufferHeight() const {
|
||||
if (!IsContextStable())
|
||||
return 0;
|
||||
return mHeight;
|
||||
}
|
||||
|
||||
JSObject *GetContextAttributes(ErrorResult &rv);
|
||||
bool IsContextLost() const { return !IsContextStable(); }
|
||||
void GetSupportedExtensions(dom::Nullable< nsTArray<nsString> > &retval);
|
||||
nsIWebGLExtension* GetExtension(const nsAString& aName);
|
||||
void ActiveTexture(WebGLenum texture);
|
||||
void AttachShader(WebGLProgram* program, WebGLShader* shader);
|
||||
void BindAttribLocation(WebGLProgram* program, WebGLuint location,
|
||||
const nsAString& name);
|
||||
void BindBuffer(WebGLenum target, WebGLBuffer* buf);
|
||||
void BindFramebuffer(WebGLenum target, WebGLFramebuffer* wfb);
|
||||
void BindRenderbuffer(WebGLenum target, WebGLRenderbuffer* wrb);
|
||||
void BindTexture(WebGLenum target, WebGLTexture *tex);
|
||||
void BlendColor(WebGLclampf r, WebGLclampf g, WebGLclampf b, WebGLclampf a) {
|
||||
if (!IsContextStable())
|
||||
return;
|
||||
MakeContextCurrent();
|
||||
gl->fBlendColor(r, g, b, a);
|
||||
}
|
||||
void BlendEquation(WebGLenum mode);
|
||||
void BlendEquationSeparate(WebGLenum modeRGB, WebGLenum modeAlpha);
|
||||
void BlendFunc(WebGLenum sfactor, WebGLenum dfactor);
|
||||
void BlendFuncSeparate(WebGLenum srcRGB, WebGLenum dstRGB,
|
||||
WebGLenum srcAlpha, WebGLenum dstAlpha);
|
||||
void BufferData(WebGLenum target, WebGLsizeiptr size, WebGLenum usage);
|
||||
void BufferData(WebGLenum target, dom::ArrayBufferView &data,
|
||||
WebGLenum usage);
|
||||
void BufferData(WebGLenum target, dom::ArrayBuffer *data, WebGLenum usage);
|
||||
void BufferSubData(WebGLenum target, WebGLsizeiptr byteOffset,
|
||||
dom::ArrayBufferView &data);
|
||||
void BufferSubData(WebGLenum target, WebGLsizeiptr byteOffset,
|
||||
dom::ArrayBuffer *data);
|
||||
WebGLenum CheckFramebufferStatus(WebGLenum target);
|
||||
void Clear(WebGLbitfield mask);
|
||||
void ClearColor(WebGLclampf r, WebGLclampf g, WebGLclampf b, WebGLclampf a);
|
||||
void ClearDepth(WebGLclampf v);
|
||||
void ClearStencil(WebGLint v);
|
||||
void ColorMask(WebGLboolean r, WebGLboolean g, WebGLboolean b, WebGLboolean a);
|
||||
void CompileShader(WebGLShader *shader);
|
||||
void CompressedTexImage2D(WebGLenum target, WebGLint level,
|
||||
WebGLenum internalformat, WebGLsizei width,
|
||||
WebGLsizei height, WebGLint border,
|
||||
dom::ArrayBufferView& view);
|
||||
void CompressedTexSubImage2D(WebGLenum target, WebGLint level,
|
||||
WebGLint xoffset, WebGLint yoffset,
|
||||
WebGLsizei width, WebGLsizei height,
|
||||
WebGLenum format, dom::ArrayBufferView& view);
|
||||
void CopyTexImage2D(WebGLenum target, WebGLint level,
|
||||
WebGLenum internalformat, WebGLint x, WebGLint y,
|
||||
WebGLsizei width, WebGLsizei height, WebGLint border);
|
||||
void CopyTexSubImage2D(WebGLenum target, WebGLint level, WebGLint xoffset,
|
||||
WebGLint yoffset, WebGLint x, WebGLint y,
|
||||
WebGLsizei width, WebGLsizei height);
|
||||
already_AddRefed<WebGLBuffer> CreateBuffer();
|
||||
already_AddRefed<WebGLFramebuffer> CreateFramebuffer();
|
||||
already_AddRefed<WebGLProgram> CreateProgram();
|
||||
already_AddRefed<WebGLRenderbuffer> CreateRenderbuffer();
|
||||
already_AddRefed<WebGLTexture> CreateTexture();
|
||||
already_AddRefed<WebGLShader> CreateShader(WebGLenum type);
|
||||
void CullFace(WebGLenum face);
|
||||
void DeleteBuffer(WebGLBuffer *buf);
|
||||
void DeleteFramebuffer(WebGLFramebuffer *fbuf);
|
||||
void DeleteProgram(WebGLProgram *prog);
|
||||
void DeleteRenderbuffer(WebGLRenderbuffer *rbuf);
|
||||
void DeleteShader(WebGLShader *shader);
|
||||
void DeleteTexture(WebGLTexture *tex);
|
||||
void DepthFunc(WebGLenum func);
|
||||
void DepthMask(WebGLboolean b);
|
||||
void DepthRange(WebGLclampf zNear, WebGLclampf zFar);
|
||||
void DetachShader(WebGLProgram *program, WebGLShader *shader);
|
||||
void Disable(WebGLenum cap);
|
||||
void DisableVertexAttribArray(WebGLuint index);
|
||||
void DrawArrays(GLenum mode, WebGLint first, WebGLsizei count);
|
||||
void DrawElements(WebGLenum mode, WebGLsizei count, WebGLenum type,
|
||||
WebGLintptr byteOffset);
|
||||
void Enable(WebGLenum cap);
|
||||
void EnableVertexAttribArray(WebGLuint index);
|
||||
void Flush() {
|
||||
if (!IsContextStable())
|
||||
return;
|
||||
MakeContextCurrent();
|
||||
gl->fFlush();
|
||||
}
|
||||
void Finish() {
|
||||
if (!IsContextStable())
|
||||
return;
|
||||
MakeContextCurrent();
|
||||
gl->fFinish();
|
||||
}
|
||||
void FramebufferRenderbuffer(WebGLenum target, WebGLenum attachment,
|
||||
WebGLenum rbtarget, WebGLRenderbuffer *wrb);
|
||||
void FramebufferTexture2D(WebGLenum target, WebGLenum attachment,
|
||||
WebGLenum textarget, WebGLTexture *tobj,
|
||||
WebGLint level);
|
||||
void FrontFace(WebGLenum mode);
|
||||
void GenerateMipmap(WebGLenum target);
|
||||
already_AddRefed<WebGLActiveInfo> GetActiveAttrib(WebGLProgram *prog,
|
||||
WebGLuint index);
|
||||
already_AddRefed<WebGLActiveInfo> GetActiveUniform(WebGLProgram *prog,
|
||||
WebGLuint index);
|
||||
void GetAttachedShaders(WebGLProgram* prog,
|
||||
dom::Nullable< nsTArray<WebGLShader*> > &retval);
|
||||
WebGLint GetAttribLocation(WebGLProgram* prog, const nsAString& name);
|
||||
JS::Value GetBufferParameter(WebGLenum target, WebGLenum pname);
|
||||
JS::Value GetParameter(JSContext* cx, WebGLenum pname, ErrorResult& rv);
|
||||
WebGLenum GetError();
|
||||
JS::Value GetFramebufferAttachmentParameter(JSContext* cx,
|
||||
WebGLenum target,
|
||||
WebGLenum attachment,
|
||||
WebGLenum pname,
|
||||
ErrorResult& rv);
|
||||
JS::Value GetProgramParameter(WebGLProgram *prog, WebGLenum pname);
|
||||
void GetProgramInfoLog(WebGLProgram *prog, nsAString& retval, ErrorResult& rv);
|
||||
JS::Value GetRenderbufferParameter(WebGLenum target, WebGLenum pname);
|
||||
JS::Value GetShaderParameter(WebGLShader *shader, WebGLenum pname);
|
||||
already_AddRefed<WebGLShaderPrecisionFormat>
|
||||
GetShaderPrecisionFormat(WebGLenum shadertype, WebGLenum precisiontype);
|
||||
void GetShaderInfoLog(WebGLShader *shader, nsAString& retval, ErrorResult& rv);
|
||||
void GetShaderSource(WebGLShader *shader, nsAString& retval);
|
||||
JS::Value GetTexParameter(WebGLenum target, WebGLenum pname);
|
||||
JS::Value GetUniform(JSContext* cx, WebGLProgram *prog,
|
||||
WebGLUniformLocation *location, ErrorResult& rv);
|
||||
already_AddRefed<WebGLUniformLocation>
|
||||
GetUniformLocation(WebGLProgram *prog, const nsAString& name);
|
||||
JS::Value GetVertexAttrib(JSContext* cx, WebGLuint index, WebGLenum pname,
|
||||
ErrorResult& rv);
|
||||
WebGLsizeiptr GetVertexAttribOffset(WebGLuint index, WebGLenum pname);
|
||||
void Hint(WebGLenum target, WebGLenum mode);
|
||||
bool IsBuffer(WebGLBuffer *buffer);
|
||||
bool IsEnabled(WebGLenum cap);
|
||||
bool IsFramebuffer(WebGLFramebuffer *fb);
|
||||
bool IsProgram(WebGLProgram *prog);
|
||||
bool IsRenderbuffer(WebGLRenderbuffer *rb);
|
||||
bool IsShader(WebGLShader *shader);
|
||||
bool IsTexture(WebGLTexture *tex);
|
||||
void LineWidth(WebGLfloat width) {
|
||||
if (!IsContextStable())
|
||||
return;
|
||||
MakeContextCurrent();
|
||||
gl->fLineWidth(width);
|
||||
}
|
||||
void LinkProgram(WebGLProgram *program, ErrorResult& rv);
|
||||
void PixelStorei(WebGLenum pname, WebGLint param);
|
||||
void PolygonOffset(WebGLfloat factor, WebGLfloat units) {
|
||||
if (!IsContextStable())
|
||||
return;
|
||||
MakeContextCurrent();
|
||||
gl->fPolygonOffset(factor, units);
|
||||
}
|
||||
void ReadPixels(WebGLint x, WebGLint y, WebGLsizei width, WebGLsizei height,
|
||||
WebGLenum format, WebGLenum type,
|
||||
dom::ArrayBufferView* pixels, ErrorResult& rv);
|
||||
void RenderbufferStorage(WebGLenum target, WebGLenum internalformat,
|
||||
WebGLsizei width, WebGLsizei height);
|
||||
void SampleCoverage(WebGLclampf value, WebGLboolean invert) {
|
||||
if (!IsContextStable())
|
||||
return;
|
||||
MakeContextCurrent();
|
||||
gl->fSampleCoverage(value, invert);
|
||||
}
|
||||
void Scissor(WebGLint x, WebGLint y, WebGLsizei width, WebGLsizei height);
|
||||
void ShaderSource(WebGLShader *shader, const nsAString& source);
|
||||
void StencilFunc(WebGLenum func, WebGLint ref, WebGLuint mask);
|
||||
void StencilFuncSeparate(WebGLenum face, WebGLenum func, WebGLint ref,
|
||||
WebGLuint mask);
|
||||
void StencilMask(WebGLuint mask);
|
||||
void StencilMaskSeparate(WebGLenum face, WebGLuint mask);
|
||||
void StencilOp(WebGLenum sfail, WebGLenum dpfail, WebGLenum dppass);
|
||||
void StencilOpSeparate(WebGLenum face, WebGLenum sfail, WebGLenum dpfail,
|
||||
WebGLenum dppass);
|
||||
void TexImage2D(JSContext* cx, WebGLenum target, WebGLint level,
|
||||
WebGLenum internalformat, WebGLsizei width,
|
||||
WebGLsizei height, WebGLint border, WebGLenum format,
|
||||
WebGLenum type, dom::ArrayBufferView *pixels,
|
||||
ErrorResult& rv);
|
||||
void TexImage2D(JSContext* cx, WebGLenum target, WebGLint level,
|
||||
WebGLenum internalformat, WebGLenum format, WebGLenum type,
|
||||
dom::ImageData* pixels, ErrorResult& rv);
|
||||
void TexImage2D(JSContext* /* unused */, WebGLenum target, WebGLint level,
|
||||
WebGLenum internalformat, WebGLenum format, WebGLenum type,
|
||||
dom::Element* elt, ErrorResult& rv);
|
||||
void TexParameterf(WebGLenum target, WebGLenum pname, WebGLfloat param) {
|
||||
TexParameter_base(target, pname, nsnull, ¶m);
|
||||
}
|
||||
void TexParameteri(WebGLenum target, WebGLenum pname, WebGLint param) {
|
||||
TexParameter_base(target, pname, ¶m, nsnull);
|
||||
}
|
||||
|
||||
void TexSubImage2D(JSContext* cx, WebGLenum target, WebGLint level,
|
||||
WebGLint xoffset, WebGLint yoffset,
|
||||
WebGLsizei width, WebGLsizei height, WebGLenum format,
|
||||
WebGLenum type, dom::ArrayBufferView* pixels,
|
||||
ErrorResult& rv);
|
||||
void TexSubImage2D(JSContext* cx, WebGLenum target, WebGLint level,
|
||||
WebGLint xoffset, WebGLint yoffset, WebGLenum format,
|
||||
WebGLenum type, dom::ImageData* pixels, ErrorResult& rv);
|
||||
void TexSubImage2D(JSContext* /* unused */, WebGLenum target, WebGLint level,
|
||||
WebGLint xoffset, WebGLint yoffset, WebGLenum format,
|
||||
WebGLenum type, dom::Element* elt, ErrorResult& rv);
|
||||
|
||||
void Uniform1i(WebGLUniformLocation* location, WebGLint x);
|
||||
void Uniform2i(WebGLUniformLocation* location, WebGLint x, WebGLint y);
|
||||
void Uniform3i(WebGLUniformLocation* location, WebGLint x, WebGLint y,
|
||||
WebGLint z);
|
||||
void Uniform4i(WebGLUniformLocation* location, WebGLint x, WebGLint y,
|
||||
WebGLint z, WebGLint w);
|
||||
|
||||
void Uniform1f(WebGLUniformLocation* location, WebGLfloat x);
|
||||
void Uniform2f(WebGLUniformLocation* location, WebGLfloat x, WebGLfloat y);
|
||||
void Uniform3f(WebGLUniformLocation* location, WebGLfloat x, WebGLfloat y,
|
||||
WebGLfloat z);
|
||||
void Uniform4f(WebGLUniformLocation* location, WebGLfloat x, WebGLfloat y,
|
||||
WebGLfloat z, WebGLfloat w);
|
||||
|
||||
void Uniform1iv(WebGLUniformLocation* location, dom::Int32Array& arr) {
|
||||
Uniform1iv_base(location, arr.mLength, arr.mData);
|
||||
}
|
||||
void Uniform1iv(WebGLUniformLocation* location, nsTArray<WebGLint>& arr) {
|
||||
Uniform1iv_base(location, arr.Length(), arr.Elements());
|
||||
}
|
||||
void Uniform1iv_base(WebGLUniformLocation* location, uint32_t arrayLength,
|
||||
WebGLint* data);
|
||||
|
||||
void Uniform2iv(WebGLUniformLocation* location, dom::Int32Array& arr) {
|
||||
Uniform2iv_base(location, arr.mLength, arr.mData);
|
||||
}
|
||||
void Uniform2iv(WebGLUniformLocation* location, nsTArray<WebGLint>& arr) {
|
||||
Uniform2iv_base(location, arr.Length(), arr.Elements());
|
||||
}
|
||||
void Uniform2iv_base(WebGLUniformLocation* location, uint32_t arrayLength,
|
||||
WebGLint* data);
|
||||
|
||||
void Uniform3iv(WebGLUniformLocation* location, dom::Int32Array& arr) {
|
||||
Uniform3iv_base(location, arr.mLength, arr.mData);
|
||||
}
|
||||
void Uniform3iv(WebGLUniformLocation* location, nsTArray<WebGLint>& arr) {
|
||||
Uniform3iv_base(location, arr.Length(), arr.Elements());
|
||||
}
|
||||
void Uniform3iv_base(WebGLUniformLocation* location, uint32_t arrayLength,
|
||||
WebGLint* data);
|
||||
|
||||
void Uniform4iv(WebGLUniformLocation* location, dom::Int32Array& arr) {
|
||||
Uniform4iv_base(location, arr.mLength, arr.mData);
|
||||
}
|
||||
void Uniform4iv(WebGLUniformLocation* location, nsTArray<WebGLint>& arr) {
|
||||
Uniform4iv_base(location, arr.Length(), arr.Elements());
|
||||
}
|
||||
void Uniform4iv_base(WebGLUniformLocation* location, uint32_t arrayLength,
|
||||
WebGLint* data);
|
||||
|
||||
void Uniform1fv(WebGLUniformLocation* location, dom::Float32Array& arr) {
|
||||
Uniform1fv_base(location, arr.mLength, arr.mData);
|
||||
}
|
||||
void Uniform1fv(WebGLUniformLocation* location, nsTArray<WebGLfloat>& arr) {
|
||||
Uniform1fv_base(location, arr.Length(), arr.Elements());
|
||||
}
|
||||
void Uniform1fv_base(WebGLUniformLocation* location, uint32_t arrayLength,
|
||||
WebGLfloat* data);
|
||||
|
||||
void Uniform2fv(WebGLUniformLocation* location, dom::Float32Array& arr) {
|
||||
Uniform2fv_base(location, arr.mLength, arr.mData);
|
||||
}
|
||||
void Uniform2fv(WebGLUniformLocation* location, nsTArray<WebGLfloat>& arr) {
|
||||
Uniform2fv_base(location, arr.Length(), arr.Elements());
|
||||
}
|
||||
void Uniform2fv_base(WebGLUniformLocation* location, uint32_t arrayLength,
|
||||
WebGLfloat* data);
|
||||
|
||||
void Uniform3fv(WebGLUniformLocation* location, dom::Float32Array& arr) {
|
||||
Uniform3fv_base(location, arr.mLength, arr.mData);
|
||||
}
|
||||
void Uniform3fv(WebGLUniformLocation* location, nsTArray<WebGLfloat>& arr) {
|
||||
Uniform3fv_base(location, arr.Length(), arr.Elements());
|
||||
}
|
||||
void Uniform3fv_base(WebGLUniformLocation* location, uint32_t arrayLength,
|
||||
WebGLfloat* data);
|
||||
|
||||
void Uniform4fv(WebGLUniformLocation* location, dom::Float32Array& arr) {
|
||||
Uniform4fv_base(location, arr.mLength, arr.mData);
|
||||
}
|
||||
void Uniform4fv(WebGLUniformLocation* location, nsTArray<WebGLfloat>& arr) {
|
||||
Uniform4fv_base(location, arr.Length(), arr.Elements());
|
||||
}
|
||||
void Uniform4fv_base(WebGLUniformLocation* location, uint32_t arrayLength,
|
||||
WebGLfloat* data);
|
||||
|
||||
void UniformMatrix2fv(WebGLUniformLocation* location,
|
||||
WebGLboolean transpose,
|
||||
dom::Float32Array &value) {
|
||||
UniformMatrix2fv_base(location, transpose, value.mLength, value.mData);
|
||||
}
|
||||
void UniformMatrix2fv(WebGLUniformLocation* location,
|
||||
WebGLboolean transpose,
|
||||
nsTArray<float> &value) {
|
||||
UniformMatrix2fv_base(location, transpose, value.Length(),
|
||||
value.Elements());
|
||||
}
|
||||
void UniformMatrix2fv_base(WebGLUniformLocation* location,
|
||||
WebGLboolean transpose, uint32_t arrayLength,
|
||||
float* data);
|
||||
|
||||
void UniformMatrix3fv(WebGLUniformLocation* location,
|
||||
WebGLboolean transpose,
|
||||
dom::Float32Array &value) {
|
||||
UniformMatrix3fv_base(location, transpose, value.mLength, value.mData);
|
||||
}
|
||||
void UniformMatrix3fv(WebGLUniformLocation* location,
|
||||
WebGLboolean transpose,
|
||||
nsTArray<float> &value) {
|
||||
UniformMatrix3fv_base(location, transpose, value.Length(),
|
||||
value.Elements());
|
||||
}
|
||||
void UniformMatrix3fv_base(WebGLUniformLocation* location,
|
||||
WebGLboolean transpose, uint32_t arrayLength,
|
||||
float* data);
|
||||
|
||||
void UniformMatrix4fv(WebGLUniformLocation* location,
|
||||
WebGLboolean transpose,
|
||||
dom::Float32Array &value) {
|
||||
UniformMatrix4fv_base(location, transpose, value.mLength, value.mData);
|
||||
}
|
||||
void UniformMatrix4fv(WebGLUniformLocation* location,
|
||||
WebGLboolean transpose,
|
||||
nsTArray<float> &value) {
|
||||
UniformMatrix4fv_base(location, transpose, value.Length(),
|
||||
value.Elements());
|
||||
}
|
||||
void UniformMatrix4fv_base(WebGLUniformLocation* location,
|
||||
WebGLboolean transpose, uint32_t arrayLength,
|
||||
float* data);
|
||||
|
||||
void UseProgram(WebGLProgram *prog);
|
||||
void ValidateProgram(WebGLProgram *prog);
|
||||
|
||||
void VertexAttrib1f(WebGLuint index, WebGLfloat x0);
|
||||
void VertexAttrib2f(WebGLuint index, WebGLfloat x0, WebGLfloat x1);
|
||||
void VertexAttrib3f(WebGLuint index, WebGLfloat x0, WebGLfloat x1,
|
||||
WebGLfloat x2);
|
||||
void VertexAttrib4f(WebGLuint index, WebGLfloat x0, WebGLfloat x1,
|
||||
WebGLfloat x2, WebGLfloat x3);
|
||||
|
||||
void VertexAttrib1fv(WebGLuint idx, dom::Float32Array &arr) {
|
||||
VertexAttrib1fv_base(idx, arr.mLength, arr.mData);
|
||||
}
|
||||
void VertexAttrib1fv(WebGLuint idx, nsTArray<WebGLfloat>& arr) {
|
||||
VertexAttrib1fv_base(idx, arr.Length(), arr.Elements());
|
||||
}
|
||||
void VertexAttrib1fv_base(WebGLuint idx, uint32_t arrayLength,
|
||||
WebGLfloat* ptr);
|
||||
|
||||
void VertexAttrib2fv(WebGLuint idx, dom::Float32Array &arr) {
|
||||
VertexAttrib2fv_base(idx, arr.mLength, arr.mData);
|
||||
}
|
||||
void VertexAttrib2fv(WebGLuint idx, nsTArray<WebGLfloat>& arr) {
|
||||
VertexAttrib2fv_base(idx, arr.Length(), arr.Elements());
|
||||
}
|
||||
void VertexAttrib2fv_base(WebGLuint idx, uint32_t arrayLength,
|
||||
WebGLfloat* ptr);
|
||||
|
||||
void VertexAttrib3fv(WebGLuint idx, dom::Float32Array &arr) {
|
||||
VertexAttrib3fv_base(idx, arr.mLength, arr.mData);
|
||||
}
|
||||
void VertexAttrib3fv(WebGLuint idx, nsTArray<WebGLfloat>& arr) {
|
||||
VertexAttrib3fv_base(idx, arr.Length(), arr.Elements());
|
||||
}
|
||||
void VertexAttrib3fv_base(WebGLuint idx, uint32_t arrayLength,
|
||||
WebGLfloat* ptr);
|
||||
|
||||
void VertexAttrib4fv(WebGLuint idx, dom::Float32Array &arr) {
|
||||
VertexAttrib4fv_base(idx, arr.mLength, arr.mData);
|
||||
}
|
||||
void VertexAttrib4fv(WebGLuint idx, nsTArray<WebGLfloat>& arr) {
|
||||
VertexAttrib4fv_base(idx, arr.Length(), arr.Elements());
|
||||
}
|
||||
void VertexAttrib4fv_base(WebGLuint idx, uint32_t arrayLength,
|
||||
WebGLfloat* ptr);
|
||||
|
||||
void VertexAttribPointer(WebGLuint index, WebGLint size, WebGLenum type,
|
||||
WebGLboolean normalized, WebGLsizei stride,
|
||||
WebGLintptr byteOffset);
|
||||
void Viewport(WebGLint x, WebGLint y, WebGLsizei width, WebGLsizei height);
|
||||
|
||||
protected:
|
||||
void SetDontKnowIfNeedFakeBlack() {
|
||||
mFakeBlackStatus = DontKnowIfNeedFakeBlack;
|
||||
|
@ -690,13 +1100,6 @@ protected:
|
|||
return ((x + y - 1) / y) * y;
|
||||
}
|
||||
|
||||
nsresult BufferData_size(WebGLenum target, WebGLsizei size, WebGLenum usage);
|
||||
nsresult BufferData_buf(WebGLenum target, JSObject* data, WebGLenum usage, JSContext *cx);
|
||||
nsresult BufferData_array(WebGLenum target, JSObject* data, WebGLenum usage, JSContext *cx);
|
||||
|
||||
nsresult BufferSubData_buf(WebGLenum target, PRInt32 offset, JSObject* data, JSContext *cx);
|
||||
nsresult BufferSubData_array(WebGLenum target, PRInt32 offset, JSObject* data, JSContext *cx);
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLCanvasElement> mCanvasElement;
|
||||
|
||||
nsRefPtr<gl::GLContext> gl;
|
||||
|
@ -797,21 +1200,21 @@ protected:
|
|||
void MakeContextCurrent() { gl->MakeCurrent(); }
|
||||
|
||||
// helpers
|
||||
nsresult TexImage2D_base(WebGLenum target, WebGLint level, WebGLenum internalformat,
|
||||
WebGLsizei width, WebGLsizei height, WebGLsizei srcStrideOrZero, WebGLint border,
|
||||
WebGLenum format, WebGLenum type,
|
||||
void *data, PRUint32 byteLength,
|
||||
int jsArrayType,
|
||||
int srcFormat, bool srcPremultiplied);
|
||||
nsresult TexSubImage2D_base(WebGLenum target, WebGLint level,
|
||||
WebGLint xoffset, WebGLint yoffset,
|
||||
WebGLsizei width, WebGLsizei height, WebGLsizei srcStrideOrZero,
|
||||
WebGLenum format, WebGLenum type,
|
||||
void *pixels, PRUint32 byteLength,
|
||||
int jsArrayType,
|
||||
int srcFormat, bool srcPremultiplied);
|
||||
nsresult TexParameter_base(WebGLenum target, WebGLenum pname,
|
||||
WebGLint *intParamPtr, WebGLfloat *floatParamPtr);
|
||||
void TexImage2D_base(WebGLenum target, WebGLint level, WebGLenum internalformat,
|
||||
WebGLsizei width, WebGLsizei height, WebGLsizei srcStrideOrZero, WebGLint border,
|
||||
WebGLenum format, WebGLenum type,
|
||||
void *data, PRUint32 byteLength,
|
||||
int jsArrayType,
|
||||
int srcFormat, bool srcPremultiplied);
|
||||
void TexSubImage2D_base(WebGLenum target, WebGLint level,
|
||||
WebGLint xoffset, WebGLint yoffset,
|
||||
WebGLsizei width, WebGLsizei height, WebGLsizei srcStrideOrZero,
|
||||
WebGLenum format, WebGLenum type,
|
||||
void *pixels, PRUint32 byteLength,
|
||||
int jsArrayType,
|
||||
int srcFormat, bool srcPremultiplied);
|
||||
void TexParameter_base(WebGLenum target, WebGLenum pname,
|
||||
WebGLint *intParamPtr, WebGLfloat *floatParamPtr);
|
||||
|
||||
void ConvertImage(size_t width, size_t height, size_t srcStride, size_t dstStride,
|
||||
const PRUint8*src, PRUint8 *dst,
|
||||
|
@ -823,48 +1226,38 @@ protected:
|
|||
gfxImageSurface **imageOut,
|
||||
int *format);
|
||||
|
||||
nsresult CopyTexSubImage2D_base(WebGLenum target,
|
||||
WebGLint level,
|
||||
WebGLenum internalformat,
|
||||
WebGLint xoffset,
|
||||
WebGLint yoffset,
|
||||
WebGLint x,
|
||||
WebGLint y,
|
||||
WebGLsizei width,
|
||||
WebGLsizei height,
|
||||
bool sub
|
||||
);
|
||||
void CopyTexSubImage2D_base(WebGLenum target,
|
||||
WebGLint level,
|
||||
WebGLenum internalformat,
|
||||
WebGLint xoffset,
|
||||
WebGLint yoffset,
|
||||
WebGLint x,
|
||||
WebGLint y,
|
||||
WebGLsizei width,
|
||||
WebGLsizei height,
|
||||
bool sub);
|
||||
|
||||
// Conversion from public nsI* interfaces to concrete objects
|
||||
template<class ConcreteObjectType, class BaseInterfaceType>
|
||||
bool GetConcreteObject(const char *info,
|
||||
BaseInterfaceType *aInterface,
|
||||
ConcreteObjectType **aConcreteObject,
|
||||
bool *isNull = 0,
|
||||
bool *isDeleted = 0,
|
||||
bool generateErrors = true);
|
||||
|
||||
template<class ConcreteObjectType, class BaseInterfaceType>
|
||||
bool GetConcreteObjectAndGLName(const char *info,
|
||||
BaseInterfaceType *aInterface,
|
||||
ConcreteObjectType **aConcreteObject,
|
||||
WebGLuint *aGLObjectName,
|
||||
bool *isNull = 0,
|
||||
bool *isDeleted = 0);
|
||||
|
||||
template<class ConcreteObjectType, class BaseInterfaceType>
|
||||
bool GetGLName(const char *info,
|
||||
BaseInterfaceType *aInterface,
|
||||
WebGLuint *aGLObjectName,
|
||||
bool *isNull = 0,
|
||||
bool *isDeleted = 0);
|
||||
|
||||
template<class ConcreteObjectType, class BaseInterfaceType>
|
||||
bool CanGetConcreteObject(const char *info,
|
||||
BaseInterfaceType *aInterface,
|
||||
bool *isNull = 0,
|
||||
bool *isDeleted = 0);
|
||||
// Returns false if aObject is null or not valid
|
||||
template<class ObjectType>
|
||||
bool ValidateObject(const char* info, ObjectType *aObject);
|
||||
// Returns false if aObject is not valid. Considers null to be valid.
|
||||
template<class ObjectType>
|
||||
bool ValidateObjectAllowNull(const char* info, ObjectType *aObject);
|
||||
// Returns false if aObject is not valid, but considers deleted
|
||||
// objects and null objects valid.
|
||||
template<class ObjectType>
|
||||
bool ValidateObjectAllowDeletedOrNull(const char* info, ObjectType *aObject);
|
||||
// Returns false if aObject is null or not valid, but considers deleted
|
||||
// objects valid.
|
||||
template<class ObjectType>
|
||||
bool ValidateObjectAllowDeleted(const char* info, ObjectType *aObject);
|
||||
private:
|
||||
// Like ValidateObject, but only for cases when aObject is known
|
||||
// to not be null already.
|
||||
template<class ObjectType>
|
||||
bool ValidateObjectAssumeNonNull(const char* info, ObjectType *aObject);
|
||||
|
||||
protected:
|
||||
PRInt32 MaxTextureSizeForTarget(WebGLenum target) const {
|
||||
return target == LOCAL_GL_TEXTURE_2D ? mGLMaxTextureSize : mGLMaxCubeMapTextureSize;
|
||||
}
|
||||
|
@ -888,7 +1281,9 @@ protected:
|
|||
const GLvoid *data);
|
||||
|
||||
void MaybeRestoreContext();
|
||||
bool IsContextStable();
|
||||
bool IsContextStable() const {
|
||||
return mContextStatus == ContextStable;
|
||||
}
|
||||
void ForceLoseContext();
|
||||
void ForceRestoreContext();
|
||||
|
||||
|
@ -1046,6 +1441,8 @@ struct WebGLVertexAttribData {
|
|||
}
|
||||
};
|
||||
|
||||
// NOTE: When this class is switched to new DOM bindings, update the
|
||||
// (then-slow) WrapObject calls in GetParameter and GetVertexAttrib.
|
||||
class WebGLBuffer MOZ_FINAL
|
||||
: public nsIWebGLBuffer
|
||||
, public WebGLRefCountedObject<WebGLBuffer>
|
||||
|
@ -1184,6 +1581,8 @@ protected:
|
|||
void* mData; // in the case of an Element Array Buffer, we keep a copy.
|
||||
};
|
||||
|
||||
// NOTE: When this class is switched to new DOM bindings, update the (then-slow)
|
||||
// WrapObject calls in GetParameter and GetFramebufferAttachmentParameter.
|
||||
class WebGLTexture MOZ_FINAL
|
||||
: public nsIWebGLTexture
|
||||
, public WebGLRefCountedObject<WebGLTexture>
|
||||
|
@ -1802,6 +2201,8 @@ static bool SplitLastSquareBracket(nsACString& string, nsCString& bracketPart)
|
|||
typedef nsDataHashtable<nsCStringHashKey, nsCString> CStringMap;
|
||||
typedef nsDataHashtable<nsCStringHashKey, WebGLUniformInfo> CStringToUniformInfoMap;
|
||||
|
||||
// NOTE: When this class is switched to new DOM bindings, update the
|
||||
// (then-slow) WrapObject call in GetParameter.
|
||||
class WebGLProgram MOZ_FINAL
|
||||
: public nsIWebGLProgram
|
||||
, public WebGLRefCountedObject<WebGLProgram>
|
||||
|
@ -2049,6 +2450,8 @@ protected:
|
|||
int mAttribMaxNameLength;
|
||||
};
|
||||
|
||||
// NOTE: When this class is switched to new DOM bindings, update the (then-slow)
|
||||
// WrapObject calls in GetParameter and GetFramebufferAttachmentParameter.
|
||||
class WebGLRenderbuffer MOZ_FINAL
|
||||
: public nsIWebGLRenderbuffer
|
||||
, public WebGLRefCountedObject<WebGLRenderbuffer>
|
||||
|
@ -2255,6 +2658,8 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
// NOTE: When this class is switched to new DOM bindings, update the
|
||||
// (then-slow) WrapObject call in GetParameter.
|
||||
class WebGLFramebuffer MOZ_FINAL
|
||||
: public nsIWebGLFramebuffer
|
||||
, public WebGLRefCountedObject<WebGLFramebuffer>
|
||||
|
@ -2292,19 +2697,14 @@ public:
|
|||
void SetHasEverBeenBound(bool x) { mHasEverBeenBound = x; }
|
||||
WebGLuint GLName() { return mGLName; }
|
||||
|
||||
nsresult FramebufferRenderbuffer(WebGLenum target,
|
||||
WebGLenum attachment,
|
||||
WebGLenum rbtarget,
|
||||
nsIWebGLRenderbuffer *rbobj)
|
||||
void FramebufferRenderbuffer(WebGLenum target,
|
||||
WebGLenum attachment,
|
||||
WebGLenum rbtarget,
|
||||
WebGLRenderbuffer *wrb)
|
||||
{
|
||||
WebGLuint renderbuffername;
|
||||
bool isNull;
|
||||
WebGLRenderbuffer *wrb;
|
||||
|
||||
if (!mContext->GetConcreteObjectAndGLName("framebufferRenderbuffer: renderbuffer",
|
||||
rbobj, &wrb, &renderbuffername, &isNull))
|
||||
if (!mContext->ValidateObjectAllowNull("framebufferRenderbuffer: renderbuffer", wrb))
|
||||
{
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
if (target != LOCAL_GL_FRAMEBUFFER)
|
||||
|
@ -2333,30 +2733,25 @@ public:
|
|||
}
|
||||
|
||||
mContext->MakeContextCurrent();
|
||||
WebGLuint renderbuffername = wrb ? wrb->GLName() : 0;
|
||||
if (attachment == LOCAL_GL_DEPTH_STENCIL_ATTACHMENT) {
|
||||
mContext->gl->fFramebufferRenderbuffer(target, LOCAL_GL_DEPTH_ATTACHMENT, rbtarget, renderbuffername);
|
||||
mContext->gl->fFramebufferRenderbuffer(target, LOCAL_GL_STENCIL_ATTACHMENT, rbtarget, renderbuffername);
|
||||
} else {
|
||||
mContext->gl->fFramebufferRenderbuffer(target, attachment, rbtarget, renderbuffername);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult FramebufferTexture2D(WebGLenum target,
|
||||
WebGLenum attachment,
|
||||
WebGLenum textarget,
|
||||
nsIWebGLTexture *tobj,
|
||||
WebGLint level)
|
||||
void FramebufferTexture2D(WebGLenum target,
|
||||
WebGLenum attachment,
|
||||
WebGLenum textarget,
|
||||
WebGLTexture *wtex,
|
||||
WebGLint level)
|
||||
{
|
||||
WebGLuint texturename;
|
||||
bool isNull;
|
||||
WebGLTexture *wtex;
|
||||
|
||||
if (!mContext->GetConcreteObjectAndGLName("framebufferTexture2D: texture",
|
||||
tobj, &wtex, &texturename, &isNull))
|
||||
if (!mContext->ValidateObjectAllowNull("framebufferTexture2D: texture",
|
||||
wtex))
|
||||
{
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
if (target != LOCAL_GL_FRAMEBUFFER)
|
||||
|
@ -2390,6 +2785,7 @@ public:
|
|||
}
|
||||
|
||||
mContext->MakeContextCurrent();
|
||||
WebGLuint texturename = wtex ? wtex->GLName() : 0;
|
||||
if (attachment == LOCAL_GL_DEPTH_STENCIL_ATTACHMENT) {
|
||||
mContext->gl->fFramebufferTexture2D(target, LOCAL_GL_DEPTH_ATTACHMENT, textarget, texturename, level);
|
||||
mContext->gl->fFramebufferTexture2D(target, LOCAL_GL_STENCIL_ATTACHMENT, textarget, texturename, level);
|
||||
|
@ -2397,7 +2793,7 @@ public:
|
|||
mContext->gl->fFramebufferTexture2D(target, attachment, textarget, texturename, level);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
bool HasIncompleteAttachment() const {
|
||||
|
@ -2663,119 +3059,71 @@ inline const WebGLRectangleObject *WebGLContext::FramebufferRectangleObject() co
|
|||
** Template implementations
|
||||
**/
|
||||
|
||||
/* Helper function taking a BaseInterfaceType pointer, casting it to
|
||||
* ConcreteObjectType and performing some checks along the way.
|
||||
*
|
||||
* By default, null (respectively: deleted) aInterface pointers are
|
||||
* not allowed, but if you pass a non-null isNull (respectively:
|
||||
* isDeleted) pointer, then they become allowed and the value at
|
||||
* isNull (respecively isDeleted) is overwritten.
|
||||
*
|
||||
* If generateErrors is true (which is the default) then upon errors,
|
||||
* GL errors are synthesized and error messages are printed, prepended by
|
||||
* the 'info' string.
|
||||
*/
|
||||
|
||||
template<class ConcreteObjectType, class BaseInterfaceType>
|
||||
template<class ObjectType>
|
||||
inline bool
|
||||
WebGLContext::GetConcreteObject(const char *info,
|
||||
BaseInterfaceType *aInterface,
|
||||
ConcreteObjectType **aConcreteObject,
|
||||
bool *isNull,
|
||||
bool *isDeleted,
|
||||
bool generateErrors)
|
||||
WebGLContext::ValidateObjectAllowDeletedOrNull(const char* info,
|
||||
ObjectType *aObject)
|
||||
{
|
||||
if (!aInterface) {
|
||||
if (NS_LIKELY(isNull)) {
|
||||
// non-null isNull means that the caller will accept a null arg
|
||||
*isNull = true;
|
||||
if(isDeleted) *isDeleted = false;
|
||||
*aConcreteObject = 0;
|
||||
return true;
|
||||
} else {
|
||||
if (generateErrors)
|
||||
ErrorInvalidValue("%s: null object passed as argument", info);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isNull)
|
||||
*isNull = false;
|
||||
|
||||
// the key to why this static_cast is all we need to do (as opposed to the QueryInterface check we used to do)
|
||||
// is that since bug 638328, WebGL interfaces are marked 'builtinclass' in the IDL
|
||||
ConcreteObjectType *concrete = static_cast<ConcreteObjectType*>(aInterface);
|
||||
*aConcreteObject = concrete;
|
||||
|
||||
if (!concrete->IsCompatibleWithContext(this)) {
|
||||
// the object doesn't belong to this WebGLContext
|
||||
if (generateErrors)
|
||||
ErrorInvalidOperation("%s: object from different WebGL context (or older generation of this one) "
|
||||
"passed as argument", info);
|
||||
if (aObject && !aObject->IsCompatibleWithContext(this)) {
|
||||
ErrorInvalidOperation("%s: object from different WebGL context "
|
||||
"(or older generation of this one) "
|
||||
"passed as argument", info);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (concrete->IsDeleted()) {
|
||||
if (NS_LIKELY(isDeleted)) {
|
||||
// non-null isDeleted means that the caller will accept a deleted arg
|
||||
*isDeleted = true;
|
||||
return true;
|
||||
} else {
|
||||
if (generateErrors)
|
||||
ErrorInvalidValue("%s: deleted object passed as argument", info);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template<class ObjectType>
|
||||
inline bool
|
||||
WebGLContext::ValidateObjectAssumeNonNull(const char* info, ObjectType *aObject)
|
||||
{
|
||||
MOZ_ASSERT(aObject);
|
||||
|
||||
if (!ValidateObjectAllowDeletedOrNull(info, aObject))
|
||||
return false;
|
||||
|
||||
if (aObject->IsDeleted()) {
|
||||
ErrorInvalidValue("%s: deleted object passed as argument", info);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isDeleted)
|
||||
*isDeleted = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Same as GetConcreteObject, and in addition gets the GL object name.
|
||||
* Null objects give the name 0.
|
||||
*/
|
||||
template<class ConcreteObjectType, class BaseInterfaceType>
|
||||
template<class ObjectType>
|
||||
inline bool
|
||||
WebGLContext::GetConcreteObjectAndGLName(const char *info,
|
||||
BaseInterfaceType *aInterface,
|
||||
ConcreteObjectType **aConcreteObject,
|
||||
WebGLuint *aGLObjectName,
|
||||
bool *isNull,
|
||||
bool *isDeleted)
|
||||
WebGLContext::ValidateObjectAllowNull(const char* info, ObjectType *aObject)
|
||||
{
|
||||
bool result = GetConcreteObject(info, aInterface, aConcreteObject, isNull, isDeleted);
|
||||
if (result == false) return false;
|
||||
*aGLObjectName = *aConcreteObject ? (*aConcreteObject)->GLName() : 0;
|
||||
return true;
|
||||
if (!aObject) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return ValidateObjectAssumeNonNull(info, aObject);
|
||||
}
|
||||
|
||||
/* Same as GetConcreteObjectAndGLName when you don't need the concrete object pointer.
|
||||
*/
|
||||
template<class ConcreteObjectType, class BaseInterfaceType>
|
||||
template<class ObjectType>
|
||||
inline bool
|
||||
WebGLContext::GetGLName(const char *info,
|
||||
BaseInterfaceType *aInterface,
|
||||
WebGLuint *aGLObjectName,
|
||||
bool *isNull,
|
||||
bool *isDeleted)
|
||||
WebGLContext::ValidateObjectAllowDeleted(const char* info, ObjectType *aObject)
|
||||
{
|
||||
ConcreteObjectType *aConcreteObject;
|
||||
return GetConcreteObjectAndGLName(info, aInterface, &aConcreteObject, aGLObjectName, isNull, isDeleted);
|
||||
if (!aObject) {
|
||||
ErrorInvalidValue("%s: null object passed as argument", info);
|
||||
return false;
|
||||
}
|
||||
|
||||
return ValidateObjectAllowDeletedOrNull(info, aObject);
|
||||
}
|
||||
|
||||
/* Same as GetConcreteObject when you only want to check if the conversion succeeds.
|
||||
*/
|
||||
template<class ConcreteObjectType, class BaseInterfaceType>
|
||||
template<class ObjectType>
|
||||
inline bool
|
||||
WebGLContext::CanGetConcreteObject(const char *info,
|
||||
BaseInterfaceType *aInterface,
|
||||
bool *isNull,
|
||||
bool *isDeleted)
|
||||
WebGLContext::ValidateObject(const char* info, ObjectType *aObject)
|
||||
{
|
||||
ConcreteObjectType *aConcreteObject;
|
||||
return GetConcreteObject(info, aInterface, &aConcreteObject, isNull, isDeleted, false);
|
||||
if (!aObject) {
|
||||
ErrorInvalidValue("%s: null object passed as argument", info);
|
||||
return false;
|
||||
}
|
||||
|
||||
return ValidateObjectAssumeNonNull(info, aObject);
|
||||
}
|
||||
|
||||
class WebGLMemoryMultiReporterWrapper
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -135,7 +135,7 @@ WebGLContext::GetImageSize(WebGLsizei height,
|
|||
return checked_neededByteLength;
|
||||
}
|
||||
|
||||
nsresult
|
||||
void
|
||||
WebGLContext::SynthesizeGLError(WebGLenum err)
|
||||
{
|
||||
// If there is already a pending error, don't overwrite it;
|
||||
|
@ -149,11 +149,9 @@ WebGLContext::SynthesizeGLError(WebGLenum err)
|
|||
|
||||
if (!mWebGLError)
|
||||
mWebGLError = err;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
void
|
||||
WebGLContext::SynthesizeGLError(WebGLenum err, const char *fmt, ...)
|
||||
{
|
||||
va_list va;
|
||||
|
@ -164,7 +162,7 @@ WebGLContext::SynthesizeGLError(WebGLenum err, const char *fmt, ...)
|
|||
return SynthesizeGLError(err);
|
||||
}
|
||||
|
||||
nsresult
|
||||
void
|
||||
WebGLContext::ErrorInvalidEnum(const char *fmt, ...)
|
||||
{
|
||||
va_list va;
|
||||
|
@ -175,7 +173,7 @@ WebGLContext::ErrorInvalidEnum(const char *fmt, ...)
|
|||
return SynthesizeGLError(LOCAL_GL_INVALID_ENUM);
|
||||
}
|
||||
|
||||
nsresult
|
||||
void
|
||||
WebGLContext::ErrorInvalidOperation(const char *fmt, ...)
|
||||
{
|
||||
va_list va;
|
||||
|
@ -186,7 +184,7 @@ WebGLContext::ErrorInvalidOperation(const char *fmt, ...)
|
|||
return SynthesizeGLError(LOCAL_GL_INVALID_OPERATION);
|
||||
}
|
||||
|
||||
nsresult
|
||||
void
|
||||
WebGLContext::ErrorInvalidValue(const char *fmt, ...)
|
||||
{
|
||||
va_list va;
|
||||
|
@ -197,7 +195,7 @@ WebGLContext::ErrorInvalidValue(const char *fmt, ...)
|
|||
return SynthesizeGLError(LOCAL_GL_INVALID_VALUE);
|
||||
}
|
||||
|
||||
nsresult
|
||||
void
|
||||
WebGLContext::ErrorInvalidFramebufferOperation(const char *fmt, ...)
|
||||
{
|
||||
va_list va;
|
||||
|
@ -208,7 +206,7 @@ WebGLContext::ErrorInvalidFramebufferOperation(const char *fmt, ...)
|
|||
return SynthesizeGLError(LOCAL_GL_INVALID_FRAMEBUFFER_OPERATION);
|
||||
}
|
||||
|
||||
nsresult
|
||||
void
|
||||
WebGLContext::ErrorOutOfMemory(const char *fmt, ...)
|
||||
{
|
||||
va_list va;
|
||||
|
|
|
@ -55,9 +55,6 @@
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
typedef PRUint8 uint8_t;
|
||||
typedef PRUint16 uint16_t;
|
||||
|
||||
namespace WebGLTexelConversions {
|
||||
|
||||
/****** BEGIN CODE SHARED WITH WEBKIT ******/
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "nsEventListenerManager.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsWrapperCache.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
|
||||
class nsDOMEventListenerWrapper : public nsIDOMEventListener
|
||||
{
|
||||
|
@ -80,7 +81,7 @@ public:
|
|||
void AddEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener* aCallback, // XXX nullable
|
||||
bool aCapture, Nullable<bool>& aWantsUntrusted,
|
||||
nsresult& aRv)
|
||||
mozilla::ErrorResult& aRv)
|
||||
{
|
||||
aRv = AddEventListener(aType, aCallback, aCapture,
|
||||
!aWantsUntrusted.IsNull() && aWantsUntrusted.Value(),
|
||||
|
@ -88,11 +89,11 @@ public:
|
|||
}
|
||||
void RemoveEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener* aCallback,
|
||||
bool aCapture, nsresult& aRv)
|
||||
bool aCapture, mozilla::ErrorResult& aRv)
|
||||
{
|
||||
aRv = RemoveEventListener(aType, aCallback, aCapture);
|
||||
}
|
||||
bool DispatchEvent(nsIDOMEvent* aEvent, nsresult& aRv)
|
||||
bool DispatchEvent(nsIDOMEvent* aEvent, mozilla::ErrorResult& aRv)
|
||||
{
|
||||
bool result = false;
|
||||
aRv = DispatchEvent(aEvent, &result);
|
||||
|
|
|
@ -134,8 +134,7 @@ nsEventListenerInfo::ToSource(nsAString& aResult)
|
|||
nsCOMPtr<nsIThreadJSContextStack> stack =
|
||||
nsContentUtils::ThreadJSContextStack();
|
||||
if (stack) {
|
||||
JSContext* cx = nsnull;
|
||||
stack->GetSafeJSContext(&cx);
|
||||
JSContext* cx = stack->GetSafeJSContext();
|
||||
if (cx && NS_SUCCEEDED(stack->Push(cx))) {
|
||||
{
|
||||
// Extra block to finish the auto request before calling pop
|
||||
|
@ -177,8 +176,7 @@ nsEventListenerInfo::GetDebugObject(nsISupports** aRetVal)
|
|||
nsCOMPtr<nsIThreadJSContextStack> stack =
|
||||
nsContentUtils::ThreadJSContextStack();
|
||||
if (stack) {
|
||||
JSContext* cx = nsnull;
|
||||
stack->GetSafeJSContext(&cx);
|
||||
JSContext* cx = stack->GetSafeJSContext();
|
||||
if (cx && NS_SUCCEEDED(stack->Push(cx))) {
|
||||
{
|
||||
// Extra block to finish the auto request before calling pop
|
||||
|
|
|
@ -134,10 +134,6 @@ nsHTMLFontElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
}
|
||||
return false;
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::pointSize ||
|
||||
aAttribute == nsGkAtoms::fontWeight) {
|
||||
return aResult.ParseIntValue(aValue);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::color) {
|
||||
return aResult.ParseColor(aValue);
|
||||
}
|
||||
|
@ -162,28 +158,14 @@ MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||
}
|
||||
}
|
||||
|
||||
// pointSize: int
|
||||
// size: int
|
||||
nsCSSValue* fontSize = aData->ValueForFontSize();
|
||||
if (fontSize->GetUnit() == eCSSUnit_Null) {
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::pointSize);
|
||||
if (value && value->Type() == nsAttrValue::eInteger)
|
||||
fontSize->SetFloatValue((float)value->GetIntegerValue(), eCSSUnit_Point);
|
||||
else {
|
||||
// size: int
|
||||
value = aAttributes->GetAttr(nsGkAtoms::size);
|
||||
if (value && value->Type() == nsAttrValue::eInteger) {
|
||||
fontSize->SetIntValue(value->GetIntegerValue(), eCSSUnit_Enumerated);
|
||||
}
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::size);
|
||||
if (value && value->Type() == nsAttrValue::eInteger) {
|
||||
fontSize->SetIntValue(value->GetIntegerValue(), eCSSUnit_Enumerated);
|
||||
}
|
||||
}
|
||||
|
||||
// fontWeight: int
|
||||
nsCSSValue* fontWeight = aData->ValueForFontWeight();
|
||||
if (fontWeight->GetUnit() == eCSSUnit_Null) {
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::fontWeight);
|
||||
if (value && value->Type() == nsAttrValue::eInteger) // +/-
|
||||
fontWeight->SetIntValue(value->GetIntegerValue(), eCSSUnit_Integer);
|
||||
}
|
||||
}
|
||||
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Color)) {
|
||||
nsCSSValue* colorValue = aData->ValueForColor();
|
||||
|
@ -222,9 +204,7 @@ nsHTMLFontElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
|||
{
|
||||
static const MappedAttributeEntry attributes[] = {
|
||||
{ &nsGkAtoms::face },
|
||||
{ &nsGkAtoms::pointSize },
|
||||
{ &nsGkAtoms::size },
|
||||
{ &nsGkAtoms::fontWeight },
|
||||
{ &nsGkAtoms::color },
|
||||
{ nsnull }
|
||||
};
|
||||
|
|
|
@ -879,7 +879,7 @@ bool nsOpusState::DecodeHeader(ogg_packet* aPacket)
|
|||
/* Return the timestamp (in microseconds) equivalent to a granulepos. */
|
||||
PRInt64 nsOpusState::Time(PRInt64 granulepos)
|
||||
{
|
||||
if (granulepos < 0)
|
||||
if (!mActive || granulepos < 0)
|
||||
return -1;
|
||||
|
||||
// Ogg Opus always runs at a granule rate of 48 kHz.
|
||||
|
|
|
@ -83,7 +83,10 @@ public:
|
|||
|
||||
// nsIScriptGlobalObject methods
|
||||
virtual nsresult EnsureScriptEnvironment();
|
||||
virtual nsresult SetScriptContext(nsIScriptContext *aContext);
|
||||
void ClearScriptContext()
|
||||
{
|
||||
mScriptContext = NULL;
|
||||
}
|
||||
|
||||
virtual nsIScriptContext *GetContext();
|
||||
virtual JSObject *GetGlobalJSObject();
|
||||
|
@ -106,7 +109,6 @@ public:
|
|||
protected:
|
||||
virtual ~nsXBLDocGlobalObject();
|
||||
|
||||
void SetContext(nsIScriptContext *aContext);
|
||||
nsIScriptContext *GetScriptContext();
|
||||
|
||||
nsCOMPtr<nsIScriptContext> mScriptContext;
|
||||
|
@ -264,33 +266,6 @@ XBL_ProtoErrorReporter(JSContext *cx,
|
|||
// nsIScriptGlobalObject methods
|
||||
//
|
||||
|
||||
void
|
||||
nsXBLDocGlobalObject::SetContext(nsIScriptContext *aScriptContext)
|
||||
{
|
||||
if (!aScriptContext) {
|
||||
mScriptContext = nsnull;
|
||||
return;
|
||||
}
|
||||
aScriptContext->WillInitializeContext();
|
||||
// NOTE: We init this context with a NULL global, so we automatically
|
||||
// hook up to the existing nsIScriptGlobalObject global setup by
|
||||
// nsGlobalWindow.
|
||||
DebugOnly<nsresult> rv;
|
||||
rv = aScriptContext->InitContext();
|
||||
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Script Language's InitContext failed");
|
||||
aScriptContext->SetGCOnDestruction(false);
|
||||
aScriptContext->DidInitializeContext();
|
||||
// and we set up our global manually
|
||||
mScriptContext = aScriptContext;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXBLDocGlobalObject::SetScriptContext(nsIScriptContext *aContext)
|
||||
{
|
||||
SetContext(aContext);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIScriptContext *
|
||||
nsXBLDocGlobalObject::GetScriptContext()
|
||||
{
|
||||
|
@ -300,18 +275,28 @@ nsXBLDocGlobalObject::GetScriptContext()
|
|||
nsresult
|
||||
nsXBLDocGlobalObject::EnsureScriptEnvironment()
|
||||
{
|
||||
if (mScriptContext)
|
||||
return NS_OK; // already initialized for this lang
|
||||
nsCOMPtr<nsIDOMScriptObjectFactory> factory = do_GetService(kDOMScriptObjectFactoryCID);
|
||||
NS_ENSURE_TRUE(factory, NS_OK);
|
||||
|
||||
nsresult rv;
|
||||
if (mScriptContext) {
|
||||
// Already initialized.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIScriptRuntime> scriptRuntime;
|
||||
rv = NS_GetJSRuntime(getter_AddRefs(scriptRuntime));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_GetJSRuntime(getter_AddRefs(scriptRuntime));
|
||||
NS_ENSURE_TRUE(scriptRuntime, NS_OK);
|
||||
|
||||
nsCOMPtr<nsIScriptContext> newCtx = scriptRuntime->CreateContext();
|
||||
rv = SetScriptContext(newCtx);
|
||||
MOZ_ASSERT(newCtx);
|
||||
|
||||
newCtx->WillInitializeContext();
|
||||
// NOTE: We init this context with a NULL global, so we automatically
|
||||
// hook up to the existing nsIScriptGlobalObject global setup by
|
||||
// nsGlobalWindow.
|
||||
nsresult rv = newCtx->InitContext();
|
||||
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Script Language's InitContext failed");
|
||||
newCtx->SetGCOnDestruction(false);
|
||||
newCtx->DidInitializeContext();
|
||||
|
||||
mScriptContext = newCtx;
|
||||
|
||||
JSContext *cx = mScriptContext->GetNativeContext();
|
||||
JSAutoRequest ar(cx);
|
||||
|
@ -557,7 +542,7 @@ nsXBLDocumentInfo::~nsXBLDocumentInfo()
|
|||
/* destructor code */
|
||||
if (mGlobalObject) {
|
||||
// remove circular reference
|
||||
mGlobalObject->SetScriptContext(nsnull);
|
||||
mGlobalObject->ClearScriptContext();
|
||||
mGlobalObject->ClearGlobalObjectOwner(); // just in case
|
||||
}
|
||||
if (mBindingTable) {
|
||||
|
|
|
@ -110,8 +110,8 @@ public:
|
|||
|
||||
virtual nsresult InstallMember(nsIScriptContext* aContext,
|
||||
nsIContent* aBoundElement,
|
||||
void* aScriptObject,
|
||||
void* aTargetClassObject,
|
||||
JSObject* aScriptObject, // Unused
|
||||
JSObject* aTargetClassObject,
|
||||
const nsCString& aClassStr) = 0;
|
||||
virtual nsresult CompileMember(nsIScriptContext* aContext,
|
||||
const nsCString& aClassStr,
|
||||
|
|
|
@ -122,31 +122,28 @@ nsXBLProtoImplMethod::SetLineNumber(PRUint32 aLineNumber)
|
|||
nsresult
|
||||
nsXBLProtoImplMethod::InstallMember(nsIScriptContext* aContext,
|
||||
nsIContent* aBoundElement,
|
||||
void* aScriptObject,
|
||||
void* aTargetClassObject,
|
||||
JSObject* aScriptObject,
|
||||
JSObject* aTargetClassObject,
|
||||
const nsCString& aClassStr)
|
||||
{
|
||||
NS_PRECONDITION(IsCompiled(),
|
||||
"Should not be installing an uncompiled method");
|
||||
JSContext* cx = aContext->GetNativeContext();
|
||||
|
||||
nsIDocument *ownerDoc = aBoundElement->OwnerDoc();
|
||||
nsIScriptGlobalObject *sgo;
|
||||
nsIScriptGlobalObject* sgo = aBoundElement->OwnerDoc()->GetScopeObject();
|
||||
|
||||
if (!(sgo = ownerDoc->GetScopeObject())) {
|
||||
if (!sgo) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
JSObject * scriptObject = (JSObject *) aScriptObject;
|
||||
NS_ASSERTION(scriptObject, "uh-oh, script Object should NOT be null or bad things will happen");
|
||||
if (!scriptObject)
|
||||
NS_ASSERTION(aScriptObject, "uh-oh, script Object should NOT be null or bad things will happen");
|
||||
if (!aScriptObject)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
JSObject * targetClassObject = (JSObject *) aTargetClassObject;
|
||||
JSObject * globalObject = sgo->GetGlobalJSObject();
|
||||
JSObject* globalObject = sgo->GetGlobalJSObject();
|
||||
|
||||
// now we want to reevaluate our property using aContext and the script object for this window...
|
||||
if (mJSMethodObject && targetClassObject) {
|
||||
if (mJSMethodObject && aTargetClassObject) {
|
||||
nsDependentString name(mName);
|
||||
JSAutoRequest ar(cx);
|
||||
JSAutoEnterCompartment ac;
|
||||
|
@ -160,8 +157,8 @@ nsXBLProtoImplMethod::InstallMember(nsIScriptContext* aContext,
|
|||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
if (!::JS_DefineUCProperty(cx, targetClassObject,
|
||||
reinterpret_cast<const jschar*>(mName),
|
||||
if (!::JS_DefineUCProperty(cx, aTargetClassObject,
|
||||
static_cast<const jschar*>(mName),
|
||||
name.Length(), OBJECT_TO_JSVAL(method),
|
||||
NULL, NULL, JSPROP_ENUMERATE)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
|
|
@ -122,8 +122,8 @@ public:
|
|||
|
||||
virtual nsresult InstallMember(nsIScriptContext* aContext,
|
||||
nsIContent* aBoundElement,
|
||||
void* aScriptObject,
|
||||
void* aTargetClassObject,
|
||||
JSObject* aScriptObject,
|
||||
JSObject* aTargetClassObject,
|
||||
const nsCString& aClassStr);
|
||||
virtual nsresult CompileMember(nsIScriptContext* aContext,
|
||||
const nsCString& aClassStr,
|
||||
|
@ -174,8 +174,8 @@ public:
|
|||
// prototype implementation).
|
||||
virtual nsresult InstallMember(nsIScriptContext* aContext,
|
||||
nsIContent* aBoundElement,
|
||||
void* aScriptObject,
|
||||
void* aTargetClassObject,
|
||||
JSObject* aScriptObject,
|
||||
JSObject* aTargetClassObject,
|
||||
const nsCString& aClassStr) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -166,31 +166,28 @@ const char* gPropertyArgs[] = { "val" };
|
|||
nsresult
|
||||
nsXBLProtoImplProperty::InstallMember(nsIScriptContext* aContext,
|
||||
nsIContent* aBoundElement,
|
||||
void* aScriptObject,
|
||||
void* aTargetClassObject,
|
||||
JSObject* aScriptObject,
|
||||
JSObject* aTargetClassObject,
|
||||
const nsCString& aClassStr)
|
||||
{
|
||||
NS_PRECONDITION(mIsCompiled,
|
||||
"Should not be installing an uncompiled property");
|
||||
JSContext* cx = aContext->GetNativeContext();
|
||||
|
||||
nsIDocument *ownerDoc = aBoundElement->OwnerDoc();
|
||||
nsIScriptGlobalObject *sgo;
|
||||
nsIScriptGlobalObject* sgo = aBoundElement->OwnerDoc()->GetScopeObject();
|
||||
|
||||
if (!(sgo = ownerDoc->GetScopeObject())) {
|
||||
if (!sgo) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
JSObject * scriptObject = (JSObject *) aScriptObject;
|
||||
NS_ASSERTION(scriptObject, "uh-oh, script Object should NOT be null or bad things will happen");
|
||||
if (!scriptObject)
|
||||
NS_ASSERTION(aScriptObject, "uh-oh, script Object should NOT be null or bad things will happen");
|
||||
if (!aScriptObject)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
JSObject * targetClassObject = (JSObject *) aTargetClassObject;
|
||||
JSObject * globalObject = sgo->GetGlobalJSObject();
|
||||
|
||||
// now we want to reevaluate our property using aContext and the script object for this window...
|
||||
if ((mJSGetterObject || mJSSetterObject) && targetClassObject) {
|
||||
if ((mJSGetterObject || mJSSetterObject) && aTargetClassObject) {
|
||||
JSObject * getter = nsnull;
|
||||
JSAutoRequest ar(cx);
|
||||
JSAutoEnterCompartment ac;
|
||||
|
@ -208,8 +205,8 @@ nsXBLProtoImplProperty::InstallMember(nsIScriptContext* aContext,
|
|||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsDependentString name(mName);
|
||||
if (!::JS_DefineUCProperty(cx, targetClassObject,
|
||||
reinterpret_cast<const jschar*>(mName),
|
||||
if (!::JS_DefineUCProperty(cx, aTargetClassObject,
|
||||
static_cast<const jschar*>(mName),
|
||||
name.Length(), JSVAL_VOID,
|
||||
JS_DATA_TO_FUNC_PTR(JSPropertyOp, getter),
|
||||
JS_DATA_TO_FUNC_PTR(JSStrictPropertyOp, setter),
|
||||
|
|
|
@ -67,8 +67,8 @@ public:
|
|||
|
||||
virtual nsresult InstallMember(nsIScriptContext* aContext,
|
||||
nsIContent* aBoundElement,
|
||||
void* aScriptObject,
|
||||
void* aTargetClassObject,
|
||||
JSObject* aScriptObject,
|
||||
JSObject* aTargetClassObject,
|
||||
const nsCString& aClassStr);
|
||||
virtual nsresult CompileMember(nsIScriptContext* aContext,
|
||||
const nsCString& aClassStr,
|
||||
|
|
|
@ -1,444 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is TransforMiiX XSLT processor code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The MITRE Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1999
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// Tom Kneeland (3/29/99)
|
||||
//
|
||||
// Implementation of the Document Object Model Level 1 Core
|
||||
//
|
||||
// Modification History:
|
||||
// Who When What
|
||||
// TK 03/29/99 Created
|
||||
// LF 08/06/1999 Changed static const short NodeType to enum
|
||||
// Added "friend NamedNodeMap"; to NodeListDefinition
|
||||
//
|
||||
|
||||
#ifndef MITRE_DOM
|
||||
#define MITRE_DOM
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include "txList.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsBaseHashtable.h"
|
||||
#include "nsString.h"
|
||||
#include "txCore.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
#define kTxNsNodeIndexOffset 0x00000000;
|
||||
#define kTxAttrIndexOffset 0x40000000;
|
||||
#define kTxChildIndexOffset 0x80000000;
|
||||
|
||||
class NamedNodeMap;
|
||||
class Document;
|
||||
class Element;
|
||||
class Attr;
|
||||
class ProcessingInstruction;
|
||||
|
||||
#define kNameSpaceID_Unknown -1
|
||||
#define kNameSpaceID_None 0
|
||||
// not really a namespace, but it needs to play the game
|
||||
#define kNameSpaceID_XMLNS 1
|
||||
#define kNameSpaceID_XML 2
|
||||
// kNameSpaceID_XSLT is 6 for module, see nsINameSpaceManager.h
|
||||
#define kNameSpaceID_XSLT 3
|
||||
|
||||
//
|
||||
// Abstract Class defining the interface for a Node. See NodeDefinition below
|
||||
// for the actual implementation of the WC3 node.
|
||||
//
|
||||
class Node : public txObject
|
||||
{
|
||||
public:
|
||||
//Node type constants
|
||||
//-- LF - changed to enum
|
||||
enum NodeType {
|
||||
ELEMENT_NODE = 1,
|
||||
ATTRIBUTE_NODE,
|
||||
TEXT_NODE,
|
||||
CDATA_SECTION_NODE,
|
||||
ENTITY_REFERENCE_NODE,
|
||||
ENTITY_NODE,
|
||||
PROCESSING_INSTRUCTION_NODE,
|
||||
COMMENT_NODE,
|
||||
DOCUMENT_NODE,
|
||||
DOCUMENT_TYPE_NODE,
|
||||
DOCUMENT_FRAGMENT_NODE,
|
||||
NOTATION_NODE
|
||||
};
|
||||
|
||||
//Read functions
|
||||
virtual nsresult getNodeName(nsAString& aName) const = 0;
|
||||
virtual nsresult getNodeValue(nsAString& aValue) = 0;
|
||||
virtual unsigned short getNodeType() const = 0;
|
||||
virtual Node* getParentNode() const = 0;
|
||||
virtual Node* getFirstChild() const = 0;
|
||||
virtual Node* getLastChild() const = 0;
|
||||
virtual Node* getPreviousSibling() const = 0;
|
||||
virtual Node* getNextSibling() const = 0;
|
||||
virtual Document* getOwnerDocument() const = 0;
|
||||
|
||||
//Node manipulation functions
|
||||
virtual Node* appendChild(Node* newChild) = 0;
|
||||
|
||||
virtual bool hasChildNodes() const = 0;
|
||||
|
||||
//From DOM3 26-Jan-2001 WD
|
||||
virtual nsresult getBaseURI(nsAString& aURI) = 0;
|
||||
|
||||
//Introduced in DOM2
|
||||
virtual nsresult getNamespaceURI(nsAString& aNSURI) = 0;
|
||||
|
||||
//txXPathNode functions
|
||||
virtual bool getLocalName(nsIAtom** aLocalName) = 0;
|
||||
virtual PRInt32 getNamespaceID() = 0;
|
||||
virtual Node* getXPathParent() = 0;
|
||||
virtual PRInt32 compareDocumentPosition(Node* aOther) = 0;
|
||||
};
|
||||
|
||||
//
|
||||
// Definition and Implementation of Node and NodeList functionality. This is
|
||||
// the central class, from which all other DOM classes (objects) are derrived.
|
||||
// Users of this DOM should work strictly with the Node interface and NodeList
|
||||
// interface (see above for those definitions)
|
||||
//
|
||||
class NodeDefinition : public Node
|
||||
{
|
||||
public:
|
||||
virtual ~NodeDefinition(); //Destructor, delete all children of node
|
||||
|
||||
//Read functions
|
||||
virtual nsresult getNodeName(nsAString& aName) const;
|
||||
nsresult getNodeValue(nsAString& aValue);
|
||||
unsigned short getNodeType() const;
|
||||
Node* getParentNode() const;
|
||||
Node* getFirstChild() const;
|
||||
Node* getLastChild() const;
|
||||
Node* getPreviousSibling() const;
|
||||
Node* getNextSibling() const;
|
||||
Document* getOwnerDocument() const;
|
||||
|
||||
//Child node manipulation functions
|
||||
virtual Node* appendChild(Node* newChild);
|
||||
|
||||
bool hasChildNodes() const;
|
||||
|
||||
//From DOM3 26-Jan-2001 WD
|
||||
virtual nsresult getBaseURI(nsAString& aURI);
|
||||
|
||||
//Introduced in DOM2
|
||||
nsresult getNamespaceURI(nsAString& aNSURI);
|
||||
|
||||
//txXPathNode functions
|
||||
virtual bool getLocalName(nsIAtom** aLocalName);
|
||||
virtual PRInt32 getNamespaceID();
|
||||
virtual Node* getXPathParent();
|
||||
virtual PRInt32 compareDocumentPosition(Node* aOther);
|
||||
|
||||
//Only to be used from XMLParser
|
||||
void appendData(const PRUnichar* aData, int aLength)
|
||||
{
|
||||
nodeValue.Append(aData, aLength);
|
||||
};
|
||||
|
||||
protected:
|
||||
friend class Document;
|
||||
friend class txXPathTreeWalker;
|
||||
friend class txXPathNodeUtils;
|
||||
NodeDefinition(NodeType type, nsIAtom *aLocalName,
|
||||
const nsAString& value, Document* owner);
|
||||
|
||||
//Name, value, and attributes for this node. Available to derrived
|
||||
//classes, since those derrived classes have a better idea how to use them,
|
||||
//than the generic node does.
|
||||
nsCOMPtr<nsIAtom> mLocalName;
|
||||
nsString nodeValue;
|
||||
|
||||
NodeDefinition* implAppendChild(NodeDefinition* newChild);
|
||||
NodeDefinition* implRemoveChild(NodeDefinition* oldChild);
|
||||
|
||||
private:
|
||||
//Type of node this is
|
||||
NodeType nodeType;
|
||||
|
||||
//Data members for linking this Node to its parent and siblings
|
||||
NodeDefinition* parentNode;
|
||||
NodeDefinition* previousSibling;
|
||||
NodeDefinition* nextSibling;
|
||||
|
||||
//Pointer to the node's document
|
||||
Document* ownerDocument;
|
||||
|
||||
PRUint32 length;
|
||||
|
||||
//Data members for maintaining a list of child nodes
|
||||
NodeDefinition* firstChild;
|
||||
NodeDefinition* lastChild;
|
||||
|
||||
// Struct to hold document order information
|
||||
struct OrderInfo {
|
||||
~OrderInfo();
|
||||
PRUint32* mOrder;
|
||||
PRInt32 mSize;
|
||||
Node* mRoot;
|
||||
};
|
||||
|
||||
// OrderInfo object for comparing document order
|
||||
OrderInfo* mOrderInfo;
|
||||
|
||||
// Helperfunction for compareDocumentOrder
|
||||
OrderInfo* getOrderInfo();
|
||||
};
|
||||
|
||||
//
|
||||
//Definition and Implementation of a Document.
|
||||
//
|
||||
|
||||
typedef nsTHashtable<nsBaseHashtableET<nsStringHashKey, Element*> > txIDMap;
|
||||
|
||||
class Document : public NodeDefinition
|
||||
{
|
||||
public:
|
||||
Document();
|
||||
|
||||
Element* getDocumentElement();
|
||||
|
||||
//Factory functions for various node types
|
||||
Node* createComment(const nsAString& aData);
|
||||
ProcessingInstruction* createProcessingInstruction(nsIAtom *aTarget,
|
||||
const nsAString& aData);
|
||||
Node* createTextNode(const nsAString& theData);
|
||||
|
||||
Element* createElementNS(nsIAtom *aPrefix, nsIAtom *aLocalName,
|
||||
PRInt32 aNamespaceID);
|
||||
Element* getElementById(const nsAString& aID);
|
||||
|
||||
// Node manipulation functions
|
||||
Node* appendChild(Node* newChild);
|
||||
|
||||
//Override to return documentBaseURI
|
||||
nsresult getBaseURI(nsAString& aURI);
|
||||
|
||||
private:
|
||||
bool setElementID(const nsAString& aID, Element* aElement);
|
||||
|
||||
Element* documentElement;
|
||||
|
||||
// This class is friend to be able to set the documentBaseURI
|
||||
// and IDs.
|
||||
friend class txXMLParser;
|
||||
txIDMap mIDMap;
|
||||
nsString documentBaseURI;
|
||||
};
|
||||
|
||||
//
|
||||
//Definition and Implementation of an Element
|
||||
//
|
||||
class Element : public NodeDefinition
|
||||
{
|
||||
public:
|
||||
NamedNodeMap* getAttributes();
|
||||
|
||||
nsresult appendAttributeNS(nsIAtom *aPrefix, nsIAtom *aLocalName,
|
||||
PRInt32 aNamespaceID, const nsAString& aValue);
|
||||
|
||||
// Node manipulation functions
|
||||
Node* appendChild(Node* newChild);
|
||||
|
||||
//txXPathNode functions override
|
||||
nsresult getNodeName(nsAString& aName) const;
|
||||
bool getLocalName(nsIAtom** aLocalName);
|
||||
PRInt32 getNamespaceID();
|
||||
bool getAttr(nsIAtom* aLocalName, PRInt32 aNSID, nsAString& aValue);
|
||||
bool hasAttr(nsIAtom* aLocalName, PRInt32 aNSID);
|
||||
|
||||
// ID getter
|
||||
bool getIDValue(nsAString& aValue);
|
||||
|
||||
Attr *getFirstAttribute()
|
||||
{
|
||||
return mFirstAttribute;
|
||||
}
|
||||
|
||||
private:
|
||||
friend class Document;
|
||||
void setIDValue(const nsAString& aValue);
|
||||
|
||||
Element(nsIAtom *aPrefix, nsIAtom *aLocalName, PRInt32 aNamespaceID,
|
||||
Document* aOwner);
|
||||
|
||||
nsAutoPtr<Attr> mFirstAttribute;
|
||||
nsString mIDValue;
|
||||
nsCOMPtr<nsIAtom> mPrefix;
|
||||
PRInt32 mNamespaceID;
|
||||
};
|
||||
|
||||
//
|
||||
//Definition and Implementation of a Attr
|
||||
// NOTE: For the time bing use just the default functionality found in the
|
||||
// NodeDefinition class
|
||||
//
|
||||
class Attr : public NodeDefinition
|
||||
{
|
||||
public:
|
||||
Node* appendChild(Node* newChild);
|
||||
|
||||
//txXPathNode functions override
|
||||
nsresult getNodeName(nsAString& aName) const;
|
||||
bool getLocalName(nsIAtom** aLocalName);
|
||||
PRInt32 getNamespaceID();
|
||||
Node* getXPathParent();
|
||||
bool equals(nsIAtom *aLocalName, PRInt32 aNamespaceID)
|
||||
{
|
||||
return mLocalName == aLocalName && aNamespaceID == mNamespaceID;
|
||||
}
|
||||
Attr *getNextAttribute()
|
||||
{
|
||||
return mNextAttribute;
|
||||
}
|
||||
|
||||
private:
|
||||
friend class Element;
|
||||
|
||||
Attr(nsIAtom *aPrefix, nsIAtom *aLocalName, PRInt32 aNamespaceID,
|
||||
Element *aOwnerElement, const nsAString &aValue);
|
||||
|
||||
nsCOMPtr<nsIAtom> mPrefix;
|
||||
PRInt32 mNamespaceID;
|
||||
Element *mOwnerElement;
|
||||
nsAutoPtr<Attr> mNextAttribute;
|
||||
};
|
||||
|
||||
//
|
||||
//Definition and Implemention of a ProcessingInstruction node. Most
|
||||
//functionality is inherrited from NodeDefinition.
|
||||
// The Target of a processing instruction is stored in the nodeName datamember
|
||||
// inherrited from NodeDefinition.
|
||||
// The Data of a processing instruction is stored in the nodeValue datamember
|
||||
// inherrited from NodeDefinition
|
||||
//
|
||||
class ProcessingInstruction : public NodeDefinition
|
||||
{
|
||||
public:
|
||||
//txXPathNode functions override
|
||||
bool getLocalName(nsIAtom** aLocalName);
|
||||
|
||||
private:
|
||||
friend class Document;
|
||||
ProcessingInstruction(nsIAtom *theTarget, const nsAString& theData,
|
||||
Document* owner);
|
||||
};
|
||||
|
||||
class txStandaloneNamespaceManager
|
||||
{
|
||||
public:
|
||||
static PRInt32 getNamespaceID(const nsAString& aURI)
|
||||
{
|
||||
if (!mNamespaces && !init())
|
||||
return kNameSpaceID_Unknown;
|
||||
|
||||
PRInt32 id = mNamespaces->IndexOf(aURI);
|
||||
if (id != -1) {
|
||||
return id + 1;
|
||||
}
|
||||
|
||||
if (!mNamespaces->AppendString(aURI)) {
|
||||
NS_ERROR("Out of memory, namespaces are getting lost");
|
||||
return kNameSpaceID_Unknown;
|
||||
}
|
||||
|
||||
return mNamespaces->Count();
|
||||
}
|
||||
|
||||
static nsresult getNamespaceURI(const PRInt32 aID, nsAString& aNSURI)
|
||||
{
|
||||
// empty namespace, and errors
|
||||
aNSURI.Truncate();
|
||||
if (aID <= 0 || (!mNamespaces && !init()) ||
|
||||
aID > mNamespaces->Count()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
aNSURI = *mNamespaces->StringAt(aID - 1);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static bool init()
|
||||
{
|
||||
NS_ASSERTION(!mNamespaces,
|
||||
"called without matching shutdown()");
|
||||
if (mNamespaces)
|
||||
return true;
|
||||
mNamespaces = new nsStringArray();
|
||||
if (!mNamespaces)
|
||||
return false;
|
||||
/*
|
||||
* Hardwiring some Namespace IDs.
|
||||
* no Namespace is 0
|
||||
* xmlns prefix is 1, mapped to http://www.w3.org/2000/xmlns/
|
||||
* xml prefix is 2, mapped to http://www.w3.org/XML/1998/namespace
|
||||
*/
|
||||
if (!mNamespaces->AppendString(NS_LITERAL_STRING("http://www.w3.org/2000/xmlns/")) ||
|
||||
!mNamespaces->AppendString(NS_LITERAL_STRING("http://www.w3.org/XML/1998/namespace")) ||
|
||||
!mNamespaces->AppendString(NS_LITERAL_STRING("http://www.w3.org/1999/XSL/Transform"))) {
|
||||
delete mNamespaces;
|
||||
mNamespaces = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void shutdown()
|
||||
{
|
||||
NS_ASSERTION(mNamespaces, "called without matching init()");
|
||||
if (!mNamespaces)
|
||||
return;
|
||||
delete mNamespaces;
|
||||
mNamespaces = nsnull;
|
||||
}
|
||||
|
||||
private:
|
||||
static nsStringArray* mNamespaces;
|
||||
};
|
||||
|
||||
#define TX_IMPL_DOM_STATICS \
|
||||
nsStringArray* txStandaloneNamespaceManager::mNamespaces = 0
|
||||
|
||||
#endif
|
|
@ -1951,7 +1951,7 @@ nsXULDocument::RemoveElementFromRefMap(Element* aElement)
|
|||
//
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULDocument::CloneNode(bool aDeep, nsIDOMNode** aReturn)
|
||||
nsXULDocument::CloneNode(bool aDeep, PRUint8 aOptionalArgc, nsIDOMNode** aReturn)
|
||||
{
|
||||
// We don't allow cloning of a document
|
||||
*aReturn = nsnull;
|
||||
|
|
|
@ -58,6 +58,8 @@
|
|||
#include "nsIStreamListener.h"
|
||||
#include "nsICSSLoaderObserver.h"
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
class nsIRDFResource;
|
||||
class nsIRDFService;
|
||||
class nsPIWindowRoot;
|
||||
|
@ -165,7 +167,8 @@ public:
|
|||
bool OnDocumentParserError();
|
||||
|
||||
// nsIDOMNode interface overrides
|
||||
NS_IMETHOD CloneNode(bool deep, nsIDOMNode **_retval);
|
||||
NS_IMETHOD CloneNode(bool deep, PRUint8 aOptionalArgc, nsIDOMNode **_retval)
|
||||
MOZ_OVERRIDE;
|
||||
|
||||
// nsIDOMDocument
|
||||
NS_IMETHOD GetContentType(nsAString& aContentType);
|
||||
|
|
|
@ -91,7 +91,6 @@ public:
|
|||
virtual nsresult EnsureScriptEnvironment();
|
||||
|
||||
virtual nsIScriptContext *GetScriptContext();
|
||||
virtual nsresult SetScriptContext(nsIScriptContext *ctx);
|
||||
|
||||
// nsIScriptObjectPrincipal methods
|
||||
virtual nsIPrincipal* GetPrincipal();
|
||||
|
@ -686,34 +685,6 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsXULPDGlobalObject)
|
|||
// nsIScriptGlobalObject methods
|
||||
//
|
||||
|
||||
nsresult
|
||||
nsXULPDGlobalObject::SetScriptContext(nsIScriptContext *aScriptContext)
|
||||
{
|
||||
// almost a clone of nsGlobalWindow
|
||||
if (!aScriptContext) {
|
||||
NS_WARNING("Possibly early removal of script object, see bug #41608");
|
||||
} else {
|
||||
// should probably assert the context is clean???
|
||||
aScriptContext->WillInitializeContext();
|
||||
nsresult rv = aScriptContext->InitContext();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
NS_ASSERTION(!aScriptContext || !mContext, "Bad call to SetContext()!");
|
||||
|
||||
JSObject* global = NULL;
|
||||
|
||||
if (aScriptContext) {
|
||||
aScriptContext->SetGCOnDestruction(false);
|
||||
aScriptContext->DidInitializeContext();
|
||||
global = aScriptContext->GetNativeGlobal();
|
||||
NS_ASSERTION(global, "GetNativeGlobal returned NULL!");
|
||||
}
|
||||
mContext = aScriptContext;
|
||||
mJSObject = global;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULPDGlobalObject::EnsureScriptEnvironment()
|
||||
{
|
||||
|
@ -727,8 +698,10 @@ nsXULPDGlobalObject::EnsureScriptEnvironment()
|
|||
NS_ENSURE_SUCCESS(rv, NS_OK);
|
||||
|
||||
nsCOMPtr<nsIScriptContext> ctxNew = languageRuntime->CreateContext();
|
||||
MOZ_ASSERT(ctxNew);
|
||||
|
||||
// We have to setup a special global object. We do this then
|
||||
// attach it as the global for this context. Then, ::SetScriptContext
|
||||
// attach it as the global for this context. Then, we
|
||||
// will re-fetch the global and set it up in our language globals array.
|
||||
{
|
||||
JSContext *cx = ctxNew->GetNativeContext();
|
||||
|
@ -750,9 +723,20 @@ nsXULPDGlobalObject::EnsureScriptEnvironment()
|
|||
NS_ADDREF(this);
|
||||
}
|
||||
|
||||
// should probably assert the context is clean???
|
||||
ctxNew->WillInitializeContext();
|
||||
rv = ctxNew->InitContext();
|
||||
NS_ENSURE_SUCCESS(rv, NS_OK);
|
||||
rv = SetScriptContext(ctxNew);
|
||||
NS_ENSURE_SUCCESS(rv, NS_OK);
|
||||
|
||||
ctxNew->SetGCOnDestruction(false);
|
||||
ctxNew->DidInitializeContext();
|
||||
|
||||
JSObject* global = ctxNew->GetNativeGlobal();
|
||||
NS_ASSERTION(global, "GetNativeGlobal returned NULL!");
|
||||
|
||||
mContext = ctxNew;
|
||||
mJSObject = global;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,10 +37,6 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* The nsIContentViewerEdit
|
||||
*/
|
||||
|
||||
/**
|
||||
* The nsIMarkupDocumentViewer
|
||||
* This interface describes the properties of a content viewer
|
||||
|
@ -51,8 +47,16 @@
|
|||
|
||||
interface nsIDOMNode;
|
||||
|
||||
%{C++
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsTArray.h"
|
||||
%}
|
||||
|
||||
[scriptable, uuid(79286cd6-8293-4def-ba26-76422efc3d2a)]
|
||||
interface nsIMarkupDocumentViewer;
|
||||
|
||||
[ref] native nsIMarkupDocumentViewerTArray(nsTArray<nsCOMPtr<nsIMarkupDocumentViewer> >);
|
||||
|
||||
[scriptable, uuid(1016d5e8-690f-4d97-8ac5-d50ffa341c46)]
|
||||
interface nsIMarkupDocumentViewer : nsISupports
|
||||
{
|
||||
|
||||
|
@ -147,7 +151,13 @@ interface nsIMarkupDocumentViewer : nsISupports
|
|||
*/
|
||||
attribute PRUint32 bidiOptions;
|
||||
|
||||
/** The minimum font size */
|
||||
attribute long minFontSize;
|
||||
/** The minimum font size */
|
||||
attribute long minFontSize;
|
||||
|
||||
/**
|
||||
* Append |this| and all of its descendants to the given array,
|
||||
* in depth-first pre-order traversal.
|
||||
*/
|
||||
[noscript] void appendSubtree(in nsIMarkupDocumentViewerTArray array);
|
||||
|
||||
};
|
||||
|
|
|
@ -108,7 +108,7 @@ endif
|
|||
|
||||
TEST_DIRS += \
|
||||
tests \
|
||||
imported-tests \
|
||||
imptests \
|
||||
$(NULL)
|
||||
|
||||
ifneq (,$(filter gtk2 cocoa windows android qt os2,$(MOZ_WIDGET_TOOLKIT)))
|
||||
|
|
|
@ -45,12 +45,10 @@ const STORAGE_MAX_EVENTS = 200;
|
|||
|
||||
XPCOMUtils.defineLazyGetter(this, "gPrivBrowsing", function () {
|
||||
// private browsing may not be available in some Gecko Apps
|
||||
try {
|
||||
return Cc["@mozilla.org/privatebrowsing;1"].getService(Ci.nsIPrivateBrowsingService);
|
||||
}
|
||||
catch (ex) {
|
||||
if (!(["@mozilla.org/privatebrowsing;1"] in Cc))
|
||||
return null;
|
||||
}
|
||||
|
||||
return Cc["@mozilla.org/privatebrowsing;1"].getService(Ci.nsIPrivateBrowsingService);
|
||||
});
|
||||
|
||||
var EXPORTED_SYMBOLS = ["ConsoleAPIStorage"];
|
||||
|
|
|
@ -40,12 +40,9 @@ WebappsRegistry.prototype = {
|
|||
return false;
|
||||
|
||||
if (aManifest.installs_allowed_from) {
|
||||
ok = false;
|
||||
aManifest.installs_allowed_from.forEach(function(aOrigin) {
|
||||
if (aOrigin == "*" || aOrigin == aInstallOrigin)
|
||||
ok = true;
|
||||
return aManifest.installs_allowed_from.some(function(aOrigin) {
|
||||
return aOrigin == "*" || aOrigin == aInstallOrigin;
|
||||
});
|
||||
return ok;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
@ -232,7 +229,7 @@ WebappsApplication.prototype = {
|
|||
launch: function(aStartPoint) {
|
||||
let request = this.createRequest();
|
||||
cpmm.sendAsyncMessage("Webapps:Launch", { origin: this._origin,
|
||||
startPoint: aStartPoint,
|
||||
startPoint: aStartPoint || "",
|
||||
oid: this._id,
|
||||
requestID: this.getRequestId(request) });
|
||||
return request;
|
||||
|
|
|
@ -477,9 +477,9 @@ DOMApplicationManifest.prototype = {
|
|||
return icon;
|
||||
},
|
||||
|
||||
fullLaunchPath: function() {
|
||||
let launchPath = this._localeProp("launch_path");
|
||||
return this._origin.resolve(launchPath ? launchPath : "");
|
||||
fullLaunchPath: function(aStartPoint) {
|
||||
let launchPath = this._localeProp("launch_path") || "";
|
||||
return this._origin.resolve(launchPath + aStartPoint);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<script>
|
||||
function foo(o) {
|
||||
o instanceof CSS2Properties;
|
||||
}
|
||||
foo({})
|
||||
</script>
|
|
@ -29,6 +29,7 @@ load 612018-1.html
|
|||
load 637116.html
|
||||
load 666869.html
|
||||
load 675621-1.html
|
||||
load 677194.html
|
||||
load 693894.html
|
||||
load 693811-1.html
|
||||
load 693811-2.html
|
||||
|
|
|
@ -1350,14 +1350,8 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||
// since a call to addProperty() is always followed by a call to
|
||||
// setProperty(), except in the case when a getter or setter is set
|
||||
// for a property. But we don't care about getters or setters here.
|
||||
NS_DEFINE_CLASSINFO_DATA(StorageObsolete, nsStorageSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_NEWRESOLVE |
|
||||
nsIXPCScriptable::WANT_GETPROPERTY |
|
||||
nsIXPCScriptable::WANT_SETPROPERTY |
|
||||
nsIXPCScriptable::WANT_DELPROPERTY |
|
||||
nsIXPCScriptable::DONT_ENUM_STATIC_PROPS |
|
||||
nsIXPCScriptable::WANT_NEWENUMERATE)
|
||||
NS_DEFINE_CLASSINFO_DATA(StorageObsolete, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(Storage, nsStorage2SH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
|
@ -1371,8 +1365,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(StorageEvent, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(StorageEventObsolete, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(DOMParser, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
@ -2444,10 +2436,8 @@ nsDOMClassInfo::Init()
|
|||
do_GetService("@mozilla.org/js/xpc/ContextStack;1", &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JSContext *cx = nsnull;
|
||||
|
||||
rv = stack->GetSafeJSContext(&cx);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
JSContext* cx = stack->GetSafeJSContext();
|
||||
NS_ENSURE_TRUE(cx, NS_ERROR_FAILURE);
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
|
||||
DOM_CLASSINFO_WINDOW_MAP_ENTRIES(nsGlobalWindow::HasIndexedDBSupport())
|
||||
|
@ -3959,10 +3949,6 @@ nsDOMClassInfo::Init()
|
|||
DOM_CLASSINFO_EVENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(StorageEventObsolete, nsIDOMStorageEventObsolete)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageEventObsolete)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(DOMParser, nsIDOMParser)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMParser)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMParserJS)
|
||||
|
@ -9592,7 +9578,7 @@ public:
|
|||
do_GetService("@mozilla.org/js/xpc/ContextStack;1");
|
||||
NS_ENSURE_TRUE(stack, NS_OK);
|
||||
|
||||
stack->GetSafeJSContext(&cx);
|
||||
cx = stack->GetSafeJSContext();
|
||||
NS_ENSURE_TRUE(cx, NS_OK);
|
||||
}
|
||||
|
||||
|
@ -10215,186 +10201,6 @@ nsTreeColumnsSH::GetNamedItem(nsISupports *aNative,
|
|||
#endif
|
||||
|
||||
|
||||
// Storage scriptable helper
|
||||
|
||||
// One reason we need a newResolve hook is that in order for
|
||||
// enumeration of storage object keys to work the keys we're
|
||||
// enumerating need to exist on the storage object for the JS engine
|
||||
// to find them.
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStorageSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, PRUint32 flags,
|
||||
JSObject **objp, bool *_retval)
|
||||
{
|
||||
if (ObjectIsNativeWrapper(cx, obj)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
JSObject *realObj;
|
||||
wrapper->GetJSObject(&realObj);
|
||||
|
||||
JSAutoEnterCompartment ac;
|
||||
if (!ac.enter(cx, realObj)) {
|
||||
*_retval = false;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// First check to see if the property is defined on our prototype.
|
||||
|
||||
JSObject *proto = ::JS_GetPrototype(realObj);
|
||||
JSBool hasProp;
|
||||
|
||||
if (proto &&
|
||||
(::JS_HasPropertyById(cx, proto, id, &hasProp) &&
|
||||
hasProp)) {
|
||||
// We found the property we're resolving on the prototype,
|
||||
// nothing left to do here then.
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// We're resolving property that doesn't exist on the prototype,
|
||||
// check if the key exists in the storage object.
|
||||
|
||||
nsCOMPtr<nsIDOMStorageObsolete> storage(do_QueryWrappedNative(wrapper));
|
||||
|
||||
JSString *jsstr = IdToString(cx, id);
|
||||
if (!jsstr)
|
||||
return JS_FALSE;
|
||||
|
||||
nsDependentJSString depStr;
|
||||
if (!depStr.init(cx, jsstr))
|
||||
return JS_FALSE;
|
||||
|
||||
// GetItem() will return null if the caller can't access the session
|
||||
// storage item.
|
||||
nsCOMPtr<nsIDOMStorageItem> item;
|
||||
nsresult rv = storage->GetItem(depStr, getter_AddRefs(item));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (item) {
|
||||
if (!::JS_DefinePropertyById(cx, realObj, id, JSVAL_VOID, nsnull, nsnull,
|
||||
JSPROP_ENUMERATE)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
*objp = realObj;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsISupports*
|
||||
nsStorageSH::GetNamedItem(nsISupports *aNative, const nsAString& aName,
|
||||
nsWrapperCache **aCache, nsresult *aResult)
|
||||
{
|
||||
nsDOMStorage* storage = nsDOMStorage::FromSupports(aNative);
|
||||
|
||||
return storage->GetNamedItem(aName, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStorageSH::SetProperty(nsIXPConnectWrappedNative *wrapper,
|
||||
JSContext *cx, JSObject *obj, jsid id,
|
||||
jsval *vp, bool *_retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMStorageObsolete> storage(do_QueryWrappedNative(wrapper));
|
||||
NS_ENSURE_TRUE(storage, NS_ERROR_UNEXPECTED);
|
||||
|
||||
JSString *key = IdToString(cx, id);
|
||||
NS_ENSURE_TRUE(key, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsDependentJSString keyStr;
|
||||
NS_ENSURE_TRUE(keyStr.init(cx, key), NS_ERROR_UNEXPECTED);
|
||||
|
||||
JSString *value = ::JS_ValueToString(cx, *vp);
|
||||
NS_ENSURE_TRUE(value, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsDependentJSString valueStr;
|
||||
NS_ENSURE_TRUE(valueStr.init(cx, value), NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsresult rv = storage->SetItem(keyStr, valueStr);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = NS_SUCCESS_I_DID_SOMETHING;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStorageSH::DelProperty(nsIXPConnectWrappedNative *wrapper,
|
||||
JSContext *cx, JSObject *obj, jsid id,
|
||||
jsval *vp, bool *_retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMStorageObsolete> storage(do_QueryWrappedNative(wrapper));
|
||||
NS_ENSURE_TRUE(storage, NS_ERROR_UNEXPECTED);
|
||||
|
||||
JSString *key = IdToString(cx, id);
|
||||
NS_ENSURE_TRUE(key, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsDependentJSString keyStr;
|
||||
NS_ENSURE_TRUE(keyStr.init(cx, key), NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsresult rv = storage->RemoveItem(keyStr);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = NS_SUCCESS_I_DID_SOMETHING;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStorageSH::NewEnumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, PRUint32 enum_op, jsval *statep,
|
||||
jsid *idp, bool *_retval)
|
||||
{
|
||||
if (enum_op == JSENUMERATE_INIT || enum_op == JSENUMERATE_INIT_ALL) {
|
||||
nsCOMPtr<nsPIDOMStorage> storage(do_QueryWrappedNative(wrapper));
|
||||
|
||||
// XXXndeakin need to free the keys afterwards
|
||||
nsTArray<nsString> *keys = storage->GetKeys();
|
||||
NS_ENSURE_TRUE(keys, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
*statep = PRIVATE_TO_JSVAL(keys);
|
||||
|
||||
if (idp) {
|
||||
*idp = INT_TO_JSID(keys->Length());
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsTArray<nsString> *keys =
|
||||
(nsTArray<nsString> *)JSVAL_TO_PRIVATE(*statep);
|
||||
|
||||
if (enum_op == JSENUMERATE_NEXT && keys->Length() != 0) {
|
||||
nsString& key = keys->ElementAt(0);
|
||||
JSString *str =
|
||||
JS_NewUCStringCopyN(cx, reinterpret_cast<const jschar *>
|
||||
(key.get()),
|
||||
key.Length());
|
||||
NS_ENSURE_TRUE(str, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
JS_ValueToId(cx, STRING_TO_JSVAL(str), idp);
|
||||
|
||||
keys->RemoveElementAt(0);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// destroy the keys array if we have no keys or if we're done
|
||||
NS_ABORT_IF_FALSE(enum_op == JSENUMERATE_DESTROY ||
|
||||
(enum_op == JSENUMERATE_NEXT && keys->Length() == 0),
|
||||
"Bad call from the JS engine");
|
||||
delete keys;
|
||||
|
||||
*statep = JSVAL_NULL;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// Storage2SH
|
||||
|
||||
// One reason we need a newResolve hook is that in order for
|
||||
|
@ -10908,8 +10714,20 @@ WebGLExtensionSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
|
|||
|
||||
WebGLExtension *ext = static_cast<WebGLExtension*>(nativeObj);
|
||||
WebGLContext *webgl = ext->Context();
|
||||
nsHTMLCanvasElement *canvas = webgl->HTMLCanvasElement();
|
||||
nsINode *node = static_cast<nsINode*>(canvas);
|
||||
nsINode *node = webgl->GetParentObject();
|
||||
|
||||
return WrapNativeParent(cx, globalObj, node, node, parentObj);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWebGLViewportHandlerSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
JSObject *globalObj, JSObject **parentObj)
|
||||
{
|
||||
*parentObj = globalObj;
|
||||
|
||||
WebGLContext *webgl = static_cast<WebGLContext*>(
|
||||
static_cast<nsIDOMWebGLRenderingContext*>(nativeObj));
|
||||
nsINode *node = webgl->GetParentObject();
|
||||
|
||||
return WrapNativeParent(cx, globalObj, node, node, parentObj);
|
||||
}
|
||||
|
|
|
@ -1355,47 +1355,6 @@ public:
|
|||
|
||||
// WebApps Storage helpers
|
||||
|
||||
class nsStorageSH : public nsNamedArraySH
|
||||
{
|
||||
protected:
|
||||
nsStorageSH(nsDOMClassInfoData* aData) : nsNamedArraySH(aData)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~nsStorageSH()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, PRUint32 flags,
|
||||
JSObject **objp, bool *_retval);
|
||||
NS_IMETHOD SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, jsval *vp, bool *_retval);
|
||||
NS_IMETHOD DelProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, jsval *vp, bool *_retval);
|
||||
NS_IMETHOD NewEnumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, PRUint32 enum_op, jsval *statep,
|
||||
jsid *idp, bool *_retval);
|
||||
|
||||
virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsWrapperCache **aCache, nsresult *aResult)
|
||||
{
|
||||
return nsnull;
|
||||
}
|
||||
// Override nsNamedArraySH::GetNamedItem()
|
||||
virtual nsISupports* GetNamedItem(nsISupports *aNative,
|
||||
const nsAString& aName,
|
||||
nsWrapperCache **cache,
|
||||
nsresult *aResult);
|
||||
|
||||
public:
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
{
|
||||
return new nsStorageSH(aData);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class nsStorage2SH : public nsDOMGenericSH
|
||||
{
|
||||
protected:
|
||||
|
@ -1612,6 +1571,9 @@ public:
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
JSObject *globalObj, JSObject **parentObj);
|
||||
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
{
|
||||
return new nsWebGLViewportHandlerSH(aData);
|
||||
|
|
|
@ -378,7 +378,6 @@ DOMCI_CLASS(StorageObsolete)
|
|||
DOMCI_CLASS(Storage)
|
||||
DOMCI_CLASS(StorageItem)
|
||||
DOMCI_CLASS(StorageEvent)
|
||||
DOMCI_CLASS(StorageEventObsolete)
|
||||
|
||||
// DOMParser, XMLSerializer
|
||||
DOMCI_CLASS(DOMParser)
|
||||
|
|
|
@ -78,6 +78,9 @@
|
|||
#include "nsDOMFile.h"
|
||||
#include "BasicLayers.h"
|
||||
#include "nsTArrayHelpers.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIMarkupDocumentViewer.h"
|
||||
|
||||
#if defined(MOZ_X11) && defined(MOZ_WIDGET_GTK2)
|
||||
#include <gdk/gdk.h>
|
||||
|
@ -283,6 +286,40 @@ static void DestroyNsRect(void* aObject, nsIAtom* aPropertyName,
|
|||
delete rect;
|
||||
}
|
||||
|
||||
static void
|
||||
MaybeReflowForInflationScreenWidthChange(nsPresContext *aPresContext)
|
||||
{
|
||||
if (aPresContext &&
|
||||
nsLayoutUtils::FontSizeInflationEnabled(aPresContext) &&
|
||||
nsLayoutUtils::FontSizeInflationMinTwips() != 0) {
|
||||
bool changed;
|
||||
aPresContext->ScreenWidthInchesForFontInflation(&changed);
|
||||
if (changed) {
|
||||
nsCOMPtr<nsISupports> container = aPresContext->GetContainer();
|
||||
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(container);
|
||||
if (docShell) {
|
||||
nsCOMPtr<nsIContentViewer> cv;
|
||||
docShell->GetContentViewer(getter_AddRefs(cv));
|
||||
nsCOMPtr<nsIMarkupDocumentViewer> mudv = do_QueryInterface(cv);
|
||||
if (mudv) {
|
||||
nsTArray<nsCOMPtr<nsIMarkupDocumentViewer> > array;
|
||||
mudv->AppendSubtree(array);
|
||||
for (PRUint32 i = 0, iEnd = array.Length(); i < iEnd; ++i) {
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsCOMPtr<nsIContentViewer> cv = do_QueryInterface(array[i]);
|
||||
cv->GetPresShell(getter_AddRefs(shell));
|
||||
nsIFrame *rootFrame = shell->GetRootFrame();
|
||||
if (rootFrame) {
|
||||
shell->FrameNeedsReflow(rootFrame, nsIPresShell::eResize,
|
||||
NS_FRAME_IS_DIRTY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::SetDisplayPortForElement(float aXPx, float aYPx,
|
||||
float aWidthPx, float aHeightPx,
|
||||
|
@ -295,7 +332,7 @@ nsDOMWindowUtils::SetDisplayPortForElement(float aXPx, float aYPx,
|
|||
nsIPresShell* presShell = GetPresShell();
|
||||
if (!presShell) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
nsRect displayport(nsPresContext::CSSPixelsToAppUnits(aXPx),
|
||||
nsPresContext::CSSPixelsToAppUnits(aYPx),
|
||||
|
@ -331,36 +368,42 @@ nsDOMWindowUtils::SetDisplayPortForElement(float aXPx, float aYPx,
|
|||
// We are setting a root displayport for a document.
|
||||
// The pres shell needs a special flag set.
|
||||
presShell->SetIgnoreViewportScrolling(true);
|
||||
|
||||
// When the "font.size.inflation.minTwips" preference is set, the
|
||||
// layout depends on the size of the screen. Since when the size
|
||||
// of the screen changes, the root displayport also changes, we
|
||||
// hook in the needed updates here rather than adding a
|
||||
// separate notification just for this change.
|
||||
nsPresContext* presContext = GetPresContext();
|
||||
MaybeReflowForInflationScreenWidthChange(presContext);
|
||||
}
|
||||
}
|
||||
|
||||
if (presShell) {
|
||||
nsIFrame* rootFrame = presShell->FrameManager()->GetRootFrame();
|
||||
if (rootFrame) {
|
||||
nsIContent* rootContent =
|
||||
rootScrollFrame ? rootScrollFrame->GetContent() : nsnull;
|
||||
nsRect rootDisplayport;
|
||||
bool usingDisplayport = rootContent &&
|
||||
nsLayoutUtils::GetDisplayPort(rootContent, &rootDisplayport);
|
||||
rootFrame->InvalidateWithFlags(
|
||||
usingDisplayport ? rootDisplayport : rootFrame->GetVisualOverflowRect(),
|
||||
nsIFrame::INVALIDATE_NO_THEBES_LAYERS);
|
||||
nsIFrame* rootFrame = presShell->FrameManager()->GetRootFrame();
|
||||
if (rootFrame) {
|
||||
nsIContent* rootContent =
|
||||
rootScrollFrame ? rootScrollFrame->GetContent() : nsnull;
|
||||
nsRect rootDisplayport;
|
||||
bool usingDisplayport = rootContent &&
|
||||
nsLayoutUtils::GetDisplayPort(rootContent, &rootDisplayport);
|
||||
rootFrame->InvalidateWithFlags(
|
||||
usingDisplayport ? rootDisplayport : rootFrame->GetVisualOverflowRect(),
|
||||
nsIFrame::INVALIDATE_NO_THEBES_LAYERS);
|
||||
|
||||
// If we are hiding something that is a display root then send empty paint
|
||||
// transaction in order to release retained layers because it won't get
|
||||
// any more paint requests when it is hidden.
|
||||
if (displayport.IsEmpty() &&
|
||||
rootFrame == nsLayoutUtils::GetDisplayRootFrame(rootFrame)) {
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
if (widget) {
|
||||
bool isRetainingManager;
|
||||
LayerManager* manager = widget->GetLayerManager(&isRetainingManager);
|
||||
if (isRetainingManager) {
|
||||
manager->BeginTransaction();
|
||||
nsLayoutUtils::PaintFrame(nsnull, rootFrame, nsRegion(), NS_RGB(255, 255, 255),
|
||||
nsLayoutUtils::PAINT_WIDGET_LAYERS |
|
||||
nsLayoutUtils::PAINT_EXISTING_TRANSACTION);
|
||||
}
|
||||
// If we are hiding something that is a display root then send empty paint
|
||||
// transaction in order to release retained layers because it won't get
|
||||
// any more paint requests when it is hidden.
|
||||
if (displayport.IsEmpty() &&
|
||||
rootFrame == nsLayoutUtils::GetDisplayRootFrame(rootFrame)) {
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
if (widget) {
|
||||
bool isRetainingManager;
|
||||
LayerManager* manager = widget->GetLayerManager(&isRetainingManager);
|
||||
if (isRetainingManager) {
|
||||
manager->BeginTransaction();
|
||||
nsLayoutUtils::PaintFrame(nsnull, rootFrame, nsRegion(), NS_RGB(255, 255, 255),
|
||||
nsLayoutUtils::PAINT_WIDGET_LAYERS |
|
||||
nsLayoutUtils::PAINT_EXISTING_TRANSACTION);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1167,7 +1167,7 @@ nsGlobalWindow::FreeInnerObjects()
|
|||
JSObject* obj = FastGetGlobalJSObject();
|
||||
if (obj) {
|
||||
if (!cx) {
|
||||
nsContentUtils::ThreadJSContextStack()->GetSafeJSContext(&cx);
|
||||
cx = nsContentUtils::ThreadJSContextStack()->GetSafeJSContext();
|
||||
}
|
||||
|
||||
JSAutoRequest ar(cx);
|
||||
|
@ -1390,44 +1390,14 @@ nsGlobalWindow::UnmarkGrayTimers()
|
|||
// nsGlobalWindow::nsIScriptGlobalObject
|
||||
//*****************************************************************************
|
||||
|
||||
nsresult
|
||||
nsGlobalWindow::SetScriptContext(nsIScriptContext *aScriptContext)
|
||||
{
|
||||
NS_ASSERTION(IsOuterWindow(), "Uh, SetScriptContext() called on inner window!");
|
||||
|
||||
NS_ASSERTION(!aScriptContext || !mContext, "Bad call to SetContext()!");
|
||||
|
||||
if (aScriptContext) {
|
||||
// should probably assert the context is clean???
|
||||
aScriptContext->WillInitializeContext();
|
||||
|
||||
// We need point the context to the global window before initializing it
|
||||
// so that it can make various decisions properly.
|
||||
aScriptContext->SetGlobalObject(this);
|
||||
|
||||
nsresult rv = aScriptContext->InitContext();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (IsFrame()) {
|
||||
// This window is a [i]frame, don't bother GC'ing when the
|
||||
// frame's context is destroyed since a GC will happen when the
|
||||
// frameset or host document is destroyed anyway.
|
||||
|
||||
aScriptContext->SetGCOnDestruction(false);
|
||||
}
|
||||
}
|
||||
|
||||
mContext = aScriptContext;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGlobalWindow::EnsureScriptEnvironment()
|
||||
{
|
||||
FORWARD_TO_OUTER(EnsureScriptEnvironment, (), NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
if (mJSObject)
|
||||
return NS_OK;
|
||||
if (mJSObject) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_ASSERTION(!GetCurrentInnerWindowInternal(),
|
||||
"mJSObject is null, but we have an inner window?");
|
||||
|
@ -1437,7 +1407,29 @@ nsGlobalWindow::EnsureScriptEnvironment()
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIScriptContext> context = scriptRuntime->CreateContext();
|
||||
return SetScriptContext(context);
|
||||
|
||||
NS_ASSERTION(!mContext, "Will overwrite mContext!");
|
||||
|
||||
// should probably assert the context is clean???
|
||||
context->WillInitializeContext();
|
||||
|
||||
// We need point the context to the global window before initializing it
|
||||
// so that it can make various decisions properly.
|
||||
context->SetGlobalObject(this);
|
||||
|
||||
rv = context->InitContext();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (IsFrame()) {
|
||||
// This window is a [i]frame, don't bother GC'ing when the
|
||||
// frame's context is destroyed since a GC will happen when the
|
||||
// frameset or host document is destroyed anyway.
|
||||
|
||||
context->SetGCOnDestruction(false);
|
||||
}
|
||||
|
||||
mContext = context;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIScriptContext *
|
||||
|
@ -2244,8 +2236,8 @@ nsGlobalWindow::SetDocShell(nsIDocShell* aDocShell)
|
|||
if (currentInner) {
|
||||
JSObject* obj = currentInner->FastGetGlobalJSObject();
|
||||
if (obj) {
|
||||
JSContext* cx;
|
||||
nsContentUtils::ThreadJSContextStack()->GetSafeJSContext(&cx);
|
||||
JSContext* cx =
|
||||
nsContentUtils::ThreadJSContextStack()->GetSafeJSContext();
|
||||
|
||||
JSAutoRequest ar(cx);
|
||||
|
||||
|
@ -5981,7 +5973,7 @@ PostMessageEvent::Run()
|
|||
// we need to find a JSContext.
|
||||
nsIThreadJSContextStack* cxStack = nsContentUtils::ThreadJSContextStack();
|
||||
if (cxStack) {
|
||||
cxStack->GetSafeJSContext(&cx);
|
||||
cx = cxStack->GetSafeJSContext();
|
||||
}
|
||||
|
||||
if (!cx) {
|
||||
|
|
|
@ -300,10 +300,6 @@ public:
|
|||
|
||||
virtual nsIScriptContext *GetScriptContext();
|
||||
|
||||
// Set a new script language context for this global. The native global
|
||||
// for the context is created by the context's GetNativeGlobal() method.
|
||||
virtual nsresult SetScriptContext(nsIScriptContext *aContext);
|
||||
|
||||
virtual void OnFinalize(JSObject* aObject);
|
||||
virtual void SetScriptsEnabled(bool aEnabled, bool aFireTimeouts);
|
||||
|
||||
|
|
|
@ -100,8 +100,8 @@ NS_HandleScriptError(nsIScriptGlobalObject *aScriptGlobal,
|
|||
|
||||
|
||||
#define NS_ISCRIPTGLOBALOBJECT_IID \
|
||||
{ 0x8f19a761, 0x0717, 0x4b3f, \
|
||||
{ 0x80, 0xc5, 0xed, 0x7e, 0x9c, 0xbc, 0x40, 0xb1 } }
|
||||
{ 0xd1549969, 0x92df, 0x4a75, \
|
||||
{ 0x8c, 0x12, 0x35, 0x14, 0xd1, 0x0b, 0xbc, 0x18 } }
|
||||
|
||||
/**
|
||||
* The global object which keeps a script context for each supported script
|
||||
|
@ -130,17 +130,10 @@ public:
|
|||
|
||||
virtual JSObject* GetGlobalJSObject() = 0;
|
||||
|
||||
virtual nsIScriptContext *GetContext() {
|
||||
return GetScriptContext();
|
||||
nsIScriptContext* GetContext() {
|
||||
return GetScriptContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a new language context for this global. The native global for the
|
||||
* context is created by the context's GetNativeGlobal() method.
|
||||
*/
|
||||
|
||||
virtual nsresult SetScriptContext(nsIScriptContext *aContext) = 0;
|
||||
|
||||
/**
|
||||
* Called when the global script for a language is finalized, typically as
|
||||
* part of its GC process. By the time this call is made, the
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "mozilla/dom/DOMJSClass.h"
|
||||
#include "mozilla/dom/workers/Workers.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "jsfriendapi.h"
|
||||
|
@ -44,11 +45,11 @@ Throw(JSContext* cx, nsresult rv)
|
|||
|
||||
template<bool mainThread>
|
||||
inline bool
|
||||
ThrowMethodFailedWithDetails(JSContext* cx, nsresult rv,
|
||||
ThrowMethodFailedWithDetails(JSContext* cx, const ErrorResult& rv,
|
||||
const char* /* ifaceName */,
|
||||
const char* /* memberName */)
|
||||
{
|
||||
return Throw<mainThread>(cx, rv);
|
||||
return Throw<mainThread>(cx, rv.ErrorCode());
|
||||
}
|
||||
|
||||
inline bool
|
||||
|
|
|
@ -67,9 +67,12 @@ DOMInterfaces = {
|
|||
'workers': True,
|
||||
'nativeType': 'mozilla::dom::workers::XMLHttpRequest',
|
||||
'headerFile': 'mozilla/dom/workers/bindings/XMLHttpRequest.h',
|
||||
'infallible': [
|
||||
'readyState', 'statusText'
|
||||
]
|
||||
'infallible': {
|
||||
'all': ['readyState', 'statusText' ],
|
||||
'getterOnly': [ 'timeout', 'withCredentials', 'mozBackgroundRequest',
|
||||
'responseType', 'responseXML', 'channel', 'multipart' ]
|
||||
}
|
||||
|
||||
}],
|
||||
|
||||
'XMLHttpRequestUpload': [
|
||||
|
|
|
@ -1325,89 +1325,19 @@ def getArgumentConversionTemplate(type, descriptor):
|
|||
if not type.isPrimitive():
|
||||
raise TypeError("Need conversion for argument type '%s'" % type)
|
||||
|
||||
tag = type.tag()
|
||||
replacements = dict()
|
||||
# XXXbz need to add support for [EnforceRange] and [Clamp]
|
||||
if type.nullable():
|
||||
replacements["declareArg"] = (
|
||||
" Nullable<${typeName}> ${name};\n"
|
||||
" if (${argVal}.isNullOrUndefined()) {\n"
|
||||
" ${name}.SetNull();\n"
|
||||
" } else"
|
||||
)
|
||||
replacements["finalValueSetter"] = "${name}.SetValue"
|
||||
return (" Nullable<${typeName}> ${name};\n"
|
||||
" if (${argVal}.isNullOrUndefined()) {\n"
|
||||
" ${name}.SetNull();\n"
|
||||
" } else if (!ValueToPrimitive<${typeName}>(cx, ${argVal}, &${name}.SetValue())) {\n"
|
||||
" return false;\n"
|
||||
" }\n")
|
||||
else:
|
||||
replacements["declareArg"] = " ${typeName} ${name};\n"
|
||||
replacements["finalValueSetter"] = "${name} = "
|
||||
|
||||
replacements["intermediateCast"] = ""
|
||||
|
||||
if tag == IDLType.Tags.bool:
|
||||
replacements["jstype"] = "JSBool"
|
||||
replacements["converter"] = "JS_ValueToBoolean"
|
||||
elif tag in [IDLType.Tags.int8, IDLType.Tags.uint8, IDLType.Tags.int16,
|
||||
IDLType.Tags.uint16, IDLType.Tags.int32, IDLType.Tags.uint32]:
|
||||
# XXXbz need to add support for [EnforceRange] and [Clamp]
|
||||
# The output of JS_ValueToECMAInt32 is determined as follows:
|
||||
# 1) The value is converted to a double
|
||||
# 2) Anything that's not a finite double returns 0
|
||||
# 3) The double is rounded towards zero to the nearest integer
|
||||
# 4) The resulting integer is reduced mod 2^32. The output of this
|
||||
# operation is an integer in the range [0, 2^32).
|
||||
# 5) If the resulting number is >= 2^31, 2^32 is subtracted from it.
|
||||
#
|
||||
# The result of all this is a number in the range [-2^31, 2^31)
|
||||
#
|
||||
# WebIDL conversions for the 8-bit, 16-bit, and 32-bit integer types
|
||||
# are defined in the same way, except that step 4 uses reduction mod
|
||||
# 2^8 and 2^16 for the 8-bit and 16-bit types respectively, and step 5
|
||||
# is only done for the signed types.
|
||||
#
|
||||
# C/C++ define integer conversion semantics to unsigned types as taking
|
||||
# your input integer mod (1 + largest value representable in the
|
||||
# unsigned type). Since 2^32 is zero mod 2^8, 2^16, and 2^32,
|
||||
# converting to the unsigned int of the relevant width will correctly
|
||||
# perform step 4; in particular, the 2^32 possibly subtracted in step 5
|
||||
# will become 0.
|
||||
#
|
||||
# Once we have step 4 done, we're just going to assume 2s-complement
|
||||
# representation and cast directly to the type we really want.
|
||||
#
|
||||
# So we can cast directly for all unsigned types and for int32_t; for
|
||||
# the smaller-width signed types we need to cast through the
|
||||
# corresponding unsigned type.
|
||||
replacements["jstype"] = "int32_t"
|
||||
replacements["converter"] = "JS::ToInt32"
|
||||
if tag is IDLType.Tags.int8:
|
||||
replacements["intermediateCast"] = "(uint8_t)"
|
||||
elif tag is IDLType.Tags.int16:
|
||||
replacements["intermediateCast"] = "(uint16_t)"
|
||||
else:
|
||||
replacements["intermediateCast"] = ""
|
||||
elif tag is IDLType.Tags.int64:
|
||||
# XXXbz this may not match what WebIDL says to do in terms of reducing
|
||||
# mod 2^64. Should we check?
|
||||
replacements["jstype"] = "int64_t"
|
||||
replacements["converter"] = "xpc::ValueToInt64"
|
||||
elif tag is IDLType.Tags.uint64:
|
||||
# XXXbz this may not match what WebIDL says to do in terms of reducing
|
||||
# mod 2^64. Should we check?
|
||||
replacements["jstype"] = "uint64_t"
|
||||
replacements["converter"] = "xpc::ValueToUint64"
|
||||
elif tag in [IDLType.Tags.float, IDLType.Tags.double]:
|
||||
replacements["jstype"] = "double"
|
||||
replacements["converter"] = "JS::ToNumber"
|
||||
else:
|
||||
raise TypeError("Unknown primitive type '%s'" % type);
|
||||
|
||||
# We substitute the %(name)s things here. Our caller will
|
||||
# substitute the ${name} things.
|
||||
return (" %(jstype)s ${name}_jstype;\n"
|
||||
"%(declareArg)s" # No leading whitespace or newline here, on purpose
|
||||
" if (%(converter)s(cx, ${argVal}, &${name}_jstype)) {\n"
|
||||
" %(finalValueSetter)s((${typeName})%(intermediateCast)s${name}_jstype);\n"
|
||||
" } else {\n"
|
||||
" return false;\n"
|
||||
" }\n" % replacements)
|
||||
return (" ${typeName} ${name};\n"
|
||||
" if (!ValueToPrimitive<${typeName}>(cx, ${argVal}, &${name})) {\n"
|
||||
" return false;\n"
|
||||
" }\n")
|
||||
|
||||
def convertConstIDLValueToJSVal(value):
|
||||
if isinstance(value, IDLNullValue):
|
||||
|
@ -1680,8 +1610,8 @@ class CGCallGenerator(CGThing):
|
|||
self.cgRoot.append(call)
|
||||
|
||||
if isFallible:
|
||||
self.cgRoot.prepend(CGGeneric("nsresult rv = NS_OK;"))
|
||||
self.cgRoot.append(CGGeneric("if (NS_FAILED(rv)) {"))
|
||||
self.cgRoot.prepend(CGGeneric("ErrorResult rv;"))
|
||||
self.cgRoot.append(CGGeneric("if (rv.Failed()) {"))
|
||||
self.cgRoot.append(CGIndenter(CGGeneric(errorReport)))
|
||||
self.cgRoot.append(CGGeneric("}"))
|
||||
|
||||
|
@ -2952,6 +2882,7 @@ class CGBindingRoot(CGThing):
|
|||
['mozilla/dom/BindingUtils.h',
|
||||
'mozilla/dom/DOMJSClass.h'],
|
||||
['mozilla/dom/Nullable.h',
|
||||
'mozilla/dom/PrimitiveConversions.h',
|
||||
'XPCQuickStubs.h',
|
||||
'AccessCheck.h',
|
||||
'WorkerPrivate.h',
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/
|
||||
/* vim: set ts=2 sw=2 et tw=79: */
|
||||
/* 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/. */
|
||||
|
||||
/**
|
||||
* A struct for tracking exceptions that need to be thrown to JS.
|
||||
*/
|
||||
|
||||
#ifndef mozilla_ErrorResult_h
|
||||
#define mozilla_ErrorResult_h
|
||||
|
||||
#include "nscore.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class ErrorResult {
|
||||
public:
|
||||
ErrorResult() {
|
||||
mResult = NS_OK;
|
||||
}
|
||||
|
||||
void Throw(nsresult rv) {
|
||||
MOZ_ASSERT(NS_FAILED(rv), "Please don't try throwing success");
|
||||
mResult = rv;
|
||||
}
|
||||
|
||||
// In the future, we can add overloads of Throw that take more
|
||||
// interesting things, like strings or DOM exception types or
|
||||
// something if desired.
|
||||
|
||||
// Backwards-compat to make conversion simpler. We don't call
|
||||
// Throw() here because people can easily pass success codes to
|
||||
// this.
|
||||
void operator=(nsresult rv) {
|
||||
mResult = rv;
|
||||
}
|
||||
|
||||
bool Failed() const {
|
||||
return NS_FAILED(mResult);
|
||||
}
|
||||
|
||||
nsresult ErrorCode() const {
|
||||
return mResult;
|
||||
}
|
||||
|
||||
private:
|
||||
nsresult mResult;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* mozilla_ErrorResult_h */
|
|
@ -45,13 +45,19 @@ CPPSRCS = \
|
|||
BindingUtils.cpp \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS_NAMESPACES = $(binding_include_path)
|
||||
EXPORTS_NAMESPACES = $(binding_include_path) mozilla
|
||||
|
||||
EXPORTS_mozilla = \
|
||||
ErrorResult.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS_$(binding_include_path) = \
|
||||
DOMJSClass.h \
|
||||
PrototypeList.h \
|
||||
RegisterBindings.h \
|
||||
Nullable.h \
|
||||
PrimitiveConversions.h \
|
||||
TypedArray.h \
|
||||
BindingUtils.h \
|
||||
$(binding_header_files) \
|
||||
$(NULL)
|
||||
|
|
|
@ -0,0 +1,133 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/
|
||||
/* vim: set ts=2 sw=2 et tw=79: */
|
||||
/* 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/. */
|
||||
|
||||
/**
|
||||
* Conversions from jsval to primitive values
|
||||
*/
|
||||
|
||||
#ifndef mozilla_dom_PrimitiveConversions_h
|
||||
#define mozilla_dom_PrimitiveConversions_h
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
template<typename T>
|
||||
struct PrimitiveConversionTraits {
|
||||
};
|
||||
|
||||
struct PrimitiveConversionTraits_smallInt {
|
||||
// The output of JS::ToInt32 is determined as follows:
|
||||
// 1) The value is converted to a double
|
||||
// 2) Anything that's not a finite double returns 0
|
||||
// 3) The double is rounded towards zero to the nearest integer
|
||||
// 4) The resulting integer is reduced mod 2^32. The output of this
|
||||
// operation is an integer in the range [0, 2^32).
|
||||
// 5) If the resulting number is >= 2^31, 2^32 is subtracted from it.
|
||||
//
|
||||
// The result of all this is a number in the range [-2^31, 2^31)
|
||||
//
|
||||
// WebIDL conversions for the 8-bit, 16-bit, and 32-bit integer types
|
||||
// are defined in the same way, except that step 4 uses reduction mod
|
||||
// 2^8 and 2^16 for the 8-bit and 16-bit types respectively, and step 5
|
||||
// is only done for the signed types.
|
||||
//
|
||||
// C/C++ define integer conversion semantics to unsigned types as taking
|
||||
// your input integer mod (1 + largest value representable in the
|
||||
// unsigned type). Since 2^32 is zero mod 2^8, 2^16, and 2^32,
|
||||
// converting to the unsigned int of the relevant width will correctly
|
||||
// perform step 4; in particular, the 2^32 possibly subtracted in step 5
|
||||
// will become 0.
|
||||
//
|
||||
// Once we have step 4 done, we're just going to assume 2s-complement
|
||||
// representation and cast directly to the type we really want.
|
||||
//
|
||||
// So we can cast directly for all unsigned types and for int32_t; for
|
||||
// the smaller-width signed types we need to cast through the
|
||||
// corresponding unsigned type.
|
||||
typedef int32_t jstype;
|
||||
typedef int32_t intermediateType;
|
||||
static inline bool converter(JSContext* cx, JS::Value v, jstype* retval) {
|
||||
return JS::ToInt32(cx, v, retval);
|
||||
}
|
||||
};
|
||||
template<>
|
||||
struct PrimitiveConversionTraits<int8_t> : PrimitiveConversionTraits_smallInt {
|
||||
typedef uint8_t intermediateType;
|
||||
};
|
||||
template<>
|
||||
struct PrimitiveConversionTraits<uint8_t> : PrimitiveConversionTraits_smallInt {
|
||||
};
|
||||
template<>
|
||||
struct PrimitiveConversionTraits<int16_t> : PrimitiveConversionTraits_smallInt {
|
||||
typedef uint16_t intermediateType;
|
||||
};
|
||||
template<>
|
||||
struct PrimitiveConversionTraits<uint16_t> : PrimitiveConversionTraits_smallInt {
|
||||
};
|
||||
template<>
|
||||
struct PrimitiveConversionTraits<int32_t> : PrimitiveConversionTraits_smallInt {
|
||||
};
|
||||
template<>
|
||||
struct PrimitiveConversionTraits<uint32_t> : PrimitiveConversionTraits_smallInt {
|
||||
};
|
||||
|
||||
template<>
|
||||
struct PrimitiveConversionTraits<bool> {
|
||||
typedef JSBool jstype;
|
||||
typedef bool intermediateType;
|
||||
static inline bool converter(JSContext* cx, JS::Value v, jstype* retval) {
|
||||
return JS_ValueToBoolean(cx, v, retval);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct PrimitiveConversionTraits<int64_t> {
|
||||
typedef int64_t jstype;
|
||||
typedef int64_t intermediateType;
|
||||
static inline bool converter(JSContext* cx, JS::Value v, jstype* retval) {
|
||||
return xpc::ValueToInt64(cx, v, retval);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct PrimitiveConversionTraits<uint64_t> {
|
||||
typedef uint64_t jstype;
|
||||
typedef uint64_t intermediateType;
|
||||
static inline bool converter(JSContext* cx, JS::Value v, jstype* retval) {
|
||||
return xpc::ValueToUint64(cx, v, retval);
|
||||
}
|
||||
};
|
||||
|
||||
struct PrimitiveConversionTraits_float {
|
||||
typedef double jstype;
|
||||
typedef double intermediateType;
|
||||
static inline bool converter(JSContext* cx, JS::Value v, jstype* retval) {
|
||||
return JS::ToNumber(cx, v, retval);
|
||||
}
|
||||
};
|
||||
template<>
|
||||
struct PrimitiveConversionTraits<float> : PrimitiveConversionTraits_float {
|
||||
};
|
||||
template<>
|
||||
struct PrimitiveConversionTraits<double> : PrimitiveConversionTraits_float {
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
bool ValueToPrimitive(JSContext* cx, JS::Value v, T* retval)
|
||||
{
|
||||
typename PrimitiveConversionTraits<T>::jstype t;
|
||||
if (!PrimitiveConversionTraits<T>::converter(cx, v, &t))
|
||||
return false;
|
||||
|
||||
*retval =
|
||||
static_cast<typename PrimitiveConversionTraits<T>::intermediateType>(t);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* mozilla_dom_PrimitiveConversions_h */
|
|
@ -0,0 +1,97 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/
|
||||
/* vim: set ts=2 sw=2 et tw=79: */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef mozilla_dom_TypedArray_h
|
||||
#define mozilla_dom_TypedArray_h
|
||||
|
||||
#include "jsfriendapi.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
/*
|
||||
* Various typed array classes for argument conversion. We have a base class
|
||||
* that has a way of initializing a TypedArray from an existing typed array, and
|
||||
* a subclass of the base class that supports creation of a relevant typed array
|
||||
* or array buffer object.
|
||||
*/
|
||||
template<typename T, typename U,
|
||||
U* GetData(JSObject*, JSContext*),
|
||||
uint32_t GetLength(JSObject*, JSContext*)>
|
||||
struct TypedArray_base {
|
||||
TypedArray_base(JSContext* cx, JSObject* obj) :
|
||||
mData(static_cast<T*>(GetData(obj, cx))),
|
||||
mLength(GetLength(obj, cx)),
|
||||
mObj(obj)
|
||||
{}
|
||||
|
||||
T* const mData;
|
||||
const uint32_t mLength;
|
||||
JSObject* const mObj;
|
||||
};
|
||||
|
||||
|
||||
template<typename T, typename U,
|
||||
U* GetData(JSObject*, JSContext*),
|
||||
uint32_t GetLength(JSObject*, JSContext*),
|
||||
JSObject* CreateNew(JSContext*, uint32_t)>
|
||||
struct TypedArray : public TypedArray_base<T,U,GetData,GetLength> {
|
||||
TypedArray(JSContext* cx, JSObject* obj) :
|
||||
TypedArray_base<T,U,GetData,GetLength>(cx, obj)
|
||||
{}
|
||||
|
||||
static inline JSObject*
|
||||
Create(JSContext* cx, uint32_t length, T* data = NULL) {
|
||||
JSObject* obj = CreateNew(cx, length);
|
||||
if (!obj) {
|
||||
return NULL;
|
||||
}
|
||||
if (data) {
|
||||
T* buf = static_cast<T*>(GetData(obj, cx));
|
||||
memcpy(buf, data, length*sizeof(T));
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
};
|
||||
|
||||
typedef TypedArray<int8_t, int8_t, JS_GetInt8ArrayData, JS_GetTypedArrayLength,
|
||||
JS_NewInt8Array>
|
||||
Int8Array;
|
||||
typedef TypedArray<uint8_t, uint8_t, JS_GetUint8ArrayData,
|
||||
JS_GetTypedArrayLength, JS_NewUint8Array>
|
||||
Uint8Array;
|
||||
typedef TypedArray<uint8_t, uint8_t, JS_GetUint8ClampedArrayData,
|
||||
JS_GetTypedArrayLength, JS_NewUint8Array>
|
||||
Uint8ClampedArray;
|
||||
typedef TypedArray<int16_t, int16_t, JS_GetInt16ArrayData,
|
||||
JS_GetTypedArrayLength, JS_NewInt16Array>
|
||||
Int16Array;
|
||||
typedef TypedArray<uint16_t, uint16_t, JS_GetUint16ArrayData,
|
||||
JS_GetTypedArrayLength, JS_NewUint16Array>
|
||||
Uint16Array;
|
||||
typedef TypedArray<int32_t, int32_t, JS_GetInt32ArrayData,
|
||||
JS_GetTypedArrayLength, JS_NewInt32Array>
|
||||
Int32Array;
|
||||
typedef TypedArray<uint32_t, uint32_t, JS_GetUint32ArrayData,
|
||||
JS_GetTypedArrayLength, JS_NewUint32Array>
|
||||
Uint32Array;
|
||||
typedef TypedArray<float, float, JS_GetFloat32ArrayData, JS_GetTypedArrayLength,
|
||||
JS_NewFloat32Array>
|
||||
Float32Array;
|
||||
typedef TypedArray<double, double, JS_GetFloat64ArrayData,
|
||||
JS_GetTypedArrayLength, JS_NewFloat64Array>
|
||||
Float64Array;
|
||||
typedef TypedArray_base<uint8_t, void, JS_GetArrayBufferViewData,
|
||||
JS_GetArrayBufferViewByteLength>
|
||||
ArrayBufferView;
|
||||
typedef TypedArray<uint8_t, uint8_t, JS_GetArrayBufferData,
|
||||
JS_GetArrayBufferByteLength, JS_NewArrayBuffer>
|
||||
ArrayBuffer;
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* mozilla_dom_TypedArray_h */
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-10.xml": {
|
||||
"document.getElementsByClassName(): compound": true
|
||||
},
|
||||
|
||||
"webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-11.xml": {
|
||||
"document.getElementsByClassName(): \"tricky\" compound": true
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@ DEPTH = ../../../../../..
|
|||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
relativesrcdir = dom/imported-tests/html/tests/submission/Mozilla
|
||||
relativesrcdir = dom/imptests/html/tests/submission/Mozilla
|
||||
|
||||
DIRS = \
|
||||
$(NULL)
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче