Guest User

Untitled

a guest
Aug 18th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. var observer = require("observer-service");
  2. const {Cc,Ci,Cu,components} = require("chrome");
  3. var bs = require("byte-streams");
  4.  
  5. function getQuerystring(path){
  6. s = path.split('?')
  7. if (s.length == 1) {
  8. return "";
  9. } else {
  10. return s[1];
  11. }
  12. }
  13.  
  14. function callback(subject, data) {
  15. var httpChannel = subject.QueryInterface(Ci.nsIHttpChannel);
  16. console.log(httpChannel);
  17. console.log(httpChannel.URI.path);
  18. console.log(httpChannel.requestMethod);
  19. var data = '';
  20. if (httpChannel.requestMethod == 'POST'){
  21. var post = subject.QueryInterface(Ci.nsIUploadChannel);
  22. console.log(post);
  23. console.log(post.uploadStream);
  24. console.log(bs.ByteReader(post.uploadStream));
  25. data = "???";
  26. } else {
  27. data = getQuerystring(httpChannel.URI.path);
  28. }
  29. console.log(data)
  30. }
  31.  
  32.  
  33.  
  34.  
  35. observer.add('http-on-modify-request', callback);
Add Comment
Please, Sign In to add comment