|
Revision 3, 1.1 kB
(checked in by atack2, 3 years ago)
|
Added modify_outgoing script; this is the first script that I have been able to make with this capability. Verified with LiveHttpHeaders?.
|
| Line | |
|---|
| 1 |
<html> |
|---|
| 2 |
<script> |
|---|
| 3 |
document.write("Waiting for you to make a request"); |
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); |
|---|
| 7 |
|
|---|
| 8 |
var myObserver = { |
|---|
| 9 |
observe: function(subject,topic,data){ |
|---|
| 10 |
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); |
|---|
| 11 |
subject = subject.QueryInterface(Components.interfaces.nsIHttpChannel); |
|---|
| 12 |
subject.setRequestHeader("Overhaul", "yes", false); |
|---|
| 13 |
alert("Subject is now " + subject.getRequestHeader("Overhaul")); |
|---|
| 14 |
} |
|---|
| 15 |
}; |
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
var observerService = |
|---|
| 19 |
Components.classes["@mozilla.org/observer-service;1"] |
|---|
| 20 |
.getService(Components.interfaces.nsIObserverService); |
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
observerService.addObserver(myObserver,"http-on-modify-request",false); |
|---|
| 25 |
</script> |
|---|
| 26 |
<head> |
|---|
| 27 |
<meta http-equiv="Content-Type" content="text/html; |
|---|
| 28 |
charset=iso-8859-1"> |
|---|
| 29 |
<title>Test</title> |
|---|
| 30 |
</head> |
|---|
| 31 |
|
|---|
| 32 |
<body> |
|---|
| 33 |
<input type="button" name="foo!" onclick="javascript: netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');" /> |
|---|
| 34 |
</body> |
|---|
| 35 |
</html> |
|---|