Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Further Javelin fixes for static analysis and form pair lists

Summary:
Some stuff I missed and some stuff to support static analysis. Pretty
straightforward.

Test Plan:
Phabricator appears to analyze cleanly and work properly with these changes.

Reviewed By: tomo
Reviewers: tomo, mroch, aran
CC: aran, epriestley, tomo
Differential Revision: 222
  • Loading branch information...
commit d5cd365d042ad7997e01f0cca5214c5deadfd126 1 parent 099162f
@epriestley epriestley authored
View
1  .gitignore
@@ -22,3 +22,4 @@
# Mac OSX build artifacts
/support/jsast/jsast.dSYM/
/support/jsxmin/jsxmin.dSYM/
+/support/javelinsymbols/javelinsymbols.dSYM/
View
4 pkg/javelin.dev.js
@@ -1929,6 +1929,9 @@ JX.install('Request', {
/**
* @requires javelin-install javelin-event
* @provides javelin-vector
+ *
+ * @javelin-installs JX.$V
+ *
* @javelin
*/
@@ -2264,6 +2267,7 @@ JX.install('Vector', {
*
* @javelin-installs JX.$
* @javelin-installs JX.$N
+ * @javelin-installs JX.$H
*
* @javelin
*/
View
9 pkg/workflow.dev.js
@@ -116,14 +116,15 @@ JX.install('Workflow', {
if (JX.Workflow._disabled) {
return;
}
+
var t = event.getTarget();
if (t.name == '__cancel__' || t.name == '__close__') {
JX.Workflow._pop();
} else {
var form = event.getNode('jx-dialog');
- var data = JX.DOM.serialize(form);
- data[t.name] = true;
+ var data = JX.DOM.convertFormToListOfPairs(form);
+ data.push([t.name, true]);
var active = JX.Workflow._stack[JX.Workflow._stack.length - 1];
var e = active.invoke('submit', {form: form, data: data});
@@ -131,7 +132,7 @@ JX.install('Workflow', {
active._destroy();
active
.setURI(form.getAttribute('action') || active.getURI())
- .setData(data)
+ .setDataWithListOfPairs(data)
.start();
}
}
@@ -157,7 +158,7 @@ JX.install('Workflow', {
JX.DOM.listen(
this._root,
'click',
- 'tag:button',
+ [['jx-workflow-button'], ['tag:button']],
JX.Workflow._onbutton);
document.body.appendChild(this._root);
var d = JX.Vector.getDim(this._root);
View
2  pkg/workflow.min.js
@@ -1 +1 @@
-JX.install('Mask',{statics:{_depth:0,_mask:null,show:function(){if(!JX.Mask._depth){JX.Mask._mask=JX.$N('div',{className:'jx-mask'});document.body.appendChild(JX.Mask._mask);JX.Vector.getDocument().setDim(JX.Mask._mask);}++JX.Mask._depth;},hide:function(){--JX.Mask._depth;if(!JX.Mask._depth){JX.DOM.remove(JX.Mask._mask);JX.Mask._mask=null;}}}});JX.install('Workflow',{construct:function(b,a){this.setURI(b);this.setData(a||{});},events:['error','finally','submit'],statics:{_stack:[],newFromForm:function(b,a){var d=[].concat(JX.DOM.scry(b,'input'),JX.DOM.scry(b,'button'),JX.DOM.scry(b,'textarea'));for(var c=0;c<d.length;c++)if(d[c].disabled){delete d[c];}else d[c].disabled=true;var f=JX.DOM.convertFormToListOfPairs(b);for(var e in a)f.push([e,a[e]]);var g=new JX.Workflow(b.getAttribute('action'),{});g.setDataWithListOfPairs(f);g.setMethod(b.getAttribute('method'));g.listen('finally',function(){for(var h=0;h<d.length;h++)d[h]&&(d[h].disabled=false);});return g;},newFromLink:function(a){var b=new JX.Workflow(a.href);return b;},_push:function(a){JX.Mask.show();JX.Workflow._stack.push(a);},_pop:function(){var a=JX.Workflow._stack.pop();(a.getCloseHandler()||JX.bag)();a._destroy();JX.Mask.hide();},disable:function(){JX.Workflow._disabled=true;},_onbutton:function(event){if(JX.Stratcom.pass())return;if(JX.Workflow._disabled)return;var e=event.getTarget();if(e.name=='__cancel__'||e.name=='__close__'){JX.Workflow._pop();}else{var d=event.getNode('jx-dialog');var b=JX.DOM.serialize(d);b[e.name]=true;var a=JX.Workflow._stack[JX.Workflow._stack.length-1];var c=a.invoke('submit',{form:d,data:b});if(!c.getStopped()){a._destroy();a.setURI(d.getAttribute('action')||a.getURI()).setData(b).start();}}event.prevent();}},members:{_root:null,_pushed:false,_data:null,_onload:function(c){if(c&&(typeof c.redirect!='undefined')){JX.$U(c.redirect).go();}else if(c&&c.dialog){this._push();this._root=JX.$N('div',{className:'jx-client-dialog'},JX.$H(c.dialog));JX.DOM.listen(this._root,'click','tag:button',JX.Workflow._onbutton);document.body.appendChild(this._root);var b=JX.Vector.getDim(this._root);var e=JX.Vector.getViewport();var d=JX.Vector.getScroll();JX.$V((e.x-b.x)/2,d.y+100).setPos(this._root);try{JX.DOM.focus(JX.DOM.find(this._root,'button','__default__'));var inputs=JX.DOM.scry(this._root,'input').concat(JX.DOM.scry(this._root,'textarea'));var miny=Number.POSITIVE_INFINITY;var target=null;for(var ii=0;ii<inputs.length;++ii)if(inputs[ii].type!='hidden'){var p=JX.$V(inputs[ii]);if(p.y<miny){miny=p.y;target=inputs[ii];}}target&&JX.DOM.focus(target);}catch(a){}}else if(this.getHandler()){this.getHandler()(c);this._pop();}},_push:function(){if(!this._pushed){this._pushed=true;JX.Workflow._push(this);}},_pop:function(){if(this._pushed){this._pushed=false;JX.Workflow._pop();}},_destroy:function(){if(this._root){JX.DOM.remove(this._root);this._root=null;}},start:function(){var d=this.getURI();var b=this.getMethod();var c=new JX.Request(d,JX.bind(this,this._onload));var a=this._data;a.push(['__wflow__',true]);c.setDataWithListOfPairs(a);c.setDataSerializer(this.getDataSerializer());if(b)c.setMethod(b);c.listen('finally',JX.bind(this,this.invoke,'finally'));c.listen('error',JX.bind(this,function(f){var e=this.invoke('error',f);if(e.getStopped())return;}));c.send();},setData:function(a){this._data=[];for(var b in a)this._data.push([b,a[b]]);return this;},setDataWithListOfPairs:function(a){this._data=a;return this;}},properties:{handler:null,closeHandler:null,dataSerializer:null,method:null,URI:null}});
+JX.install('Mask',{statics:{_depth:0,_mask:null,show:function(){if(!JX.Mask._depth){JX.Mask._mask=JX.$N('div',{className:'jx-mask'});document.body.appendChild(JX.Mask._mask);JX.Vector.getDocument().setDim(JX.Mask._mask);}++JX.Mask._depth;},hide:function(){--JX.Mask._depth;if(!JX.Mask._depth){JX.DOM.remove(JX.Mask._mask);JX.Mask._mask=null;}}}});JX.install('Workflow',{construct:function(b,a){this.setURI(b);this.setData(a||{});},events:['error','finally','submit'],statics:{_stack:[],newFromForm:function(b,a){var d=[].concat(JX.DOM.scry(b,'input'),JX.DOM.scry(b,'button'),JX.DOM.scry(b,'textarea'));for(var c=0;c<d.length;c++)if(d[c].disabled){delete d[c];}else d[c].disabled=true;var f=JX.DOM.convertFormToListOfPairs(b);for(var e in a)f.push([e,a[e]]);var g=new JX.Workflow(b.getAttribute('action'),{});g.setDataWithListOfPairs(f);g.setMethod(b.getAttribute('method'));g.listen('finally',function(){for(var h=0;h<d.length;h++)d[h]&&(d[h].disabled=false);});return g;},newFromLink:function(a){var b=new JX.Workflow(a.href);return b;},_push:function(a){JX.Mask.show();JX.Workflow._stack.push(a);},_pop:function(){var a=JX.Workflow._stack.pop();(a.getCloseHandler()||JX.bag)();a._destroy();JX.Mask.hide();},disable:function(){JX.Workflow._disabled=true;},_onbutton:function(event){if(JX.Stratcom.pass())return;if(JX.Workflow._disabled)return;var e=event.getTarget();if(e.name=='__cancel__'||e.name=='__close__'){JX.Workflow._pop();}else{var d=event.getNode('jx-dialog');var b=JX.DOM.convertFormToListOfPairs(d);b.push([e.name,true]);var a=JX.Workflow._stack[JX.Workflow._stack.length-1];var c=a.invoke('submit',{form:d,data:b});if(!c.getStopped()){a._destroy();a.setURI(d.getAttribute('action')||a.getURI()).setDataWithListOfPairs(b).start();}}event.prevent();}},members:{_root:null,_pushed:false,_data:null,_onload:function(c){if(c&&(typeof c.redirect!='undefined')){JX.$U(c.redirect).go();}else if(c&&c.dialog){this._push();this._root=JX.$N('div',{className:'jx-client-dialog'},JX.$H(c.dialog));JX.DOM.listen(this._root,'click',[['jx-workflow-button'],['tag:button']],JX.Workflow._onbutton);document.body.appendChild(this._root);var b=JX.Vector.getDim(this._root);var e=JX.Vector.getViewport();var d=JX.Vector.getScroll();JX.$V((e.x-b.x)/2,d.y+100).setPos(this._root);try{JX.DOM.focus(JX.DOM.find(this._root,'button','__default__'));var inputs=JX.DOM.scry(this._root,'input').concat(JX.DOM.scry(this._root,'textarea'));var miny=Number.POSITIVE_INFINITY;var target=null;for(var ii=0;ii<inputs.length;++ii)if(inputs[ii].type!='hidden'){var p=JX.$V(inputs[ii]);if(p.y<miny){miny=p.y;target=inputs[ii];}}target&&JX.DOM.focus(target);}catch(a){}}else if(this.getHandler()){this.getHandler()(c);this._pop();}},_push:function(){if(!this._pushed){this._pushed=true;JX.Workflow._push(this);}},_pop:function(){if(this._pushed){this._pushed=false;JX.Workflow._pop();}},_destroy:function(){if(this._root){JX.DOM.remove(this._root);this._root=null;}},start:function(){var d=this.getURI();var b=this.getMethod();var c=new JX.Request(d,JX.bind(this,this._onload));var a=this._data;a.push(['__wflow__',true]);c.setDataWithListOfPairs(a);c.setDataSerializer(this.getDataSerializer());if(b)c.setMethod(b);c.listen('finally',JX.bind(this,this.invoke,'finally'));c.listen('error',JX.bind(this,function(f){var e=this.invoke('error',f);if(e.getStopped())return;}));c.send();},setData:function(a){this._data=[];for(var b in a)this._data.push([b,a[b]]);return this;},setDataWithListOfPairs:function(a){this._data=a;return this;}},properties:{handler:null,closeHandler:null,dataSerializer:null,method:null,URI:null}});
View
11 scripts/build.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+set -x
+set -e
+
+ROOT=`dirname $0`"/../"
+(cd ${ROOT}externals/libfbjs && make)
+(cd ${ROOT}support/javelinsymbols && make)
+(cd ${ROOT}support/jsast && make)
+(cd ${ROOT}support/jsxmin && make)
+
+
View
1  src/lib/DOM.js
@@ -4,6 +4,7 @@
*
* @javelin-installs JX.$
* @javelin-installs JX.$N
+ * @javelin-installs JX.$H
*
* @javelin
*/
View
3  src/lib/Vector.js
@@ -1,6 +1,9 @@
/**
* @requires javelin-install javelin-event
* @provides javelin-vector
+ *
+ * @javelin-installs JX.$V
+ *
* @javelin
*/
View
9 src/lib/Workflow.js
@@ -83,14 +83,15 @@ JX.install('Workflow', {
if (JX.Workflow._disabled) {
return;
}
+
var t = event.getTarget();
if (t.name == '__cancel__' || t.name == '__close__') {
JX.Workflow._pop();
} else {
var form = event.getNode('jx-dialog');
- var data = JX.DOM.serialize(form);
- data[t.name] = true;
+ var data = JX.DOM.convertFormToListOfPairs(form);
+ data.push([t.name, true]);
var active = JX.Workflow._stack[JX.Workflow._stack.length - 1];
var e = active.invoke('submit', {form: form, data: data});
@@ -98,7 +99,7 @@ JX.install('Workflow', {
active._destroy();
active
.setURI(form.getAttribute('action') || active.getURI())
- .setData(data)
+ .setDataWithListOfPairs(data)
.start();
}
}
@@ -124,7 +125,7 @@ JX.install('Workflow', {
JX.DOM.listen(
this._root,
'click',
- 'tag:button',
+ [['jx-workflow-button'], ['tag:button']],
JX.Workflow._onbutton);
document.body.appendChild(this._root);
var d = JX.Vector.getDim(this._root);
Please sign in to comment.
Something went wrong with that request. Please try again.